summaryrefslogtreecommitdiff
path: root/libavcodec/magicyuvenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-28 13:55:33 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-10-02 16:30:19 +0200
commit4b1aa74de39e4fd4080c1ed1413c13870af092dd (patch)
tree6c46177dfd9eaea735958f680f28a6da4b7c75f5 /libavcodec/magicyuvenc.c
parent1f387ae4cb49070b3594086abd59027f07b4a773 (diff)
downloadffmpeg-4b1aa74de39e4fd4080c1ed1413c13870af092dd.tar.gz
avcodec/magicyuvenc: Use immediate when known
It allows the compiler to optimize the bytestream2 checks away. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/magicyuvenc.c')
-rw-r--r--libavcodec/magicyuvenc.c6
1 files 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);