diff mbox series

[FFmpeg-devel,7/7] avcodec/huffyuvenc: Deduplicate options

Message ID GV1P250MB0737D3429CE2D3F19FAA93698F3C2@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit a6979e3bd2b31531276546ecf9759a986e52c3a4
Headers show
Series [FFmpeg-devel,1/6] avcodec/huffyuvdec: Don't zero unnecessarily | expand

Checks

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

Commit Message

Andreas Rheinhardt April 4, 2024, 5:52 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/huffyuvenc.c | 42 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 24 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index d822793406..294d6ad41c 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -989,37 +989,24 @@  static av_cold int encode_end(AVCodecContext *avctx)
 #define OFFSET(x) offsetof(HYuvEncContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 
-#define COMMON_OPTIONS \
-    { "non_deterministic", "Allow multithreading for e.g. context=1 at the expense of determinism", \
-      OFFSET(non_determ), AV_OPT_TYPE_BOOL, { .i64 = 0 }, \
-      0, 1, VE }, \
-    { "pred", "Prediction method", OFFSET(predictor), AV_OPT_TYPE_INT, { .i64 = LEFT }, LEFT, MEDIAN, VE, .unit = "pred" }, \
-        { "left",   NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LEFT },   INT_MIN, INT_MAX, VE, .unit = "pred" }, \
-        { "plane",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PLANE },  INT_MIN, INT_MAX, VE, .unit = "pred" }, \
-        { "median", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MEDIAN }, INT_MIN, INT_MAX, VE, .unit = "pred" }, \
-
-static const AVOption normal_options[] = {
-    COMMON_OPTIONS
-    { NULL },
-};
-
-static const AVOption ff_options[] = {
-    COMMON_OPTIONS
+static const AVOption options[] = {
+    /* ffvhuff-only options */
     { "context", "Set per-frame huffman tables", OFFSET(context), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
+    /* Common options */
+    { "non_deterministic", "Allow multithreading for e.g. context=1 at the expense of determinism",
+      OFFSET(non_determ), AV_OPT_TYPE_BOOL, { .i64 = 0 },
+      0, 1, VE },
+    { "pred", "Prediction method", OFFSET(predictor), AV_OPT_TYPE_INT, { .i64 = LEFT }, LEFT, MEDIAN, VE, .unit = "pred" },
+        { "left",   NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LEFT },   INT_MIN, INT_MAX, VE, .unit = "pred" },
+        { "plane",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PLANE },  INT_MIN, INT_MAX, VE, .unit = "pred" },
+        { "median", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MEDIAN }, INT_MIN, INT_MAX, VE, .unit = "pred" },
     { NULL },
 };
 
 static const AVClass normal_class = {
     .class_name = "huffyuv",
     .item_name  = av_default_item_name,
-    .option     = normal_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-};
-
-static const AVClass ff_class = {
-    .class_name = "ffvhuff",
-    .item_name  = av_default_item_name,
-    .option     = ff_options,
+    .option     = options + 1,
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
@@ -1043,6 +1030,13 @@  const FFCodec ff_huffyuv_encoder = {
 };
 
 #if CONFIG_FFVHUFF_ENCODER
+static const AVClass ff_class = {
+    .class_name = "ffvhuff",
+    .item_name  = av_default_item_name,
+    .option     = options,
+    .version    = LIBAVUTIL_VERSION_INT,
+};
+
 const FFCodec ff_ffvhuff_encoder = {
     .p.name         = "ffvhuff",
     CODEC_LONG_NAME("Huffyuv FFmpeg variant"),