summaryrefslogtreecommitdiff
path: root/libavcodec/utvideoenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-03-25 10:38:12 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-03-30 12:36:32 +0200
commitdf1c30f139bd4c4d5426d4fc169a1a2c16f95163 (patch)
tree8749d174d74b3e2ebe36eb5081703ce469997c6c /libavcodec/utvideoenc.c
parent67f6e7ed6ddac43139984b6956f45bb5c1861546 (diff)
avcodec/utvideoenc: Don't use bitcounts when byte-aligned
Despite write_huff_codes() receiving an ordinary buffer (not a PutBitContext), it returned the amount of data written in bits, not in bytes. This has been changed: There is now no intermediate bitcount any more. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/utvideoenc.c')
-rw-r--r--libavcodec/utvideoenc.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c
index 5c87eb50ac..32c204a898 100644
--- a/libavcodec/utvideoenc.c
+++ b/libavcodec/utvideoenc.c
@@ -398,13 +398,11 @@ static int write_huff_codes(uint8_t *src, uint8_t *dst, int dst_size,
if (count)
put_bits(&pb, 32 - count, 0);
- /* Get the amount of bits written */
- count = put_bits_count(&pb);
-
/* Flush the rest with zeroes */
flush_put_bits(&pb);
- return count;
+ /* Return the amount of bytes written */
+ return put_bytes_output(&pb);
}
static int encode_plane(AVCodecContext *avctx, uint8_t *src,
@@ -512,11 +510,11 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
/*
* Write the huffman codes to a buffer,
- * get the offset in bits and convert to bytes.
+ * get the offset in bytes.
*/
offset += write_huff_codes(dst + sstart * width, c->slice_bits,
width * height + 4, width,
- send - sstart, he) >> 3;
+ send - sstart, he);
slice_len = offset - slice_len;