mirror of https://git.ffmpeg.org/ffmpeg.git
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@gmail.com>
This commit is contained in:
parent
6f06c17a55
commit
9fe30bd9a9
|
@ -120,16 +120,11 @@ static int cbs_av1_write_uvlc(CodedBitstreamContext *ctx, PutBitContext *pbc,
|
||||||
if (ctx->trace_enable)
|
if (ctx->trace_enable)
|
||||||
position = put_bits_count(pbc);
|
position = put_bits_count(pbc);
|
||||||
|
|
||||||
if (value == 0) {
|
|
||||||
zeroes = 0;
|
|
||||||
put_bits(pbc, 1, 1);
|
|
||||||
} else {
|
|
||||||
zeroes = av_log2(value + 1);
|
zeroes = av_log2(value + 1);
|
||||||
v = value - (1U << zeroes) + 1;
|
v = value - (1U << zeroes) + 1;
|
||||||
put_bits(pbc, zeroes, 0);
|
put_bits(pbc, zeroes, 0);
|
||||||
put_bits(pbc, 1, 1);
|
put_bits(pbc, 1, 1);
|
||||||
put_bits(pbc, zeroes, v);
|
put_bits(pbc, zeroes, v);
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->trace_enable) {
|
if (ctx->trace_enable) {
|
||||||
char bits[65];
|
char bits[65];
|
||||||
|
|
Loading…
Reference in New Issue