[FFmpeg-cvslog] avcodec/cbs_av1: Simplify writing uvlc elements

Andreas Rheinhardt git at videolan.org
Wed Jun 24 17:06:55 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Thu Jun 18 19:55:30 2020 +0200| [9fe30bd9a972c2bb6fe03763a0c8584eda19b0b4] | committer: Andreas Rheinhardt

avcodec/cbs_av1: Simplify writing uvlc elements

There is no reason to special-case writing a value of zero as uvlc
element as the generic code is perfectly capable of doing so.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9fe30bd9a972c2bb6fe03763a0c8584eda19b0b4
---

 libavcodec/cbs_av1.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 0abcba9c60..dc7be089ac 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -120,16 +120,11 @@ static int cbs_av1_write_uvlc(CodedBitstreamContext *ctx, PutBitContext *pbc,
     if (ctx->trace_enable)
         position = put_bits_count(pbc);
 
-    if (value == 0) {
-        zeroes = 0;
-        put_bits(pbc, 1, 1);
-    } else {
-        zeroes = av_log2(value + 1);
-        v = value - (1U << zeroes) + 1;
-        put_bits(pbc, zeroes, 0);
-        put_bits(pbc, 1, 1);
-        put_bits(pbc, zeroes, v);
-    }
+    zeroes = av_log2(value + 1);
+    v = value - (1U << zeroes) + 1;
+    put_bits(pbc, zeroes, 0);
+    put_bits(pbc, 1, 1);
+    put_bits(pbc, zeroes, v);
 
     if (ctx->trace_enable) {
         char bits[65];



More information about the ffmpeg-cvslog mailing list