[FFmpeg-cvslog] avcodec/magicyuvenc: Use immediate when known

Andreas Rheinhardt git at videolan.org
Sat Oct 2 17:59:25 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Sep 28 13:55:33 2021 +0200| [4b1aa74de39e4fd4080c1ed1413c13870af092dd] | committer: Andreas Rheinhardt

avcodec/magicyuvenc: Use immediate when known

It allows the compiler to optimize the bytestream2 checks away.

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

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

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

diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c
index 5aef810a58..7ab5e61ffe 100644
--- a/libavcodec/magicyuvenc.c
+++ b/libavcodec/magicyuvenc.c
@@ -34,6 +34,8 @@
 #include "thread.h"
 #include "lossless_videoencdsp.h"
 
+#define MAGICYUV_EXTRADATA_SIZE 32
+
 typedef enum Prediction {
     LEFT = 1,
     GRADIENT,
@@ -214,7 +216,7 @@ static av_cold int magy_encode_init(AVCodecContext *avctx)
     case MEDIAN:   s->predict = median_predict;   break;
     }
 
-    avctx->extradata_size = 32;
+    avctx->extradata_size = MAGICYUV_EXTRADATA_SIZE;
 
     avctx->extradata = av_mallocz(avctx->extradata_size +
                                   AV_INPUT_BUFFER_PADDING_SIZE);
@@ -224,7 +226,7 @@ static av_cold int magy_encode_init(AVCodecContext *avctx)
         return AVERROR(ENOMEM);
     }
 
-    bytestream2_init_writer(&pb, avctx->extradata, avctx->extradata_size);
+    bytestream2_init_writer(&pb, avctx->extradata, MAGICYUV_EXTRADATA_SIZE);
     bytestream2_put_le32(&pb, MKTAG('M', 'A', 'G', 'Y'));
     bytestream2_put_le32(&pb, 32);
     bytestream2_put_byte(&pb, 7);



More information about the ffmpeg-cvslog mailing list