Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 1/5] avcodec/cfhd, cfhddata: Simplify check for escape
Date: Sat,  3 Sep 2022 22:30:11 +0200
Message-ID: <AS8P250MB07443029028BA4485D8478F18F7D9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)

cfhd.c checked for level being equal to a certain codebook-
dependent constant and to run being two. The first check is
actually redundant, as all codebooks contain only one (real)
entry with run == 2 (as is usual with VLCs, this one real entry
has several corresponding entries in the table). But given
that no entry has a run of zero (except incomplete entries
which just signal that one needs to do another round of parsing),
one can actually use that as sentinel. This patch does so.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
One could now deduplicate reading the RL VLCs; or one could
branch based upon whether (codebook == 0) || (codebook == 1) or not
as this is the actual check in dequant_and_decompand().

 libavcodec/cfhd.c     | 4 ++--
 libavcodec/cfhddata.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 7afbbac59e..90b3d0a850 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -819,7 +819,7 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
                                    VLC_BITS, 3, 1);
 
                         /* escape */
-                        if (level == 64 && run == 2)
+                        if (!run)
                             break;
 
                         count += run;
@@ -850,7 +850,7 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
                                    VLC_BITS, 3, 1);
 
                         /* escape */
-                        if (level == 255 && run == 2)
+                        if (!run)
                             break;
 
                         count += run;
diff --git a/libavcodec/cfhddata.c b/libavcodec/cfhddata.c
index 67bd8e66db..212dccadb9 100644
--- a/libavcodec/cfhddata.c
+++ b/libavcodec/cfhddata.c
@@ -72,7 +72,7 @@ static const uint16_t table_9_vlc_run[NB_VLC_TABLE_9] = {
     1,    1,    1,    1,    1,    1,    1,    1,
     1,    1,    1,    1,    1,    1,    1,    1,
     1,    1,    1,    1,    1,    1,    1,    1,
-    1,    2,
+    1,    0,
 };
 
 static const uint8_t table_9_vlc_level[NB_VLC_TABLE_9] = {
@@ -226,7 +226,7 @@ static const uint16_t table_18_vlc_run[NB_VLC_TABLE_18] = {
      1,    1,    1,    1,    1,    1,    1,    1,
      1,    1,    1,    1,    1,    1,    1,    1,
      1,    1,    1,    1,    1,    1,    1,    1,
-     1,    1,    1,    1,    1,    1,    1,    2,
+     1,    1,    1,    1,    1,    1,    1,    0,
 };
 
 static const uint8_t table_18_vlc_level[NB_VLC_TABLE_18] = {
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

             reply	other threads:[~2022-09-03 20:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-03 20:30 Andreas Rheinhardt [this message]
2022-09-03 20:35 ` [FFmpeg-devel] [PATCH 2/5] avcodec/cfhddata: Avoid code tables Andreas Rheinhardt
2022-09-03 20:35 ` [FFmpeg-devel] [PATCH 3/5] avcodec/cfhddata: Avoid code duplication when creating codebooks Andreas Rheinhardt
2022-09-03 20:35 ` [FFmpeg-devel] [PATCH 4/5] avcodec/cfhd, cfhddata: Free VLC as soon as it is not needed Andreas Rheinhardt
2022-09-03 20:35 ` [FFmpeg-devel] [PATCH 5/5] avcodec/cfhddata: Reduce stack usage Andreas Rheinhardt
2022-09-03 21:49   ` Paul B Mahol
2022-09-03 21:56     ` Andreas Rheinhardt
2022-09-05 10:25       ` Paul B Mahol

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB07443029028BA4485D8478F18F7D9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git