[FFmpeg-cvslog] avcodec/magicyuvenc: remove unnecessary indirection

Paul B Mahol git at videolan.org
Sun Sep 10 14:49:04 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Sep 10 13:14:15 2023 +0200| [fd1574d1ba088cc5e25dc7f940564d244795320b] | committer: Paul B Mahol

avcodec/magicyuvenc: remove unnecessary indirection

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

 libavcodec/magicyuvenc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c
index baf6a9d6db..b166ec4f2f 100644
--- a/libavcodec/magicyuvenc.c
+++ b/libavcodec/magicyuvenc.c
@@ -415,7 +415,7 @@ static int encode_table(AVCodecContext *avctx,
     return 0;
 }
 
-static int encode_plane_slice(const uint8_t *src, uint8_t *dst, int dst_size,
+static int encode_plane_slice(const uint8_t *src, uint8_t *dst, unsigned dst_size,
                               int width, int height, HuffEntry *he, int prediction)
 {
     PutBitContext pb;
@@ -453,17 +453,14 @@ static int encode_slice(AVCodecContext *avctx, void *tdata,
     const int slice_height = s->slice_height;
     const int last_height = FFMIN(slice_height, avctx->height - n * slice_height);
     const int height = (n < (s->nb_slices - 1)) ? slice_height : last_height;
-    PutByteContext pb;
 
     for (int i = 0; i < s->planes; i++) {
         Slice *sl = &s->slices[n * s->planes + i];
 
-        bytestream2_init_writer(&pb, sl->bitslice, s->bitslice_size);
-
         sl->size =
             encode_plane_slice(sl->slice,
                                sl->bitslice,
-                               bytestream2_get_bytes_left_p(&pb),
+                               s->bitslice_size,
                                AV_CEIL_RSHIFT(avctx->width, s->hshift[i]),
                                AV_CEIL_RSHIFT(height, s->vshift[i]),
                                s->he[i], s->frame_pred);



More information about the ffmpeg-cvslog mailing list