diff mbox series

[FFmpeg-devel,1/9] avcodec/magicyuvenc: Use immediate when known

Message ID AM7PR03MB666068460ABFF6E80D2780C18FA89@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 4b1aa74de39e4fd4080c1ed1413c13870af092dd
Headers show
Series [FFmpeg-devel,1/9] avcodec/magicyuvenc: Use immediate when known | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 28, 2021, 2:37 p.m. UTC
It allows the compiler to optimize the bytestream2 checks away.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/magicyuvenc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

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);