ffmpeg-cvslog
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
November 2025
- 1 participants
- 206 discussions
[ffmpeg] branch master updated. 8a322c956f avcodec/avcodec: Schedule parser API to use enum AVCodecID for codec ids
by ffmpeg-git@ffmpeg.org 01 Nov '25
by ffmpeg-git@ffmpeg.org 01 Nov '25
01 Nov '25
The branch, master has been updated
via 8a322c956f3808a7199aef9b63a187af17c0a372 (commit)
via 7c43cc4cb7c520db962f8e3ca0d4a6d28b35530e (commit)
via e0b0ca8111225eaf931c4f723d694ac3b928754f (commit)
via e9fe30ccd112239d1b93cabd890bdea1c907afcb (commit)
via 12f7a7724d5aa46d1cb80a2fd93281f73c3bfd0a (commit)
from 633d424b1b4b3e50849f5174bbd1dc673eeeedca (commit)
- Log -----------------------------------------------------------------
commit 8a322c956f3808a7199aef9b63a187af17c0a372
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Sun Oct 26 17:40:02 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 16:57:03 2025 +0100
avcodec/avcodec: Schedule parser API to use enum AVCodecID for codec ids
Reviewed-by: James Almer <jamrial(a)gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/doc/APIchanges b/doc/APIchanges
index 293b5c4883..d1e535d6e8 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,10 @@ The last version increases of all libraries were on 2025-03-28
API changes, most recent first:
+2025-11-01 - xxxxxxxxxx - lavc 62.19.100 - avcodec.h
+ Schedule AVCodecParser and av_parser_init() to use enum AVCodecID
+ for codec ids on the next major version bump.
+
2025-11-01 - xxxxxxxxxx - lavc 62.18.100 - avcodec.h
Deprecate AVCodecParser fields priv_data_size, parser_init,
parser_parse, parser_close, and split with no replacement.
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4027ae3316..91bd7cb7ef 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2732,7 +2732,11 @@ typedef struct AVCodecParserContext {
} AVCodecParserContext;
typedef struct AVCodecParser {
+#if FF_API_PARSER_CODECID
int codec_ids[7]; /* several codec IDs are permitted */
+#else
+ enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */
+#endif
#if FF_API_PARSER_PRIVATE
/*****************************************************************
* All fields below this line are not part of the public API. They
@@ -2770,7 +2774,11 @@ typedef struct AVCodecParser {
*/
const AVCodecParser *av_parser_iterate(void **opaque);
+#if FF_API_PARSER_CODECID
AVCodecParserContext *av_parser_init(int codec_id);
+#else
+AVCodecParserContext *av_parser_init(enum AVCodecID codec_id);
+#endif
/**
* Parse a packet.
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 789bd9d1f1..12fdc3bb58 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -31,7 +31,11 @@
#include "parser.h"
#include "parser_internal.h"
+#if FF_API_PARSER_CODECID
av_cold AVCodecParserContext *av_parser_init(int codec_id)
+#else
+av_cold AVCodecParserContext *av_parser_init(enum AVCodecID codec_id)
+#endif
{
AVCodecParserContext *s = NULL;
const AVCodecParser *parser;
diff --git a/libavcodec/parser_internal.h b/libavcodec/parser_internal.h
index cb1995de8b..e366b5576a 100644
--- a/libavcodec/parser_internal.h
+++ b/libavcodec/parser_internal.h
@@ -28,7 +28,11 @@
#if FF_API_PARSER_PRIVATE
typedef union FFCodecParser {
struct {
+#if FF_API_PARSER_CODECID
int codec_ids[7]; /* several codec IDs are permitted */
+#else
+ enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */
+#endif
int priv_data_size;
int (*init)(AVCodecParserContext *s);
int (*parse)(AVCodecParserContext *s,
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 65bc52fb24..4b7ec515fe 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#include "version_major.h"
-#define LIBAVCODEC_VERSION_MINOR 18
+#define LIBAVCODEC_VERSION_MINOR 19
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index be95bafca0..5eed53e038 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -46,6 +46,7 @@
#define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_PARSER_PRIVATE (LIBAVCODEC_VERSION_MAJOR < 63)
+#define FF_API_PARSER_CODECID (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove the OMX encoder on next major bump
#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63)
commit 7c43cc4cb7c520db962f8e3ca0d4a6d28b35530e
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Sun Oct 26 14:42:59 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 16:57:03 2025 +0100
avcodec/parser_internal: Remove prefix from parser_{init,parse,close}
Reviewed-by: James Almer <jamrial(a)gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c
index a58c07cae5..cad36d8171 100644
--- a/libavcodec/aac_parser.c
+++ b/libavcodec/aac_parser.c
@@ -55,7 +55,7 @@ static av_cold int aac_parse_init(AVCodecParserContext *s1)
const FFCodecParser ff_aac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AAC),
.priv_data_size = sizeof(AACAC3ParseContext),
- .parser_init = aac_parse_init,
- .parser_parse = ff_aac_ac3_parse,
- .parser_close = ff_parse_close,
+ .init = aac_parse_init,
+ .parse = ff_aac_ac3_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index de3f6938eb..232c96d517 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -481,9 +481,9 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1)
const FFCodecParser ff_ac3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3),
.priv_data_size = sizeof(AACAC3ParseContext),
- .parser_init = ac3_parse_init,
- .parser_parse = ff_aac_ac3_parse,
- .parser_close = ff_parse_close,
+ .init = ac3_parse_init,
+ .parse = ff_aac_ac3_parse,
+ .close = ff_parse_close,
};
#else
diff --git a/libavcodec/adx_parser.c b/libavcodec/adx_parser.c
index 480b915c23..c897ba223a 100644
--- a/libavcodec/adx_parser.c
+++ b/libavcodec/adx_parser.c
@@ -101,6 +101,6 @@ static int adx_parse(AVCodecParserContext *s1,
const FFCodecParser ff_adx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_ADPCM_ADX),
.priv_data_size = sizeof(ADXParseContext),
- .parser_parse = adx_parse,
- .parser_close = ff_parse_close,
+ .parse = adx_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/ahx_parser.c b/libavcodec/ahx_parser.c
index 0e7b9b6e19..2aeaf8b56e 100644
--- a/libavcodec/ahx_parser.c
+++ b/libavcodec/ahx_parser.c
@@ -74,6 +74,6 @@ static int ahx_parse(AVCodecParserContext *s1,
const FFCodecParser ff_ahx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AHX),
.priv_data_size = sizeof(AHXParseContext),
- .parser_parse = ahx_parse,
- .parser_close = ff_parse_close,
+ .parse = ahx_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/amr_parser.c b/libavcodec/amr_parser.c
index 821c04c625..5ee1829c49 100644
--- a/libavcodec/amr_parser.c
+++ b/libavcodec/amr_parser.c
@@ -126,7 +126,7 @@ static int amr_parse(AVCodecParserContext *s1,
const FFCodecParser ff_amr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB),
.priv_data_size = sizeof(AMRParseContext),
- .parser_init = amr_parse_init,
- .parser_parse = amr_parse,
- .parser_close = ff_parse_close,
+ .init = amr_parse_init,
+ .parse = amr_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/apv_parser.c b/libavcodec/apv_parser.c
index 02791bceda..dbecbb5a5e 100644
--- a/libavcodec/apv_parser.c
+++ b/libavcodec/apv_parser.c
@@ -144,7 +144,7 @@ static av_cold void close(AVCodecParserContext *s)
const FFCodecParser ff_apv_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_APV),
.priv_data_size = sizeof(APVParseContext),
- .parser_init = init,
- .parser_parse = parse,
- .parser_close = close,
+ .init = init,
+ .parse = parse,
+ .close = close,
};
diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index 87510dfbb5..32135a23cb 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -213,7 +213,7 @@ static av_cold void av1_parser_close(AVCodecParserContext *ctx)
const FFCodecParser ff_av1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AV1),
.priv_data_size = sizeof(AV1ParseContext),
- .parser_init = av1_parser_init,
- .parser_close = av1_parser_close,
- .parser_parse = av1_parser_parse,
+ .init = av1_parser_init,
+ .close = av1_parser_close,
+ .parse = av1_parser_parse,
};
diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
index b96faddabb..68b6f20c18 100644
--- a/libavcodec/avs2_parser.c
+++ b/libavcodec/avs2_parser.c
@@ -193,6 +193,6 @@ static int avs2_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_avs2_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AVS2),
.priv_data_size = sizeof(ParseContext),
- .parser_parse = avs2_parse,
- .parser_close = ff_parse_close,
+ .parse = avs2_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
index c7cfe67b20..825eae0526 100644
--- a/libavcodec/avs3_parser.c
+++ b/libavcodec/avs3_parser.c
@@ -176,6 +176,6 @@ static int avs3_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_avs3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AVS3),
.priv_data_size = sizeof(ParseContext),
- .parser_parse = avs3_parse,
- .parser_close = ff_parse_close,
+ .parse = avs3_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/bmp_parser.c b/libavcodec/bmp_parser.c
index a4bdf6a025..5a6e957623 100644
--- a/libavcodec/bmp_parser.c
+++ b/libavcodec/bmp_parser.c
@@ -109,6 +109,6 @@ flush:
const FFCodecParser ff_bmp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_BMP),
.priv_data_size = sizeof(BMPParseContext),
- .parser_parse = bmp_parse,
- .parser_close = ff_parse_close,
+ .parse = bmp_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/cavs_parser.c b/libavcodec/cavs_parser.c
index ea36896f5c..13fbd009c8 100644
--- a/libavcodec/cavs_parser.c
+++ b/libavcodec/cavs_parser.c
@@ -100,6 +100,6 @@ static int cavsvideo_parse(AVCodecParserContext *s,
const FFCodecParser ff_cavsvideo_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_CAVS),
.priv_data_size = sizeof(ParseContext),
- .parser_parse = cavsvideo_parse,
- .parser_close = ff_parse_close,
+ .parse = cavsvideo_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/cook_parser.c b/libavcodec/cook_parser.c
index a8d4081235..8e8f6db4c6 100644
--- a/libavcodec/cook_parser.c
+++ b/libavcodec/cook_parser.c
@@ -57,5 +57,5 @@ static int cook_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_cook_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_COOK),
.priv_data_size = sizeof(CookParseContext),
- .parser_parse = cook_parse,
+ .parse = cook_parse,
};
diff --git a/libavcodec/cri_parser.c b/libavcodec/cri_parser.c
index ecf4145cae..cd0c45f415 100644
--- a/libavcodec/cri_parser.c
+++ b/libavcodec/cri_parser.c
@@ -101,6 +101,6 @@ static int cri_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_cri_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_CRI),
.priv_data_size = sizeof(CRIParser),
- .parser_parse = cri_parse,
- .parser_close = ff_parse_close,
+ .parse = cri_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
index 61b188a902..aaf4f42221 100644
--- a/libavcodec/dca_parser.c
+++ b/libavcodec/dca_parser.c
@@ -347,7 +347,7 @@ static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_dca_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DTS),
.priv_data_size = sizeof(DCAParseContext),
- .parser_init = dca_parse_init,
- .parser_parse = dca_parse,
- .parser_close = ff_parse_close,
+ .init = dca_parse_init,
+ .parse = dca_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c
index f5ac808d70..d9cf44383a 100644
--- a/libavcodec/dirac_parser.c
+++ b/libavcodec/dirac_parser.c
@@ -278,6 +278,6 @@ static av_cold void dirac_parse_close(AVCodecParserContext *s)
const FFCodecParser ff_dirac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DIRAC),
.priv_data_size = sizeof(DiracParseContext),
- .parser_parse = dirac_parse,
- .parser_close = dirac_parse_close,
+ .parse = dirac_parse,
+ .close = dirac_parse_close,
};
diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index a51f05d458..3ab08d0974 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -142,6 +142,6 @@ static int dnxhd_parse(AVCodecParserContext *s,
const FFCodecParser ff_dnxhd_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DNXHD),
.priv_data_size = sizeof(DNXHDParserContext),
- .parser_parse = dnxhd_parse,
- .parser_close = ff_parse_close,
+ .parse = dnxhd_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/dnxuc_parser.c b/libavcodec/dnxuc_parser.c
index 6c41e3139d..b14cd519ab 100644
--- a/libavcodec/dnxuc_parser.c
+++ b/libavcodec/dnxuc_parser.c
@@ -85,6 +85,6 @@ static int dnxuc_parse(AVCodecParserContext *s,
const FFCodecParser ff_dnxuc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DNXUC),
.priv_data_size = sizeof(DNxUcParseContext),
- .parser_parse = dnxuc_parse,
- .parser_close = ff_parse_close,
+ .parse = dnxuc_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/dolby_e_parser.c b/libavcodec/dolby_e_parser.c
index c685e30ddb..b7150795c0 100644
--- a/libavcodec/dolby_e_parser.c
+++ b/libavcodec/dolby_e_parser.c
@@ -69,5 +69,5 @@ end:
const FFCodecParser ff_dolby_e_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DOLBY_E),
.priv_data_size = sizeof(DBEParseContext),
- .parser_parse = dolby_e_parse,
+ .parse = dolby_e_parse,
};
diff --git a/libavcodec/dpx_parser.c b/libavcodec/dpx_parser.c
index d87ae38348..2b21d0f7ac 100644
--- a/libavcodec/dpx_parser.c
+++ b/libavcodec/dpx_parser.c
@@ -112,6 +112,6 @@ flush:
const FFCodecParser ff_dpx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DPX),
.priv_data_size = sizeof(DPXParseContext),
- .parser_parse = dpx_parse,
- .parser_close = ff_parse_close,
+ .parse = dpx_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/dvaudio_parser.c b/libavcodec/dvaudio_parser.c
index 7463db35c0..4edd254a2f 100644
--- a/libavcodec/dvaudio_parser.c
+++ b/libavcodec/dvaudio_parser.c
@@ -43,5 +43,5 @@ static int dvaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_dvaudio_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVAUDIO),
- .parser_parse = dvaudio_parse,
+ .parse = dvaudio_parse,
};
diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c
index 396b4d90f0..4527e4dd75 100644
--- a/libavcodec/dvbsub_parser.c
+++ b/libavcodec/dvbsub_parser.c
@@ -167,5 +167,5 @@ static int dvbsub_parse(AVCodecParserContext *s,
const FFCodecParser ff_dvbsub_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVB_SUBTITLE),
.priv_data_size = sizeof(DVBSubParseContext),
- .parser_parse = dvbsub_parse,
+ .parse = dvbsub_parse,
};
diff --git a/libavcodec/dvd_nav_parser.c b/libavcodec/dvd_nav_parser.c
index 69e6d828eb..ec4aba18fb 100644
--- a/libavcodec/dvd_nav_parser.c
+++ b/libavcodec/dvd_nav_parser.c
@@ -111,6 +111,6 @@ static int dvd_nav_parse(AVCodecParserContext *s,
const FFCodecParser ff_dvd_nav_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVD_NAV),
.priv_data_size = sizeof(DVDNavParseContext),
- .parser_init = dvd_nav_parse_init,
- .parser_parse = dvd_nav_parse,
+ .init = dvd_nav_parse_init,
+ .parse = dvd_nav_parse,
};
diff --git a/libavcodec/dvdsub_parser.c b/libavcodec/dvdsub_parser.c
index cf86b67944..e728c8120d 100644
--- a/libavcodec/dvdsub_parser.c
+++ b/libavcodec/dvdsub_parser.c
@@ -88,6 +88,6 @@ static av_cold void dvdsub_parse_close(AVCodecParserContext *s)
const FFCodecParser ff_dvdsub_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVD_SUBTITLE),
.priv_data_size = sizeof(DVDSubParseContext),
- .parser_parse = dvdsub_parse,
- .parser_close = dvdsub_parse_close,
+ .parse = dvdsub_parse,
+ .close = dvdsub_parse_close,
};
diff --git a/libavcodec/evc_parser.c b/libavcodec/evc_parser.c
index 8f858c9be8..f08006d005 100644
--- a/libavcodec/evc_parser.c
+++ b/libavcodec/evc_parser.c
@@ -375,6 +375,6 @@ static av_cold void evc_parser_close(AVCodecParserContext *s)
const FFCodecParser ff_evc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_EVC),
.priv_data_size = sizeof(EVCParserContext),
- .parser_parse = evc_parse,
- .parser_close = evc_parser_close,
+ .parse = evc_parse,
+ .close = evc_parser_close,
};
diff --git a/libavcodec/ffv1_parser.c b/libavcodec/ffv1_parser.c
index f444461647..f378970bff 100644
--- a/libavcodec/ffv1_parser.c
+++ b/libavcodec/ffv1_parser.c
@@ -84,6 +84,6 @@ static av_cold void ffv1_close(AVCodecParserContext *s)
const FFCodecParser ff_ffv1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FFV1),
.priv_data_size = sizeof(FFV1ParseContext),
- .parser_parse = parse,
- .parser_close = ffv1_close,
+ .parse = parse,
+ .close = ffv1_close,
};
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 340ff68f25..9a5f5fd03a 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -906,7 +906,7 @@ static av_cold void flac_parse_close(AVCodecParserContext *c)
const FFCodecParser ff_flac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FLAC),
.priv_data_size = sizeof(FLACParseContext),
- .parser_init = flac_parse_init,
- .parser_parse = flac_parse,
- .parser_close = flac_parse_close,
+ .init = flac_parse_init,
+ .parse = flac_parse,
+ .close = flac_parse_close,
};
diff --git a/libavcodec/ftr_parser.c b/libavcodec/ftr_parser.c
index 24ef405488..a45edcf457 100644
--- a/libavcodec/ftr_parser.c
+++ b/libavcodec/ftr_parser.c
@@ -100,6 +100,6 @@ static int ftr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_ftr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FTR),
.priv_data_size = sizeof(FTRParseContext),
- .parser_parse = ftr_parse,
- .parser_close = ff_parse_close,
+ .parse = ftr_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/g723_1_parser.c b/libavcodec/g723_1_parser.c
index 70a83e3e1b..e2fba33ca6 100644
--- a/libavcodec/g723_1_parser.c
+++ b/libavcodec/g723_1_parser.c
@@ -56,6 +56,6 @@ static int g723_1_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_g723_1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_G723_1),
.priv_data_size = sizeof(G723_1ParseContext),
- .parser_parse = g723_1_parse,
- .parser_close = ff_parse_close,
+ .parse = g723_1_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/g729_parser.c b/libavcodec/g729_parser.c
index 17b8415584..5e085aab28 100644
--- a/libavcodec/g729_parser.c
+++ b/libavcodec/g729_parser.c
@@ -88,6 +88,6 @@ static int g729_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_g729_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_G729, AV_CODEC_ID_ACELP_KELVIN),
.priv_data_size = sizeof(G729ParseContext),
- .parser_parse = g729_parse,
- .parser_close = ff_parse_close,
+ .parse = g729_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/gif_parser.c b/libavcodec/gif_parser.c
index c95e9430fd..7204d71d55 100644
--- a/libavcodec/gif_parser.c
+++ b/libavcodec/gif_parser.c
@@ -204,6 +204,6 @@ static int gif_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_gif_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_GIF),
.priv_data_size = sizeof(GIFParseContext),
- .parser_parse = gif_parse,
- .parser_close = ff_parse_close,
+ .parse = gif_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/gsm_parser.c b/libavcodec/gsm_parser.c
index 1823ff3188..5d448cc3e2 100644
--- a/libavcodec/gsm_parser.c
+++ b/libavcodec/gsm_parser.c
@@ -87,6 +87,6 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_gsm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS),
.priv_data_size = sizeof(GSMParseContext),
- .parser_parse = gsm_parse,
- .parser_close = ff_parse_close,
+ .parse = gsm_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/h261_parser.c b/libavcodec/h261_parser.c
index cedcdfe038..c08cff3344 100644
--- a/libavcodec/h261_parser.c
+++ b/libavcodec/h261_parser.c
@@ -90,6 +90,6 @@ static int h261_parse(AVCodecParserContext *s,
const FFCodecParser ff_h261_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H261),
.priv_data_size = sizeof(ParseContext),
- .parser_parse = h261_parse,
- .parser_close = ff_parse_close,
+ .parse = h261_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/h263_parser.c b/libavcodec/h263_parser.c
index 939a839e8e..3fc969c331 100644
--- a/libavcodec/h263_parser.c
+++ b/libavcodec/h263_parser.c
@@ -91,6 +91,6 @@ static int h263_parse(AVCodecParserContext *s,
const FFCodecParser ff_h263_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H263),
.priv_data_size = sizeof(ParseContext),
- .parser_parse = h263_parse,
- .parser_close = ff_parse_close,
+ .parse = h263_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index baed7a3e34..040739a1d4 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -686,7 +686,7 @@ static av_cold int init(AVCodecParserContext *s)
const FFCodecParser ff_h264_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H264),
.priv_data_size = sizeof(H264ParseContext),
- .parser_init = init,
- .parser_parse = h264_parse,
- .parser_close = h264_close,
+ .init = init,
+ .parse = h264_parse,
+ .close = h264_close,
};
diff --git a/libavcodec/hdr_parser.c b/libavcodec/hdr_parser.c
index eb34803c73..0fdfcb5c5a 100644
--- a/libavcodec/hdr_parser.c
+++ b/libavcodec/hdr_parser.c
@@ -75,6 +75,6 @@ static int hdr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_hdr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_RADIANCE_HDR),
.priv_data_size = sizeof(HDRParseContext),
- .parser_parse = hdr_parse,
- .parser_close = ff_parse_close,
+ .parse = hdr_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/hevc/parser.c b/libavcodec/hevc/parser.c
index 43f895ad57..62bcd91172 100644
--- a/libavcodec/hevc/parser.c
+++ b/libavcodec/hevc/parser.c
@@ -356,6 +356,6 @@ static void hevc_parser_close(AVCodecParserContext *s)
const FFCodecParser ff_hevc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_HEVC),
.priv_data_size = sizeof(HEVCParserContext),
- .parser_parse = hevc_parse,
- .parser_close = hevc_parser_close,
+ .parse = hevc_parse,
+ .close = hevc_parser_close,
};
diff --git a/libavcodec/ipu_parser.c b/libavcodec/ipu_parser.c
index d2ff23e7b2..324f0898e9 100644
--- a/libavcodec/ipu_parser.c
+++ b/libavcodec/ipu_parser.c
@@ -73,6 +73,6 @@ static int ipu_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_ipu_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_IPU),
.priv_data_size = sizeof(IPUParseContext),
- .parser_parse = ipu_parse,
- .parser_close = ff_parse_close,
+ .parse = ipu_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index 2e6d91ee59..a5dcc9c9f1 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -215,6 +215,6 @@ static int jpeg2000_parse(AVCodecParserContext *s,
const FFCodecParser ff_jpeg2000_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_JPEG2000),
.priv_data_size = sizeof(JPEG2000ParserContext),
- .parser_parse = jpeg2000_parse,
- .parser_close = ff_parse_close,
+ .parse = jpeg2000_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c
index 8a6bafdf92..a16a2733f9 100644
--- a/libavcodec/jpegxl_parser.c
+++ b/libavcodec/jpegxl_parser.c
@@ -1549,6 +1549,6 @@ flush:
const FFCodecParser ff_jpegxl_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_JPEGXL, AV_CODEC_ID_JPEGXL_ANIM),
.priv_data_size = sizeof(JXLParseContext),
- .parser_parse = jpegxl_parse,
- .parser_close = ff_parse_close,
+ .parse = jpegxl_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/latm_parser.c b/libavcodec/latm_parser.c
index 6cd1eb3379..c77bcbaa22 100644
--- a/libavcodec/latm_parser.c
+++ b/libavcodec/latm_parser.c
@@ -108,6 +108,6 @@ static int latm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_aac_latm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AAC_LATM),
.priv_data_size = sizeof(LATMParseContext),
- .parser_parse = latm_parse,
- .parser_close = ff_parse_close
+ .parse = latm_parse,
+ .close = ff_parse_close
};
diff --git a/libavcodec/misc4_parser.c b/libavcodec/misc4_parser.c
index 332e79875e..df1bbd07b4 100644
--- a/libavcodec/misc4_parser.c
+++ b/libavcodec/misc4_parser.c
@@ -77,6 +77,6 @@ static int misc4_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_misc4_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MISC4),
.priv_data_size = sizeof(MISC4Context),
- .parser_parse = misc4_parse,
- .parser_close = ff_parse_close,
+ .parse = misc4_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/mjpeg_parser.c b/libavcodec/mjpeg_parser.c
index 99ac75771e..66f364d8f9 100644
--- a/libavcodec/mjpeg_parser.c
+++ b/libavcodec/mjpeg_parser.c
@@ -132,6 +132,6 @@ static int jpeg_parse(AVCodecParserContext *s,
const FFCodecParser ff_mjpeg_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MJPEG, AV_CODEC_ID_JPEGLS),
.priv_data_size = sizeof(MJPEGParserContext),
- .parser_parse = jpeg_parse,
- .parser_close = ff_parse_close,
+ .parse = jpeg_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index 20d01db943..4f348c5d4d 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -208,7 +208,7 @@ lost_sync:
const FFCodecParser ff_mlp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MLP, AV_CODEC_ID_TRUEHD),
.priv_data_size = sizeof(MLPParseContext),
- .parser_init = mlp_init,
- .parser_parse = mlp_parse,
- .parser_close = ff_parse_close,
+ .init = mlp_init,
+ .parse = mlp_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index 0bb63e1114..fe6d333fc9 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -159,7 +159,7 @@ static int mpeg4video_parse(AVCodecParserContext *s,
const FFCodecParser ff_mpeg4video_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MPEG4),
.priv_data_size = sizeof(struct Mp4vParseContext),
- .parser_init = mpeg4video_parse_init,
- .parser_parse = mpeg4video_parse,
- .parser_close = ff_parse_close,
+ .init = mpeg4video_parse_init,
+ .parse = mpeg4video_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
index 6363f1f0a8..8c33d36dfe 100644
--- a/libavcodec/mpegaudio_parser.c
+++ b/libavcodec/mpegaudio_parser.c
@@ -141,6 +141,6 @@ const FFCodecParser ff_mpegaudio_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MP1, AV_CODEC_ID_MP2,
AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU),
.priv_data_size = sizeof(MpegAudioParseContext),
- .parser_parse = mpegaudio_parse,
- .parser_close = ff_parse_close,
+ .parse = mpegaudio_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index 48e0e31159..1afb695d09 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -303,7 +303,7 @@ static av_cold int mpegvideo_parse_init(AVCodecParserContext *s)
const FFCodecParser ff_mpegvideo_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO),
.priv_data_size = sizeof(struct MpvParseContext),
- .parser_init = mpegvideo_parse_init,
- .parser_parse = mpegvideo_parse,
- .parser_close = ff_parse_close,
+ .init = mpegvideo_parse_init,
+ .parse = mpegvideo_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/opus/parser.c b/libavcodec/opus/parser.c
index fe6a03c783..ae3d66592c 100644
--- a/libavcodec/opus/parser.c
+++ b/libavcodec/opus/parser.c
@@ -217,6 +217,6 @@ fail:
const FFCodecParser ff_opus_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_OPUS),
.priv_data_size = sizeof(OpusParserContext),
- .parser_parse = opus_parse,
- .parser_close = ff_parse_close
+ .parse = opus_parse,
+ .close = ff_parse_close
};
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 701a962a56..789bd9d1f1 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -65,8 +65,8 @@ found:
goto err_out;
s->fetch_timestamp=1;
s->pict_type = AV_PICTURE_TYPE_I;
- if (ffparser->parser_init) {
- ret = ffparser->parser_init(s);
+ if (ffparser->init) {
+ ret = ffparser->init(s);
if (ret != 0)
goto err_out;
}
@@ -164,8 +164,8 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
ff_fetch_timestamp(s, 0, 0, 0);
}
/* WARNING: the returned index can be negative */
- index = ffcodecparser(s->parser)->parser_parse(s, avctx, (const uint8_t **) poutbuf,
- poutbuf_size, buf, buf_size);
+ index = ffcodecparser(s->parser)->parse(s, avctx, (const uint8_t **) poutbuf,
+ poutbuf_size, buf, buf_size);
av_assert0(index > -0x20000000); // The API does not allow returning AVERROR codes
#define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
@@ -197,8 +197,8 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
av_cold void av_parser_close(AVCodecParserContext *s)
{
if (s) {
- if (ffcodecparser(s->parser)->parser_close)
- ffcodecparser(s->parser)->parser_close(s);
+ if (ffcodecparser(s->parser)->close)
+ ffcodecparser(s->parser)->close(s);
av_freep(&s->priv_data);
av_free(s);
}
diff --git a/libavcodec/parser_internal.h b/libavcodec/parser_internal.h
index 69f72d9bf6..cb1995de8b 100644
--- a/libavcodec/parser_internal.h
+++ b/libavcodec/parser_internal.h
@@ -30,12 +30,12 @@ typedef union FFCodecParser {
struct {
int codec_ids[7]; /* several codec IDs are permitted */
int priv_data_size;
- int (*parser_init)(AVCodecParserContext *s);
- int (*parser_parse)(AVCodecParserContext *s,
- AVCodecContext *avctx,
- const uint8_t **poutbuf, int *poutbuf_size,
- const uint8_t *buf, int buf_size);
- void (*parser_close)(AVCodecParserContext *s);
+ int (*init)(AVCodecParserContext *s);
+ int (*parse)(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size);
+ void (*close)(AVCodecParserContext *s);
int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
};
AVCodecParser p;
@@ -43,12 +43,12 @@ typedef union FFCodecParser {
typedef struct FFCodecParser {
AVCodecParser p;
unsigned priv_data_size;
- int (*parser_init)(AVCodecParserContext *s);
- int (*parser_parse)(AVCodecParserContext *s,
- AVCodecContext *avctx,
- const uint8_t **poutbuf, int *poutbuf_size,
- const uint8_t *buf, int buf_size);
- void (*parser_close)(AVCodecParserContext *s);
+ int (*init)(AVCodecParserContext *s);
+ int (*parse)(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size);
+ void (*close)(AVCodecParserContext *s);
#endif
} FFCodecParser;
diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c
index ee3f9ab12e..c3460a3b86 100644
--- a/libavcodec/parsers.c
+++ b/libavcodec/parsers.c
@@ -24,13 +24,13 @@
#if FF_API_PARSER_PRIVATE
#include <assert.h>
#include <stddef.h>
-#define CHECK_OFFSET(field) static_assert(offsetof(FFCodecParser, field) == offsetof(FFCodecParser, p.field), "Wrong offsets")
-CHECK_OFFSET(codec_ids);
-CHECK_OFFSET(priv_data_size);
-CHECK_OFFSET(parser_init);
-CHECK_OFFSET(parser_parse);
-CHECK_OFFSET(parser_close);
-CHECK_OFFSET(split);
+#define CHECK_OFFSET(field, public_prefix) static_assert(offsetof(FFCodecParser, field) == offsetof(FFCodecParser, p.public_prefix ## field), "Wrong offsets")
+CHECK_OFFSET(codec_ids,);
+CHECK_OFFSET(priv_data_size,);
+CHECK_OFFSET(init, parser_);
+CHECK_OFFSET(parse, parser_);
+CHECK_OFFSET(close, parser_);
+CHECK_OFFSET(split,);
#endif
extern const FFCodecParser ff_aac_parser;
diff --git a/libavcodec/png_parser.c b/libavcodec/png_parser.c
index 76af53197b..fbeae1103b 100644
--- a/libavcodec/png_parser.c
+++ b/libavcodec/png_parser.c
@@ -114,6 +114,6 @@ flush:
const FFCodecParser ff_png_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PNG),
.priv_data_size = sizeof(PNGParseContext),
- .parser_parse = png_parse,
- .parser_close = ff_parse_close,
+ .parse = png_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index 3f106ca1c4..27030f8512 100644
--- a/libavcodec/pnm_parser.c
+++ b/libavcodec/pnm_parser.c
@@ -139,6 +139,6 @@ const FFCodecParser ff_pnm_parser = {
AV_CODEC_ID_PBM, AV_CODEC_ID_PAM, AV_CODEC_ID_PFM,
AV_CODEC_ID_PHM),
.priv_data_size = sizeof(PNMParseContext),
- .parser_parse = pnm_parse,
- .parser_close = ff_parse_close,
+ .parse = pnm_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/prores_parser.c b/libavcodec/prores_parser.c
index c2c1729280..aadf76d793 100644
--- a/libavcodec/prores_parser.c
+++ b/libavcodec/prores_parser.c
@@ -125,5 +125,5 @@ static int parse(AVCodecParserContext *s,
const FFCodecParser ff_prores_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PRORES),
- .parser_parse = parse,
+ .parse = parse,
};
diff --git a/libavcodec/prores_raw_parser.c b/libavcodec/prores_raw_parser.c
index 6f11fbfe19..a32e4cf394 100644
--- a/libavcodec/prores_raw_parser.c
+++ b/libavcodec/prores_raw_parser.c
@@ -99,5 +99,5 @@ static int prores_raw_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_prores_raw_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PRORES_RAW),
- .parser_parse = prores_raw_parse,
+ .parse = prores_raw_parse,
};
diff --git a/libavcodec/qoi_parser.c b/libavcodec/qoi_parser.c
index 04c040c1ab..f7bf2a05bb 100644
--- a/libavcodec/qoi_parser.c
+++ b/libavcodec/qoi_parser.c
@@ -73,6 +73,6 @@ static int qoi_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_qoi_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_QOI),
.priv_data_size = sizeof(QOIParseContext),
- .parser_parse = qoi_parse,
- .parser_close = ff_parse_close,
+ .parse = qoi_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/rv34_parser.c b/libavcodec/rv34_parser.c
index 5d91b37d57..c3aa8357df 100644
--- a/libavcodec/rv34_parser.c
+++ b/libavcodec/rv34_parser.c
@@ -79,5 +79,5 @@ static int rv34_parse(AVCodecParserContext *s,
const FFCodecParser ff_rv34_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_RV30, AV_CODEC_ID_RV40),
.priv_data_size = sizeof(RV34ParseContext),
- .parser_parse = rv34_parse,
+ .parse = rv34_parse,
};
diff --git a/libavcodec/sbc_parser.c b/libavcodec/sbc_parser.c
index 35e37601bc..58150885e2 100644
--- a/libavcodec/sbc_parser.c
+++ b/libavcodec/sbc_parser.c
@@ -120,6 +120,6 @@ static int sbc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_sbc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_SBC),
.priv_data_size = sizeof(SBCParseContext),
- .parser_parse = sbc_parse,
- .parser_close = ff_parse_close,
+ .parse = sbc_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/sipr_parser.c b/libavcodec/sipr_parser.c
index d6e1ae295c..82a37c690b 100644
--- a/libavcodec/sipr_parser.c
+++ b/libavcodec/sipr_parser.c
@@ -70,6 +70,6 @@ static int sipr_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_sipr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_SIPR),
.priv_data_size = sizeof(SiprParserContext),
- .parser_parse = sipr_parse,
- .parser_close = ff_parse_close,
+ .parse = sipr_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/tak_parser.c b/libavcodec/tak_parser.c
index 2c5af1019a..060a90fac1 100644
--- a/libavcodec/tak_parser.c
+++ b/libavcodec/tak_parser.c
@@ -127,6 +127,6 @@ fail:
const FFCodecParser ff_tak_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_TAK),
.priv_data_size = sizeof(TAKParseContext),
- .parser_parse = tak_parse,
- .parser_close = ff_parse_close,
+ .parse = tak_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index af59ef99b3..595d066dea 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -275,7 +275,7 @@ static av_cold int vc1_parse_init(AVCodecParserContext *s)
const FFCodecParser ff_vc1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VC1),
.priv_data_size = sizeof(VC1ParseContext),
- .parser_init = vc1_parse_init,
- .parser_parse = vc1_parse,
- .parser_close = ff_parse_close,
+ .init = vc1_parse_init,
+ .parse = vc1_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/vorbis_parser.c b/libavcodec/vorbis_parser.c
index 4290dd92ac..88b81fcb53 100644
--- a/libavcodec/vorbis_parser.c
+++ b/libavcodec/vorbis_parser.c
@@ -339,7 +339,7 @@ static av_cold void vorbis_parser_close(AVCodecParserContext *ctx)
const FFCodecParser ff_vorbis_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VORBIS),
.priv_data_size = sizeof(VorbisParseContext),
- .parser_parse = vorbis_parse,
- .parser_close = vorbis_parser_close,
+ .parse = vorbis_parse,
+ .close = vorbis_parser_close,
};
#endif /* CONFIG_VORBIS_PARSER */
diff --git a/libavcodec/vp3_parser.c b/libavcodec/vp3_parser.c
index e5030c445d..1cd12b9e58 100644
--- a/libavcodec/vp3_parser.c
+++ b/libavcodec/vp3_parser.c
@@ -39,5 +39,5 @@ static int parse(AVCodecParserContext *s,
const FFCodecParser ff_vp3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_THEORA, AV_CODEC_ID_VP3,
AV_CODEC_ID_VP6, AV_CODEC_ID_VP6F, AV_CODEC_ID_VP6A),
- .parser_parse = parse,
+ .parse = parse,
};
diff --git a/libavcodec/vp8_parser.c b/libavcodec/vp8_parser.c
index a6b01722fb..f99a414f53 100644
--- a/libavcodec/vp8_parser.c
+++ b/libavcodec/vp8_parser.c
@@ -76,5 +76,5 @@ static int parse(AVCodecParserContext *s,
const FFCodecParser ff_vp8_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VP8),
- .parser_parse = parse,
+ .parse = parse,
};
diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c
index 007889220b..4caa730f4f 100644
--- a/libavcodec/vp9_parser.c
+++ b/libavcodec/vp9_parser.c
@@ -66,5 +66,5 @@ static int parse(AVCodecParserContext *ctx,
const FFCodecParser ff_vp9_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VP9),
- .parser_parse = parse,
+ .parse = parse,
};
diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c
index f134ab6df6..6a96dc086b 100644
--- a/libavcodec/vvc_parser.c
+++ b/libavcodec/vvc_parser.c
@@ -509,7 +509,7 @@ static av_cold void vvc_parser_close(AVCodecParserContext *s)
const FFCodecParser ff_vvc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VVC),
.priv_data_size = sizeof(VVCParserContext),
- .parser_init = vvc_parser_init,
- .parser_close = vvc_parser_close,
- .parser_parse = vvc_parser_parse,
+ .init = vvc_parser_init,
+ .close = vvc_parser_close,
+ .parse = vvc_parser_parse,
};
diff --git a/libavcodec/webp_parser.c b/libavcodec/webp_parser.c
index 155af28f6c..86c9bad8d9 100644
--- a/libavcodec/webp_parser.c
+++ b/libavcodec/webp_parser.c
@@ -108,6 +108,6 @@ flush:
const FFCodecParser ff_webp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_WEBP),
.priv_data_size = sizeof(WebPParseContext),
- .parser_parse = webp_parse,
- .parser_close = ff_parse_close,
+ .parse = webp_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/xbm_parser.c b/libavcodec/xbm_parser.c
index 936612d30f..50e4480809 100644
--- a/libavcodec/xbm_parser.c
+++ b/libavcodec/xbm_parser.c
@@ -104,7 +104,7 @@ static int xbm_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_xbm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XBM),
.priv_data_size = sizeof(XBMParseContext),
- .parser_init = xbm_init,
- .parser_parse = xbm_parse,
- .parser_close = ff_parse_close,
+ .init = xbm_init,
+ .parse = xbm_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/xma_parser.c b/libavcodec/xma_parser.c
index c2eea37833..5768b603da 100644
--- a/libavcodec/xma_parser.c
+++ b/libavcodec/xma_parser.c
@@ -59,5 +59,5 @@ static int xma_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_xma_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XMA2),
.priv_data_size = sizeof(XMAParserContext),
- .parser_parse = xma_parse,
+ .parse = xma_parse,
};
diff --git a/libavcodec/xwd_parser.c b/libavcodec/xwd_parser.c
index 1368283b21..5d7b2f10bd 100644
--- a/libavcodec/xwd_parser.c
+++ b/libavcodec/xwd_parser.c
@@ -99,6 +99,6 @@ static int xwd_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_xwd_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XWD),
.priv_data_size = sizeof(XWDParseContext),
- .parser_parse = xwd_parse,
- .parser_close = ff_parse_close,
+ .parse = xwd_parse,
+ .close = ff_parse_close,
};
commit e0b0ca8111225eaf931c4f723d694ac3b928754f
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Sun Oct 26 09:42:07 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 16:57:02 2025 +0100
avcodec/avcodec: Schedule moving private fields of AVCodecParser out of avcodec.h
AVCodecParser has several fields which are not really meant
to be accessed by users, but it has no public-private
demarkation line, so these fields are technically public
and can therefore not simply be made private like
20f972701806be20a77f808db332d9489343bb78 did for AVCodec.*
This commit therefore deprecates these fields and
schedules them to become private. All parsers have already
been switched to FFCodecParser, which (for now) is a union
of AVCodecParser and an unnamed clone of AVCodecParser
(new fields can be added at the end of this clone).
*: This is also the reason why split has never been removed despite
not being set for several years now.
Reviewed-by: James Almer <jamrial(a)gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/configure b/configure
index 17f72b735e..1c8aec3045 100755
--- a/configure
+++ b/configure
@@ -4398,7 +4398,7 @@ CODEC_LIST="
$ENCODER_LIST
$DECODER_LIST
"
-PARSER_LIST=$(find_things_extern parser AVCodecParser libavcodec/parsers.c)
+PARSER_LIST=$(find_things_extern parser FFCodecParser libavcodec/parsers.c)
BSF_LIST=$(find_things_extern bsf FFBitStreamFilter libavcodec/bitstream_filters.c)
HWACCEL_LIST=$(find_things_extern hwaccel FFHWAccel libavcodec/hwaccels.h)
PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
@@ -8595,7 +8595,7 @@ print_enabled_components(){
print_enabled_components libavfilter/filter_list.c FFFilter filter_list $FILTER_LIST
print_enabled_components libavcodec/codec_list.c FFCodec codec_list $CODEC_LIST
-print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
+print_enabled_components libavcodec/parser_list.c FFCodecParser parser_list $PARSER_LIST
print_enabled_components libavcodec/bsf_list.c FFBitStreamFilter bitstream_filters $BSF_LIST
print_enabled_components libavformat/demuxer_list.c FFInputFormat demuxer_list $DEMUXER_LIST
print_enabled_components libavformat/muxer_list.c FFOutputFormat muxer_list $MUXER_LIST
diff --git a/doc/APIchanges b/doc/APIchanges
index 7de9072a47..293b5c4883 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,10 @@ The last version increases of all libraries were on 2025-03-28
API changes, most recent first:
+2025-11-01 - xxxxxxxxxx - lavc 62.18.100 - avcodec.h
+ Deprecate AVCodecParser fields priv_data_size, parser_init,
+ parser_parse, parser_close, and split with no replacement.
+
2025-10-30 - xxxxxxxxxx - lavc 62.17.100 - packet.h
Add av_packet_side_data_from_frame() and av_packet_side_data_to_frame().
diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c
index ce7d2f58e0..a58c07cae5 100644
--- a/libavcodec/aac_parser.c
+++ b/libavcodec/aac_parser.c
@@ -52,7 +52,7 @@ static av_cold int aac_parse_init(AVCodecParserContext *s1)
}
-const AVCodecParser ff_aac_parser = {
+const FFCodecParser ff_aac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AAC),
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = aac_parse_init,
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index fe7f0fee61..de3f6938eb 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -478,7 +478,7 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1)
}
-const AVCodecParser ff_ac3_parser = {
+const FFCodecParser ff_ac3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3),
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = ac3_parse_init,
diff --git a/libavcodec/adx_parser.c b/libavcodec/adx_parser.c
index e11cc4a3bf..480b915c23 100644
--- a/libavcodec/adx_parser.c
+++ b/libavcodec/adx_parser.c
@@ -98,7 +98,7 @@ static int adx_parse(AVCodecParserContext *s1,
return next;
}
-const AVCodecParser ff_adx_parser = {
+const FFCodecParser ff_adx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_ADPCM_ADX),
.priv_data_size = sizeof(ADXParseContext),
.parser_parse = adx_parse,
diff --git a/libavcodec/ahx_parser.c b/libavcodec/ahx_parser.c
index 07eaf697b3..0e7b9b6e19 100644
--- a/libavcodec/ahx_parser.c
+++ b/libavcodec/ahx_parser.c
@@ -71,7 +71,7 @@ static int ahx_parse(AVCodecParserContext *s1,
return next;
}
-const AVCodecParser ff_ahx_parser = {
+const FFCodecParser ff_ahx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AHX),
.priv_data_size = sizeof(AHXParseContext),
.parser_parse = ahx_parse,
diff --git a/libavcodec/amr_parser.c b/libavcodec/amr_parser.c
index ce1cd1be35..821c04c625 100644
--- a/libavcodec/amr_parser.c
+++ b/libavcodec/amr_parser.c
@@ -123,7 +123,7 @@ static int amr_parse(AVCodecParserContext *s1,
return next;
}
-const AVCodecParser ff_amr_parser = {
+const FFCodecParser ff_amr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB),
.priv_data_size = sizeof(AMRParseContext),
.parser_init = amr_parse_init,
diff --git a/libavcodec/apv_parser.c b/libavcodec/apv_parser.c
index ffcaabf2f0..02791bceda 100644
--- a/libavcodec/apv_parser.c
+++ b/libavcodec/apv_parser.c
@@ -141,7 +141,7 @@ static av_cold void close(AVCodecParserContext *s)
ff_cbs_close(&p->cbc);
}
-const AVCodecParser ff_apv_parser = {
+const FFCodecParser ff_apv_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_APV),
.priv_data_size = sizeof(APVParseContext),
.parser_init = init,
diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index ba321d3ba5..87510dfbb5 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -210,7 +210,7 @@ static av_cold void av1_parser_close(AVCodecParserContext *ctx)
ff_cbs_close(&s->cbc);
}
-const AVCodecParser ff_av1_parser = {
+const FFCodecParser ff_av1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AV1),
.priv_data_size = sizeof(AV1ParseContext),
.parser_init = av1_parser_init,
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 83a4e56e22..4027ae3316 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2733,16 +2733,30 @@ typedef struct AVCodecParserContext {
typedef struct AVCodecParser {
int codec_ids[7]; /* several codec IDs are permitted */
+#if FF_API_PARSER_PRIVATE
+ /*****************************************************************
+ * All fields below this line are not part of the public API. They
+ * may not be used outside of libavcodec and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+ attribute_deprecated
int priv_data_size;
+ attribute_deprecated
int (*parser_init)(AVCodecParserContext *s);
/* This callback never returns an error, a negative value means that
* the frame start was in a previous packet. */
+ attribute_deprecated
int (*parser_parse)(AVCodecParserContext *s,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size);
+ attribute_deprecated
void (*parser_close)(AVCodecParserContext *s);
+ attribute_deprecated
int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
+#endif
} AVCodecParser;
/**
diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
index b20181213b..b96faddabb 100644
--- a/libavcodec/avs2_parser.c
+++ b/libavcodec/avs2_parser.c
@@ -190,7 +190,7 @@ static int avs2_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_avs2_parser = {
+const FFCodecParser ff_avs2_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AVS2),
.priv_data_size = sizeof(ParseContext),
.parser_parse = avs2_parse,
diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
index 4fa1c983c5..c7cfe67b20 100644
--- a/libavcodec/avs3_parser.c
+++ b/libavcodec/avs3_parser.c
@@ -173,7 +173,7 @@ static int avs3_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_avs3_parser = {
+const FFCodecParser ff_avs3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AVS3),
.priv_data_size = sizeof(ParseContext),
.parser_parse = avs3_parse,
diff --git a/libavcodec/bmp_parser.c b/libavcodec/bmp_parser.c
index 84cdc9e873..a4bdf6a025 100644
--- a/libavcodec/bmp_parser.c
+++ b/libavcodec/bmp_parser.c
@@ -106,7 +106,7 @@ flush:
return next;
}
-const AVCodecParser ff_bmp_parser = {
+const FFCodecParser ff_bmp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_BMP),
.priv_data_size = sizeof(BMPParseContext),
.parser_parse = bmp_parse,
diff --git a/libavcodec/cavs_parser.c b/libavcodec/cavs_parser.c
index b71f226c75..ea36896f5c 100644
--- a/libavcodec/cavs_parser.c
+++ b/libavcodec/cavs_parser.c
@@ -97,7 +97,7 @@ static int cavsvideo_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_cavsvideo_parser = {
+const FFCodecParser ff_cavsvideo_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_CAVS),
.priv_data_size = sizeof(ParseContext),
.parser_parse = cavsvideo_parse,
diff --git a/libavcodec/cook_parser.c b/libavcodec/cook_parser.c
index f9e3a9db15..a8d4081235 100644
--- a/libavcodec/cook_parser.c
+++ b/libavcodec/cook_parser.c
@@ -54,7 +54,7 @@ static int cook_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return buf_size;
}
-const AVCodecParser ff_cook_parser = {
+const FFCodecParser ff_cook_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_COOK),
.priv_data_size = sizeof(CookParseContext),
.parser_parse = cook_parse,
diff --git a/libavcodec/cri_parser.c b/libavcodec/cri_parser.c
index 356f35a00c..ecf4145cae 100644
--- a/libavcodec/cri_parser.c
+++ b/libavcodec/cri_parser.c
@@ -98,7 +98,7 @@ static int cri_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_cri_parser = {
+const FFCodecParser ff_cri_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_CRI),
.priv_data_size = sizeof(CRIParser),
.parser_parse = cri_parse,
diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
index b9e9191cbc..61b188a902 100644
--- a/libavcodec/dca_parser.c
+++ b/libavcodec/dca_parser.c
@@ -344,7 +344,7 @@ static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_dca_parser = {
+const FFCodecParser ff_dca_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DTS),
.priv_data_size = sizeof(DCAParseContext),
.parser_init = dca_parse_init,
diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c
index 96ab6c7780..f5ac808d70 100644
--- a/libavcodec/dirac_parser.c
+++ b/libavcodec/dirac_parser.c
@@ -275,7 +275,7 @@ static av_cold void dirac_parse_close(AVCodecParserContext *s)
av_freep(&pc->buffer);
}
-const AVCodecParser ff_dirac_parser = {
+const FFCodecParser ff_dirac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DIRAC),
.priv_data_size = sizeof(DiracParseContext),
.parser_parse = dirac_parse,
diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index 09d8dce1e5..a51f05d458 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -139,7 +139,7 @@ static int dnxhd_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_dnxhd_parser = {
+const FFCodecParser ff_dnxhd_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DNXHD),
.priv_data_size = sizeof(DNXHDParserContext),
.parser_parse = dnxhd_parse,
diff --git a/libavcodec/dnxuc_parser.c b/libavcodec/dnxuc_parser.c
index bfed6b5b6f..6c41e3139d 100644
--- a/libavcodec/dnxuc_parser.c
+++ b/libavcodec/dnxuc_parser.c
@@ -82,7 +82,7 @@ static int dnxuc_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_dnxuc_parser = {
+const FFCodecParser ff_dnxuc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DNXUC),
.priv_data_size = sizeof(DNxUcParseContext),
.parser_parse = dnxuc_parse,
diff --git a/libavcodec/dolby_e_parser.c b/libavcodec/dolby_e_parser.c
index 53bf44d86e..c685e30ddb 100644
--- a/libavcodec/dolby_e_parser.c
+++ b/libavcodec/dolby_e_parser.c
@@ -66,7 +66,7 @@ end:
return buf_size;
}
-const AVCodecParser ff_dolby_e_parser = {
+const FFCodecParser ff_dolby_e_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DOLBY_E),
.priv_data_size = sizeof(DBEParseContext),
.parser_parse = dolby_e_parse,
diff --git a/libavcodec/dpx_parser.c b/libavcodec/dpx_parser.c
index 9ca17bd94d..d87ae38348 100644
--- a/libavcodec/dpx_parser.c
+++ b/libavcodec/dpx_parser.c
@@ -109,7 +109,7 @@ flush:
return next;
}
-const AVCodecParser ff_dpx_parser = {
+const FFCodecParser ff_dpx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DPX),
.priv_data_size = sizeof(DPXParseContext),
.parser_parse = dpx_parse,
diff --git a/libavcodec/dvaudio_parser.c b/libavcodec/dvaudio_parser.c
index 1b4253aa83..7463db35c0 100644
--- a/libavcodec/dvaudio_parser.c
+++ b/libavcodec/dvaudio_parser.c
@@ -41,7 +41,7 @@ static int dvaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return buf_size;
}
-const AVCodecParser ff_dvaudio_parser = {
+const FFCodecParser ff_dvaudio_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVAUDIO),
.parser_parse = dvaudio_parse,
};
diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c
index 68c2b77b39..396b4d90f0 100644
--- a/libavcodec/dvbsub_parser.c
+++ b/libavcodec/dvbsub_parser.c
@@ -164,7 +164,7 @@ static int dvbsub_parse(AVCodecParserContext *s,
return buf_size;
}
-const AVCodecParser ff_dvbsub_parser = {
+const FFCodecParser ff_dvbsub_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVB_SUBTITLE),
.priv_data_size = sizeof(DVBSubParseContext),
.parser_parse = dvbsub_parse,
diff --git a/libavcodec/dvd_nav_parser.c b/libavcodec/dvd_nav_parser.c
index bb8c284ad5..69e6d828eb 100644
--- a/libavcodec/dvd_nav_parser.c
+++ b/libavcodec/dvd_nav_parser.c
@@ -108,7 +108,7 @@ static int dvd_nav_parse(AVCodecParserContext *s,
return buf_size;
}
-const AVCodecParser ff_dvd_nav_parser = {
+const FFCodecParser ff_dvd_nav_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVD_NAV),
.priv_data_size = sizeof(DVDNavParseContext),
.parser_init = dvd_nav_parse_init,
diff --git a/libavcodec/dvdsub_parser.c b/libavcodec/dvdsub_parser.c
index fd5baf719f..cf86b67944 100644
--- a/libavcodec/dvdsub_parser.c
+++ b/libavcodec/dvdsub_parser.c
@@ -85,7 +85,7 @@ static av_cold void dvdsub_parse_close(AVCodecParserContext *s)
av_freep(&pc->packet);
}
-const AVCodecParser ff_dvdsub_parser = {
+const FFCodecParser ff_dvdsub_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVD_SUBTITLE),
.priv_data_size = sizeof(DVDSubParseContext),
.parser_parse = dvdsub_parse,
diff --git a/libavcodec/evc_parser.c b/libavcodec/evc_parser.c
index 5cd9b5544c..8f858c9be8 100644
--- a/libavcodec/evc_parser.c
+++ b/libavcodec/evc_parser.c
@@ -372,7 +372,7 @@ static av_cold void evc_parser_close(AVCodecParserContext *s)
ff_evc_ps_free(&ctx->ps);
}
-const AVCodecParser ff_evc_parser = {
+const FFCodecParser ff_evc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_EVC),
.priv_data_size = sizeof(EVCParserContext),
.parser_parse = evc_parse,
diff --git a/libavcodec/ffv1_parser.c b/libavcodec/ffv1_parser.c
index 5f17d6a75b..f444461647 100644
--- a/libavcodec/ffv1_parser.c
+++ b/libavcodec/ffv1_parser.c
@@ -81,7 +81,7 @@ static av_cold void ffv1_close(AVCodecParserContext *s)
ff_ffv1_close(&p->f);
}
-const AVCodecParser ff_ffv1_parser = {
+const FFCodecParser ff_ffv1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FFV1),
.priv_data_size = sizeof(FFV1ParseContext),
.parser_parse = parse,
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index ed0f4bc336..340ff68f25 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -903,7 +903,7 @@ static av_cold void flac_parse_close(AVCodecParserContext *c)
av_freep(&fpc->wrap_buf);
}
-const AVCodecParser ff_flac_parser = {
+const FFCodecParser ff_flac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FLAC),
.priv_data_size = sizeof(FLACParseContext),
.parser_init = flac_parse_init,
diff --git a/libavcodec/ftr_parser.c b/libavcodec/ftr_parser.c
index 422b775d7c..24ef405488 100644
--- a/libavcodec/ftr_parser.c
+++ b/libavcodec/ftr_parser.c
@@ -97,7 +97,7 @@ static int ftr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_ftr_parser = {
+const FFCodecParser ff_ftr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FTR),
.priv_data_size = sizeof(FTRParseContext),
.parser_parse = ftr_parse,
diff --git a/libavcodec/g723_1_parser.c b/libavcodec/g723_1_parser.c
index 0deec9fdf8..70a83e3e1b 100644
--- a/libavcodec/g723_1_parser.c
+++ b/libavcodec/g723_1_parser.c
@@ -53,7 +53,7 @@ static int g723_1_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_g723_1_parser = {
+const FFCodecParser ff_g723_1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_G723_1),
.priv_data_size = sizeof(G723_1ParseContext),
.parser_parse = g723_1_parse,
diff --git a/libavcodec/g729_parser.c b/libavcodec/g729_parser.c
index c107436a42..17b8415584 100644
--- a/libavcodec/g729_parser.c
+++ b/libavcodec/g729_parser.c
@@ -85,7 +85,7 @@ static int g729_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_g729_parser = {
+const FFCodecParser ff_g729_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_G729, AV_CODEC_ID_ACELP_KELVIN),
.priv_data_size = sizeof(G729ParseContext),
.parser_parse = g729_parse,
diff --git a/libavcodec/gif_parser.c b/libavcodec/gif_parser.c
index ceb03b0aab..c95e9430fd 100644
--- a/libavcodec/gif_parser.c
+++ b/libavcodec/gif_parser.c
@@ -201,7 +201,7 @@ static int gif_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_gif_parser = {
+const FFCodecParser ff_gif_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_GIF),
.priv_data_size = sizeof(GIFParseContext),
.parser_parse = gif_parse,
diff --git a/libavcodec/gsm_parser.c b/libavcodec/gsm_parser.c
index 0162bdcc13..1823ff3188 100644
--- a/libavcodec/gsm_parser.c
+++ b/libavcodec/gsm_parser.c
@@ -84,7 +84,7 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_gsm_parser = {
+const FFCodecParser ff_gsm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS),
.priv_data_size = sizeof(GSMParseContext),
.parser_parse = gsm_parse,
diff --git a/libavcodec/h261_parser.c b/libavcodec/h261_parser.c
index 7bd912f8bf..cedcdfe038 100644
--- a/libavcodec/h261_parser.c
+++ b/libavcodec/h261_parser.c
@@ -87,7 +87,7 @@ static int h261_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_h261_parser = {
+const FFCodecParser ff_h261_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H261),
.priv_data_size = sizeof(ParseContext),
.parser_parse = h261_parse,
diff --git a/libavcodec/h263_parser.c b/libavcodec/h263_parser.c
index 2df6182d78..939a839e8e 100644
--- a/libavcodec/h263_parser.c
+++ b/libavcodec/h263_parser.c
@@ -88,7 +88,7 @@ static int h263_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_h263_parser = {
+const FFCodecParser ff_h263_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H263),
.priv_data_size = sizeof(ParseContext),
.parser_parse = h263_parse,
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 9d3158d183..baed7a3e34 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -683,7 +683,7 @@ static av_cold int init(AVCodecParserContext *s)
return 0;
}
-const AVCodecParser ff_h264_parser = {
+const FFCodecParser ff_h264_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H264),
.priv_data_size = sizeof(H264ParseContext),
.parser_init = init,
diff --git a/libavcodec/hdr_parser.c b/libavcodec/hdr_parser.c
index af8ffd06ca..eb34803c73 100644
--- a/libavcodec/hdr_parser.c
+++ b/libavcodec/hdr_parser.c
@@ -72,7 +72,7 @@ static int hdr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_hdr_parser = {
+const FFCodecParser ff_hdr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_RADIANCE_HDR),
.priv_data_size = sizeof(HDRParseContext),
.parser_parse = hdr_parse,
diff --git a/libavcodec/hevc/parser.c b/libavcodec/hevc/parser.c
index 1a6b7987a3..43f895ad57 100644
--- a/libavcodec/hevc/parser.c
+++ b/libavcodec/hevc/parser.c
@@ -353,7 +353,7 @@ static void hevc_parser_close(AVCodecParserContext *s)
av_freep(&ctx->pc.buffer);
}
-const AVCodecParser ff_hevc_parser = {
+const FFCodecParser ff_hevc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_HEVC),
.priv_data_size = sizeof(HEVCParserContext),
.parser_parse = hevc_parse,
diff --git a/libavcodec/ipu_parser.c b/libavcodec/ipu_parser.c
index d278e8b449..d2ff23e7b2 100644
--- a/libavcodec/ipu_parser.c
+++ b/libavcodec/ipu_parser.c
@@ -70,7 +70,7 @@ static int ipu_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_ipu_parser = {
+const FFCodecParser ff_ipu_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_IPU),
.priv_data_size = sizeof(IPUParseContext),
.parser_parse = ipu_parse,
diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index 2ef29582a7..2e6d91ee59 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -212,7 +212,7 @@ static int jpeg2000_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_jpeg2000_parser = {
+const FFCodecParser ff_jpeg2000_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_JPEG2000),
.priv_data_size = sizeof(JPEG2000ParserContext),
.parser_parse = jpeg2000_parse,
diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c
index ca00a86a0b..8a6bafdf92 100644
--- a/libavcodec/jpegxl_parser.c
+++ b/libavcodec/jpegxl_parser.c
@@ -1546,7 +1546,7 @@ flush:
return next;
}
-const AVCodecParser ff_jpegxl_parser = {
+const FFCodecParser ff_jpegxl_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_JPEGXL, AV_CODEC_ID_JPEGXL_ANIM),
.priv_data_size = sizeof(JXLParseContext),
.parser_parse = jpegxl_parse,
diff --git a/libavcodec/latm_parser.c b/libavcodec/latm_parser.c
index b06103aef8..6cd1eb3379 100644
--- a/libavcodec/latm_parser.c
+++ b/libavcodec/latm_parser.c
@@ -105,7 +105,7 @@ static int latm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_aac_latm_parser = {
+const FFCodecParser ff_aac_latm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AAC_LATM),
.priv_data_size = sizeof(LATMParseContext),
.parser_parse = latm_parse,
diff --git a/libavcodec/misc4_parser.c b/libavcodec/misc4_parser.c
index 867e9b0a4c..332e79875e 100644
--- a/libavcodec/misc4_parser.c
+++ b/libavcodec/misc4_parser.c
@@ -74,7 +74,7 @@ static int misc4_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_misc4_parser = {
+const FFCodecParser ff_misc4_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MISC4),
.priv_data_size = sizeof(MISC4Context),
.parser_parse = misc4_parse,
diff --git a/libavcodec/mjpeg_parser.c b/libavcodec/mjpeg_parser.c
index 152580b354..99ac75771e 100644
--- a/libavcodec/mjpeg_parser.c
+++ b/libavcodec/mjpeg_parser.c
@@ -129,7 +129,7 @@ static int jpeg_parse(AVCodecParserContext *s,
}
-const AVCodecParser ff_mjpeg_parser = {
+const FFCodecParser ff_mjpeg_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MJPEG, AV_CODEC_ID_JPEGLS),
.priv_data_size = sizeof(MJPEGParserContext),
.parser_parse = jpeg_parse,
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index 6ed0fa20a8..20d01db943 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -205,7 +205,7 @@ lost_sync:
return 1;
}
-const AVCodecParser ff_mlp_parser = {
+const FFCodecParser ff_mlp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MLP, AV_CODEC_ID_TRUEHD),
.priv_data_size = sizeof(MLPParseContext),
.parser_init = mlp_init,
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index 5a75e250d1..0bb63e1114 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -156,7 +156,7 @@ static int mpeg4video_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_mpeg4video_parser = {
+const FFCodecParser ff_mpeg4video_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MPEG4),
.priv_data_size = sizeof(struct Mp4vParseContext),
.parser_init = mpeg4video_parse_init,
diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
index 865d9298d3..6363f1f0a8 100644
--- a/libavcodec/mpegaudio_parser.c
+++ b/libavcodec/mpegaudio_parser.c
@@ -137,7 +137,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
}
-const AVCodecParser ff_mpegaudio_parser = {
+const FFCodecParser ff_mpegaudio_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MP1, AV_CODEC_ID_MP2,
AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU),
.priv_data_size = sizeof(MpegAudioParseContext),
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index b80e70a740..48e0e31159 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -300,7 +300,7 @@ static av_cold int mpegvideo_parse_init(AVCodecParserContext *s)
return 0;
}
-const AVCodecParser ff_mpegvideo_parser = {
+const FFCodecParser ff_mpegvideo_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO),
.priv_data_size = sizeof(struct MpvParseContext),
.parser_init = mpegvideo_parse_init,
diff --git a/libavcodec/opus/parser.c b/libavcodec/opus/parser.c
index 1fe011724c..fe6a03c783 100644
--- a/libavcodec/opus/parser.c
+++ b/libavcodec/opus/parser.c
@@ -214,7 +214,7 @@ fail:
return buf_size;
}
-const AVCodecParser ff_opus_parser = {
+const FFCodecParser ff_opus_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_OPUS),
.priv_data_size = sizeof(OpusParserContext),
.parser_parse = opus_parse,
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index af966766ee..701a962a56 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -29,11 +29,13 @@
#include "libavutil/mem.h"
#include "parser.h"
+#include "parser_internal.h"
av_cold AVCodecParserContext *av_parser_init(int codec_id)
{
AVCodecParserContext *s = NULL;
const AVCodecParser *parser;
+ const FFCodecParser *ffparser;
void *i = 0;
int ret;
@@ -53,17 +55,18 @@ av_cold AVCodecParserContext *av_parser_init(int codec_id)
return NULL;
found:
+ ffparser = ffcodecparser(parser);
s = av_mallocz(sizeof(AVCodecParserContext));
if (!s)
goto err_out;
s->parser = parser;
- s->priv_data = av_mallocz(parser->priv_data_size);
+ s->priv_data = av_mallocz(ffparser->priv_data_size);
if (!s->priv_data)
goto err_out;
s->fetch_timestamp=1;
s->pict_type = AV_PICTURE_TYPE_I;
- if (parser->parser_init) {
- ret = parser->parser_init(s);
+ if (ffparser->parser_init) {
+ ret = ffparser->parser_init(s);
if (ret != 0)
goto err_out;
}
@@ -161,8 +164,8 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
ff_fetch_timestamp(s, 0, 0, 0);
}
/* WARNING: the returned index can be negative */
- index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,
- poutbuf_size, buf, buf_size);
+ index = ffcodecparser(s->parser)->parser_parse(s, avctx, (const uint8_t **) poutbuf,
+ poutbuf_size, buf, buf_size);
av_assert0(index > -0x20000000); // The API does not allow returning AVERROR codes
#define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
@@ -194,8 +197,8 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
av_cold void av_parser_close(AVCodecParserContext *s)
{
if (s) {
- if (s->parser->parser_close)
- s->parser->parser_close(s);
+ if (ffcodecparser(s->parser)->parser_close)
+ ffcodecparser(s->parser)->parser_close(s);
av_freep(&s->priv_data);
av_free(s);
}
diff --git a/libavcodec/parser_internal.h b/libavcodec/parser_internal.h
index 81ccceeedf..69f72d9bf6 100644
--- a/libavcodec/parser_internal.h
+++ b/libavcodec/parser_internal.h
@@ -19,9 +19,44 @@
#ifndef AVCODEC_PARSER_INTERNAL_H
#define AVCODEC_PARSER_INTERNAL_H
+#include <stdint.h>
+
#include "libavutil/macros.h"
+#include "avcodec.h"
#include "codec_id.h"
+#if FF_API_PARSER_PRIVATE
+typedef union FFCodecParser {
+ struct {
+ int codec_ids[7]; /* several codec IDs are permitted */
+ int priv_data_size;
+ int (*parser_init)(AVCodecParserContext *s);
+ int (*parser_parse)(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size);
+ void (*parser_close)(AVCodecParserContext *s);
+ int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
+ };
+ AVCodecParser p;
+#else
+typedef struct FFCodecParser {
+ AVCodecParser p;
+ unsigned priv_data_size;
+ int (*parser_init)(AVCodecParserContext *s);
+ int (*parser_parse)(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size);
+ void (*parser_close)(AVCodecParserContext *s);
+#endif
+} FFCodecParser;
+
+static inline const FFCodecParser *ffcodecparser(const AVCodecParser *parser)
+{
+ return (const FFCodecParser*)parser;
+}
+
#define EIGTH_ARG(a,b,c,d,e,f,g,h,...) h
#define NO_FAIL
// Expands to nothing if <= 7 args; induces compilation failure if not.
@@ -32,7 +67,13 @@
#define FIRST_SEVEN2(a,b,c,d,e,f,g,...) a,b,c,d,e,f,g
#define FIRST_SEVEN(...) PASSTHROUGH(FIRST_SEVEN2(__VA_ARGS__))
#define TIMES_SEVEN(a) a,a,a,a,a,a,a
+
+#if FF_API_PARSER_PRIVATE
#define PARSER_CODEC_LIST(...) CHECK_FOR_TOO_MANY_IDS(__VA_ARGS__) \
.codec_ids = { FIRST_SEVEN(__VA_ARGS__, TIMES_SEVEN(AV_CODEC_ID_NONE)) }
+#else
+#define PARSER_CODEC_LIST(...) CHECK_FOR_TOO_MANY_IDS(__VA_ARGS__) \
+ .p.codec_ids = { FIRST_SEVEN(__VA_ARGS__, TIMES_SEVEN(AV_CODEC_ID_NONE)) }
+#endif
#endif /* AVCODEC_PARSER_INTERNAL_H */
diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c
index 824a1ccd55..ee3f9ab12e 100644
--- a/libavcodec/parsers.c
+++ b/libavcodec/parsers.c
@@ -19,83 +19,98 @@
#include <stdint.h>
#include "avcodec.h"
+#include "parser_internal.h"
-extern const AVCodecParser ff_aac_parser;
-extern const AVCodecParser ff_aac_latm_parser;
-extern const AVCodecParser ff_ac3_parser;
-extern const AVCodecParser ff_adx_parser;
-extern const AVCodecParser ff_ahx_parser;
-extern const AVCodecParser ff_amr_parser;
-extern const AVCodecParser ff_apv_parser;
-extern const AVCodecParser ff_av1_parser;
-extern const AVCodecParser ff_avs2_parser;
-extern const AVCodecParser ff_avs3_parser;
-extern const AVCodecParser ff_bmp_parser;
-extern const AVCodecParser ff_cavsvideo_parser;
-extern const AVCodecParser ff_cook_parser;
-extern const AVCodecParser ff_cri_parser;
-extern const AVCodecParser ff_dca_parser;
-extern const AVCodecParser ff_dirac_parser;
-extern const AVCodecParser ff_dnxhd_parser;
-extern const AVCodecParser ff_dnxuc_parser;
-extern const AVCodecParser ff_dolby_e_parser;
-extern const AVCodecParser ff_dpx_parser;
-extern const AVCodecParser ff_dvaudio_parser;
-extern const AVCodecParser ff_dvbsub_parser;
-extern const AVCodecParser ff_dvdsub_parser;
-extern const AVCodecParser ff_dvd_nav_parser;
-extern const AVCodecParser ff_evc_parser;
-extern const AVCodecParser ff_flac_parser;
-extern const AVCodecParser ff_ftr_parser;
-extern const AVCodecParser ff_ffv1_parser;
-extern const AVCodecParser ff_g723_1_parser;
-extern const AVCodecParser ff_g729_parser;
-extern const AVCodecParser ff_gif_parser;
-extern const AVCodecParser ff_gsm_parser;
-extern const AVCodecParser ff_h261_parser;
-extern const AVCodecParser ff_h263_parser;
-extern const AVCodecParser ff_h264_parser;
-extern const AVCodecParser ff_hevc_parser;
-extern const AVCodecParser ff_hdr_parser;
-extern const AVCodecParser ff_ipu_parser;
-extern const AVCodecParser ff_jpeg2000_parser;
-extern const AVCodecParser ff_jpegxl_parser;
-extern const AVCodecParser ff_misc4_parser;
-extern const AVCodecParser ff_mjpeg_parser;
-extern const AVCodecParser ff_mlp_parser;
-extern const AVCodecParser ff_mpeg4video_parser;
-extern const AVCodecParser ff_mpegaudio_parser;
-extern const AVCodecParser ff_mpegvideo_parser;
-extern const AVCodecParser ff_opus_parser;
-extern const AVCodecParser ff_prores_parser;
-extern const AVCodecParser ff_png_parser;
-extern const AVCodecParser ff_pnm_parser;
-extern const AVCodecParser ff_prores_raw_parser;
-extern const AVCodecParser ff_qoi_parser;
-extern const AVCodecParser ff_rv34_parser;
-extern const AVCodecParser ff_sbc_parser;
-extern const AVCodecParser ff_sipr_parser;
-extern const AVCodecParser ff_tak_parser;
-extern const AVCodecParser ff_vc1_parser;
-extern const AVCodecParser ff_vorbis_parser;
-extern const AVCodecParser ff_vp3_parser;
-extern const AVCodecParser ff_vp8_parser;
-extern const AVCodecParser ff_vp9_parser;
-extern const AVCodecParser ff_vvc_parser;
-extern const AVCodecParser ff_webp_parser;
-extern const AVCodecParser ff_xbm_parser;
-extern const AVCodecParser ff_xma_parser;
-extern const AVCodecParser ff_xwd_parser;
+#if FF_API_PARSER_PRIVATE
+#include <assert.h>
+#include <stddef.h>
+#define CHECK_OFFSET(field) static_assert(offsetof(FFCodecParser, field) == offsetof(FFCodecParser, p.field), "Wrong offsets")
+CHECK_OFFSET(codec_ids);
+CHECK_OFFSET(priv_data_size);
+CHECK_OFFSET(parser_init);
+CHECK_OFFSET(parser_parse);
+CHECK_OFFSET(parser_close);
+CHECK_OFFSET(split);
+#endif
+
+extern const FFCodecParser ff_aac_parser;
+extern const FFCodecParser ff_aac_latm_parser;
+extern const FFCodecParser ff_ac3_parser;
+extern const FFCodecParser ff_adx_parser;
+extern const FFCodecParser ff_ahx_parser;
+extern const FFCodecParser ff_amr_parser;
+extern const FFCodecParser ff_apv_parser;
+extern const FFCodecParser ff_av1_parser;
+extern const FFCodecParser ff_avs2_parser;
+extern const FFCodecParser ff_avs3_parser;
+extern const FFCodecParser ff_bmp_parser;
+extern const FFCodecParser ff_cavsvideo_parser;
+extern const FFCodecParser ff_cook_parser;
+extern const FFCodecParser ff_cri_parser;
+extern const FFCodecParser ff_dca_parser;
+extern const FFCodecParser ff_dirac_parser;
+extern const FFCodecParser ff_dnxhd_parser;
+extern const FFCodecParser ff_dnxuc_parser;
+extern const FFCodecParser ff_dolby_e_parser;
+extern const FFCodecParser ff_dpx_parser;
+extern const FFCodecParser ff_dvaudio_parser;
+extern const FFCodecParser ff_dvbsub_parser;
+extern const FFCodecParser ff_dvdsub_parser;
+extern const FFCodecParser ff_dvd_nav_parser;
+extern const FFCodecParser ff_evc_parser;
+extern const FFCodecParser ff_flac_parser;
+extern const FFCodecParser ff_ftr_parser;
+extern const FFCodecParser ff_ffv1_parser;
+extern const FFCodecParser ff_g723_1_parser;
+extern const FFCodecParser ff_g729_parser;
+extern const FFCodecParser ff_gif_parser;
+extern const FFCodecParser ff_gsm_parser;
+extern const FFCodecParser ff_h261_parser;
+extern const FFCodecParser ff_h263_parser;
+extern const FFCodecParser ff_h264_parser;
+extern const FFCodecParser ff_hevc_parser;
+extern const FFCodecParser ff_hdr_parser;
+extern const FFCodecParser ff_ipu_parser;
+extern const FFCodecParser ff_jpeg2000_parser;
+extern const FFCodecParser ff_jpegxl_parser;
+extern const FFCodecParser ff_misc4_parser;
+extern const FFCodecParser ff_mjpeg_parser;
+extern const FFCodecParser ff_mlp_parser;
+extern const FFCodecParser ff_mpeg4video_parser;
+extern const FFCodecParser ff_mpegaudio_parser;
+extern const FFCodecParser ff_mpegvideo_parser;
+extern const FFCodecParser ff_opus_parser;
+extern const FFCodecParser ff_prores_parser;
+extern const FFCodecParser ff_png_parser;
+extern const FFCodecParser ff_pnm_parser;
+extern const FFCodecParser ff_prores_raw_parser;
+extern const FFCodecParser ff_qoi_parser;
+extern const FFCodecParser ff_rv34_parser;
+extern const FFCodecParser ff_sbc_parser;
+extern const FFCodecParser ff_sipr_parser;
+extern const FFCodecParser ff_tak_parser;
+extern const FFCodecParser ff_vc1_parser;
+extern const FFCodecParser ff_vorbis_parser;
+extern const FFCodecParser ff_vp3_parser;
+extern const FFCodecParser ff_vp8_parser;
+extern const FFCodecParser ff_vp9_parser;
+extern const FFCodecParser ff_vvc_parser;
+extern const FFCodecParser ff_webp_parser;
+extern const FFCodecParser ff_xbm_parser;
+extern const FFCodecParser ff_xma_parser;
+extern const FFCodecParser ff_xwd_parser;
#include "libavcodec/parser_list.c"
const AVCodecParser *av_parser_iterate(void **opaque)
{
uintptr_t i = (uintptr_t)*opaque;
- const AVCodecParser *p = parser_list[i];
+ const FFCodecParser *p = parser_list[i];
- if (p)
+ if (p) {
*opaque = (void*)(i + 1);
+ return &p->p;
+ }
- return p;
+ return NULL;
}
diff --git a/libavcodec/png_parser.c b/libavcodec/png_parser.c
index e4af1f2e09..76af53197b 100644
--- a/libavcodec/png_parser.c
+++ b/libavcodec/png_parser.c
@@ -111,7 +111,7 @@ flush:
return next;
}
-const AVCodecParser ff_png_parser = {
+const FFCodecParser ff_png_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PNG),
.priv_data_size = sizeof(PNGParseContext),
.parser_parse = png_parse,
diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index 65dbaf86f6..3f106ca1c4 100644
--- a/libavcodec/pnm_parser.c
+++ b/libavcodec/pnm_parser.c
@@ -134,7 +134,7 @@ end:
return next;
}
-const AVCodecParser ff_pnm_parser = {
+const FFCodecParser ff_pnm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PGM, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PPM,
AV_CODEC_ID_PBM, AV_CODEC_ID_PAM, AV_CODEC_ID_PFM,
AV_CODEC_ID_PHM),
diff --git a/libavcodec/prores_parser.c b/libavcodec/prores_parser.c
index 9b66c3b415..c2c1729280 100644
--- a/libavcodec/prores_parser.c
+++ b/libavcodec/prores_parser.c
@@ -123,7 +123,7 @@ static int parse(AVCodecParserContext *s,
return buf_size;
}
-const AVCodecParser ff_prores_parser = {
+const FFCodecParser ff_prores_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PRORES),
.parser_parse = parse,
};
diff --git a/libavcodec/prores_raw_parser.c b/libavcodec/prores_raw_parser.c
index 95efe28b0a..6f11fbfe19 100644
--- a/libavcodec/prores_raw_parser.c
+++ b/libavcodec/prores_raw_parser.c
@@ -97,7 +97,7 @@ static int prores_raw_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return buf_size;
}
-const AVCodecParser ff_prores_raw_parser = {
+const FFCodecParser ff_prores_raw_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PRORES_RAW),
.parser_parse = prores_raw_parse,
};
diff --git a/libavcodec/qoi_parser.c b/libavcodec/qoi_parser.c
index 1c20d334d0..04c040c1ab 100644
--- a/libavcodec/qoi_parser.c
+++ b/libavcodec/qoi_parser.c
@@ -70,7 +70,7 @@ static int qoi_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_qoi_parser = {
+const FFCodecParser ff_qoi_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_QOI),
.priv_data_size = sizeof(QOIParseContext),
.parser_parse = qoi_parse,
diff --git a/libavcodec/rv34_parser.c b/libavcodec/rv34_parser.c
index 3ce1abf60a..5d91b37d57 100644
--- a/libavcodec/rv34_parser.c
+++ b/libavcodec/rv34_parser.c
@@ -76,7 +76,7 @@ static int rv34_parse(AVCodecParserContext *s,
return buf_size;
}
-const AVCodecParser ff_rv34_parser = {
+const FFCodecParser ff_rv34_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_RV30, AV_CODEC_ID_RV40),
.priv_data_size = sizeof(RV34ParseContext),
.parser_parse = rv34_parse,
diff --git a/libavcodec/sbc_parser.c b/libavcodec/sbc_parser.c
index 9cd225aa7b..35e37601bc 100644
--- a/libavcodec/sbc_parser.c
+++ b/libavcodec/sbc_parser.c
@@ -117,7 +117,7 @@ static int sbc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_sbc_parser = {
+const FFCodecParser ff_sbc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_SBC),
.priv_data_size = sizeof(SBCParseContext),
.parser_parse = sbc_parse,
diff --git a/libavcodec/sipr_parser.c b/libavcodec/sipr_parser.c
index 89352663a5..d6e1ae295c 100644
--- a/libavcodec/sipr_parser.c
+++ b/libavcodec/sipr_parser.c
@@ -67,7 +67,7 @@ static int sipr_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_sipr_parser = {
+const FFCodecParser ff_sipr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_SIPR),
.priv_data_size = sizeof(SiprParserContext),
.parser_parse = sipr_parse,
diff --git a/libavcodec/tak_parser.c b/libavcodec/tak_parser.c
index 47931288b7..2c5af1019a 100644
--- a/libavcodec/tak_parser.c
+++ b/libavcodec/tak_parser.c
@@ -124,7 +124,7 @@ fail:
return buf_size + consumed;
}
-const AVCodecParser ff_tak_parser = {
+const FFCodecParser ff_tak_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_TAK),
.priv_data_size = sizeof(TAKParseContext),
.parser_parse = tak_parse,
diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index f5bc8d7126..af59ef99b3 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -272,7 +272,7 @@ static av_cold int vc1_parse_init(AVCodecParserContext *s)
return 0;
}
-const AVCodecParser ff_vc1_parser = {
+const FFCodecParser ff_vc1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VC1),
.priv_data_size = sizeof(VC1ParseContext),
.parser_init = vc1_parse_init,
diff --git a/libavcodec/version.h b/libavcodec/version.h
index d6e0724326..65bc52fb24 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,8 +29,8 @@
#include "version_major.h"
-#define LIBAVCODEC_VERSION_MINOR 17
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR 18
+#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 97e4e12065..be95bafca0 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -45,6 +45,8 @@
#define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63)
+#define FF_API_PARSER_PRIVATE (LIBAVCODEC_VERSION_MAJOR < 63)
+
// reminder to remove the OMX encoder on next major bump
#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove Sonic Lossy/Lossless encoders on next major bump
diff --git a/libavcodec/vorbis_parser.c b/libavcodec/vorbis_parser.c
index a3b0a4e5c4..4290dd92ac 100644
--- a/libavcodec/vorbis_parser.c
+++ b/libavcodec/vorbis_parser.c
@@ -336,7 +336,7 @@ static av_cold void vorbis_parser_close(AVCodecParserContext *ctx)
av_vorbis_parse_free(&s->vp);
}
-const AVCodecParser ff_vorbis_parser = {
+const FFCodecParser ff_vorbis_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VORBIS),
.priv_data_size = sizeof(VorbisParseContext),
.parser_parse = vorbis_parse,
diff --git a/libavcodec/vp3_parser.c b/libavcodec/vp3_parser.c
index 9be3f70596..e5030c445d 100644
--- a/libavcodec/vp3_parser.c
+++ b/libavcodec/vp3_parser.c
@@ -36,7 +36,7 @@ static int parse(AVCodecParserContext *s,
return buf_size;
}
-const AVCodecParser ff_vp3_parser = {
+const FFCodecParser ff_vp3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_THEORA, AV_CODEC_ID_VP3,
AV_CODEC_ID_VP6, AV_CODEC_ID_VP6F, AV_CODEC_ID_VP6A),
.parser_parse = parse,
diff --git a/libavcodec/vp8_parser.c b/libavcodec/vp8_parser.c
index 14c0c1462b..a6b01722fb 100644
--- a/libavcodec/vp8_parser.c
+++ b/libavcodec/vp8_parser.c
@@ -74,7 +74,7 @@ static int parse(AVCodecParserContext *s,
return buf_size;
}
-const AVCodecParser ff_vp8_parser = {
+const FFCodecParser ff_vp8_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VP8),
.parser_parse = parse,
};
diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c
index 7e1a06201a..007889220b 100644
--- a/libavcodec/vp9_parser.c
+++ b/libavcodec/vp9_parser.c
@@ -64,7 +64,7 @@ static int parse(AVCodecParserContext *ctx,
return size;
}
-const AVCodecParser ff_vp9_parser = {
+const FFCodecParser ff_vp9_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VP9),
.parser_parse = parse,
};
diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c
index 4453aaa61d..f134ab6df6 100644
--- a/libavcodec/vvc_parser.c
+++ b/libavcodec/vvc_parser.c
@@ -506,7 +506,7 @@ static av_cold void vvc_parser_close(AVCodecParserContext *s)
av_freep(&ctx->pc.buffer);
}
-const AVCodecParser ff_vvc_parser = {
+const FFCodecParser ff_vvc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VVC),
.priv_data_size = sizeof(VVCParserContext),
.parser_init = vvc_parser_init,
diff --git a/libavcodec/webp_parser.c b/libavcodec/webp_parser.c
index e3edc348e4..155af28f6c 100644
--- a/libavcodec/webp_parser.c
+++ b/libavcodec/webp_parser.c
@@ -105,7 +105,7 @@ flush:
return next;
}
-const AVCodecParser ff_webp_parser = {
+const FFCodecParser ff_webp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_WEBP),
.priv_data_size = sizeof(WebPParseContext),
.parser_parse = webp_parse,
diff --git a/libavcodec/xbm_parser.c b/libavcodec/xbm_parser.c
index c7e7ce9282..936612d30f 100644
--- a/libavcodec/xbm_parser.c
+++ b/libavcodec/xbm_parser.c
@@ -101,7 +101,7 @@ static int xbm_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_xbm_parser = {
+const FFCodecParser ff_xbm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XBM),
.priv_data_size = sizeof(XBMParseContext),
.parser_init = xbm_init,
diff --git a/libavcodec/xma_parser.c b/libavcodec/xma_parser.c
index eae39fd031..c2eea37833 100644
--- a/libavcodec/xma_parser.c
+++ b/libavcodec/xma_parser.c
@@ -56,7 +56,7 @@ static int xma_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return buf_size;
}
-const AVCodecParser ff_xma_parser = {
+const FFCodecParser ff_xma_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XMA2),
.priv_data_size = sizeof(XMAParserContext),
.parser_parse = xma_parse,
diff --git a/libavcodec/xwd_parser.c b/libavcodec/xwd_parser.c
index cc554c3c97..1368283b21 100644
--- a/libavcodec/xwd_parser.c
+++ b/libavcodec/xwd_parser.c
@@ -96,7 +96,7 @@ static int xwd_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_xwd_parser = {
+const FFCodecParser ff_xwd_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XWD),
.priv_data_size = sizeof(XWDParseContext),
.parser_parse = xwd_parse,
commit e9fe30ccd112239d1b93cabd890bdea1c907afcb
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Sun Oct 26 13:16:27 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 16:57:02 2025 +0100
avcodec/parsers: Add macro to set list of codec ids
The current code relies on AV_CODEC_ID_NONE being zero, so that
unused codec ids are set to their proper value. This commit adds
a macro to set unset ids to AV_CODEC_ID_NONE.
(The actual rationale for this macro is to simplify
the transition to making the private fields that are
currently public in avcodec.h really private.)
Reviewed-by: James Almer <jamrial(a)gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c
index 186fcd887a..ce7d2f58e0 100644
--- a/libavcodec/aac_parser.c
+++ b/libavcodec/aac_parser.c
@@ -24,6 +24,7 @@
#include "aac_ac3_parser.h"
#include "adts_header.h"
#include "adts_parser.h"
+#include "parser_internal.h"
#include "libavutil/intreadwrite.h"
static int aac_sync(uint64_t state, int *need_next_header, int *new_frame_start)
@@ -52,7 +53,7 @@ static av_cold int aac_parse_init(AVCodecParserContext *s1)
const AVCodecParser ff_aac_parser = {
- .codec_ids = { AV_CODEC_ID_AAC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AAC),
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = aac_parse_init,
.parser_parse = ff_aac_ac3_parse,
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index a8bc3afc74..fe7f0fee61 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -31,6 +31,7 @@
#include "ac3_parser_internal.h"
#include "aac_ac3_parser.h"
#include "get_bits.h"
+#include "parser_internal.h"
#define AC3_HEADER_SIZE 7
@@ -478,7 +479,7 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1)
const AVCodecParser ff_ac3_parser = {
- .codec_ids = { AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3),
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = ac3_parse_init,
.parser_parse = ff_aac_ac3_parse,
diff --git a/libavcodec/adx_parser.c b/libavcodec/adx_parser.c
index 62b4415bc1..e11cc4a3bf 100644
--- a/libavcodec/adx_parser.c
+++ b/libavcodec/adx_parser.c
@@ -25,9 +25,9 @@
* Splits packets into individual blocks.
*/
-#include "libavutil/intreadwrite.h"
#include "parser.h"
#include "adx.h"
+#include "parser_internal.h"
typedef struct ADXParseContext {
ParseContext pc;
@@ -99,7 +99,7 @@ static int adx_parse(AVCodecParserContext *s1,
}
const AVCodecParser ff_adx_parser = {
- .codec_ids = { AV_CODEC_ID_ADPCM_ADX },
+ PARSER_CODEC_LIST(AV_CODEC_ID_ADPCM_ADX),
.priv_data_size = sizeof(ADXParseContext),
.parser_parse = adx_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/ahx_parser.c b/libavcodec/ahx_parser.c
index 4be037f666..07eaf697b3 100644
--- a/libavcodec/ahx_parser.c
+++ b/libavcodec/ahx_parser.c
@@ -25,6 +25,7 @@
#include "libavutil/intreadwrite.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct AHXParseContext {
ParseContext pc;
@@ -71,7 +72,7 @@ static int ahx_parse(AVCodecParserContext *s1,
}
const AVCodecParser ff_ahx_parser = {
- .codec_ids = { AV_CODEC_ID_AHX },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AHX),
.priv_data_size = sizeof(AHXParseContext),
.parser_parse = ahx_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/amr_parser.c b/libavcodec/amr_parser.c
index 9484d720ee..ce1cd1be35 100644
--- a/libavcodec/amr_parser.c
+++ b/libavcodec/amr_parser.c
@@ -28,6 +28,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "parser.h"
+#include "parser_internal.h"
static const uint8_t amrnb_packed_size[16] = {
13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
@@ -123,7 +124,7 @@ static int amr_parse(AVCodecParserContext *s1,
}
const AVCodecParser ff_amr_parser = {
- .codec_ids = { AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB),
.priv_data_size = sizeof(AMRParseContext),
.parser_init = amr_parse_init,
.parser_parse = amr_parse,
diff --git a/libavcodec/apv_parser.c b/libavcodec/apv_parser.c
index fdd575339b..ffcaabf2f0 100644
--- a/libavcodec/apv_parser.c
+++ b/libavcodec/apv_parser.c
@@ -23,6 +23,7 @@
#include "apv.h"
#include "cbs.h"
#include "cbs_apv.h"
+#include "parser_internal.h"
typedef struct APVParseContext {
CodedBitstreamContext *cbc;
@@ -141,7 +142,7 @@ static av_cold void close(AVCodecParserContext *s)
}
const AVCodecParser ff_apv_parser = {
- .codec_ids = { AV_CODEC_ID_APV },
+ PARSER_CODEC_LIST(AV_CODEC_ID_APV),
.priv_data_size = sizeof(APVParseContext),
.parser_init = init,
.parser_parse = parse,
diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index 0a07a9647e..ba321d3ba5 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -27,6 +27,7 @@
#include "avcodec.h"
#include "cbs.h"
#include "cbs_av1.h"
+#include "parser_internal.h"
typedef struct AV1ParseContext {
CodedBitstreamContext *cbc;
@@ -210,7 +211,7 @@ static av_cold void av1_parser_close(AVCodecParserContext *ctx)
}
const AVCodecParser ff_av1_parser = {
- .codec_ids = { AV_CODEC_ID_AV1 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AV1),
.priv_data_size = sizeof(AV1ParseContext),
.parser_init = av1_parser_init,
.parser_close = av1_parser_close,
diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
index 0d68ab1d00..b20181213b 100644
--- a/libavcodec/avs2_parser.c
+++ b/libavcodec/avs2_parser.c
@@ -23,6 +23,7 @@
#include "avs2.h"
#include "get_bits.h"
#include "parser.h"
+#include "parser_internal.h"
static int avs2_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
{
@@ -190,7 +191,7 @@ static int avs2_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_avs2_parser = {
- .codec_ids = { AV_CODEC_ID_AVS2 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AVS2),
.priv_data_size = sizeof(ParseContext),
.parser_parse = avs2_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
index 71278c7e2d..4fa1c983c5 100644
--- a/libavcodec/avs3_parser.c
+++ b/libavcodec/avs3_parser.c
@@ -24,6 +24,7 @@
#include "avs3.h"
#include "get_bits.h"
#include "parser.h"
+#include "parser_internal.h"
static int avs3_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
{
@@ -173,7 +174,7 @@ static int avs3_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_avs3_parser = {
- .codec_ids = { AV_CODEC_ID_AVS3 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AVS3),
.priv_data_size = sizeof(ParseContext),
.parser_parse = avs3_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/bmp_parser.c b/libavcodec/bmp_parser.c
index 3440794b2c..84cdc9e873 100644
--- a/libavcodec/bmp_parser.c
+++ b/libavcodec/bmp_parser.c
@@ -28,6 +28,7 @@
#include "libavutil/common.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct BMPParseContext {
ParseContext pc;
@@ -106,7 +107,7 @@ flush:
}
const AVCodecParser ff_bmp_parser = {
- .codec_ids = { AV_CODEC_ID_BMP },
+ PARSER_CODEC_LIST(AV_CODEC_ID_BMP),
.priv_data_size = sizeof(BMPParseContext),
.parser_parse = bmp_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/cavs_parser.c b/libavcodec/cavs_parser.c
index 4a03effd0f..b71f226c75 100644
--- a/libavcodec/cavs_parser.c
+++ b/libavcodec/cavs_parser.c
@@ -27,6 +27,7 @@
#include "parser.h"
#include "cavs.h"
+#include "parser_internal.h"
/**
@@ -97,7 +98,7 @@ static int cavsvideo_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_cavsvideo_parser = {
- .codec_ids = { AV_CODEC_ID_CAVS },
+ PARSER_CODEC_LIST(AV_CODEC_ID_CAVS),
.priv_data_size = sizeof(ParseContext),
.parser_parse = cavsvideo_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/cook_parser.c b/libavcodec/cook_parser.c
index 404f611cf4..f9e3a9db15 100644
--- a/libavcodec/cook_parser.c
+++ b/libavcodec/cook_parser.c
@@ -29,6 +29,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "parser_internal.h"
typedef struct CookParseContext {
int duration;
@@ -54,7 +55,7 @@ static int cook_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_cook_parser = {
- .codec_ids = { AV_CODEC_ID_COOK },
+ PARSER_CODEC_LIST(AV_CODEC_ID_COOK),
.priv_data_size = sizeof(CookParseContext),
.parser_parse = cook_parse,
};
diff --git a/libavcodec/cri_parser.c b/libavcodec/cri_parser.c
index 9295f823ce..356f35a00c 100644
--- a/libavcodec/cri_parser.c
+++ b/libavcodec/cri_parser.c
@@ -28,6 +28,7 @@
#include "libavutil/common.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct CRIParser {
ParseContext pc;
@@ -98,7 +99,7 @@ static int cri_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_cri_parser = {
- .codec_ids = { AV_CODEC_ID_CRI },
+ PARSER_CODEC_LIST(AV_CODEC_ID_CRI),
.priv_data_size = sizeof(CRIParser),
.parser_parse = cri_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
index eb0ef55d46..b9e9191cbc 100644
--- a/libavcodec/dca_parser.c
+++ b/libavcodec/dca_parser.c
@@ -29,6 +29,7 @@
#include "dca_syncwords.h"
#include "get_bits.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct DCAParseContext {
ParseContext pc;
@@ -344,7 +345,7 @@ static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_dca_parser = {
- .codec_ids = { AV_CODEC_ID_DTS },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DTS),
.priv_data_size = sizeof(DCAParseContext),
.parser_init = dca_parse_init,
.parser_parse = dca_parse,
diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c
index 61f8067001..96ab6c7780 100644
--- a/libavcodec/dirac_parser.c
+++ b/libavcodec/dirac_parser.c
@@ -34,6 +34,7 @@
#include "libavutil/mem.h"
#include "avcodec.h"
+#include "parser_internal.h"
#define DIRAC_PARSE_INFO_PREFIX 0x42424344
@@ -275,7 +276,7 @@ static av_cold void dirac_parse_close(AVCodecParserContext *s)
}
const AVCodecParser ff_dirac_parser = {
- .codec_ids = { AV_CODEC_ID_DIRAC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DIRAC),
.priv_data_size = sizeof(DiracParseContext),
.parser_parse = dirac_parse,
.parser_close = dirac_parse_close,
diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index 631ac83860..09d8dce1e5 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -26,6 +26,7 @@
#include "parser.h"
#include "dnxhddata.h"
+#include "parser_internal.h"
typedef struct {
ParseContext pc;
@@ -139,7 +140,7 @@ static int dnxhd_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_dnxhd_parser = {
- .codec_ids = { AV_CODEC_ID_DNXHD },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DNXHD),
.priv_data_size = sizeof(DNXHDParserContext),
.parser_parse = dnxhd_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/dnxuc_parser.c b/libavcodec/dnxuc_parser.c
index 34088ac3b1..bfed6b5b6f 100644
--- a/libavcodec/dnxuc_parser.c
+++ b/libavcodec/dnxuc_parser.c
@@ -25,6 +25,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
#include "libavutil/bswap.h"
typedef struct DNxUcParseContext {
@@ -82,7 +83,7 @@ static int dnxuc_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_dnxuc_parser = {
- .codec_ids = { AV_CODEC_ID_DNXUC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DNXUC),
.priv_data_size = sizeof(DNxUcParseContext),
.parser_parse = dnxuc_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/dolby_e_parser.c b/libavcodec/dolby_e_parser.c
index d2566e5446..53bf44d86e 100644
--- a/libavcodec/dolby_e_parser.c
+++ b/libavcodec/dolby_e_parser.c
@@ -21,6 +21,7 @@
#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "dolby_e.h"
+#include "parser_internal.h"
typedef struct DBEParseContext {
DBEContext dectx;
@@ -66,7 +67,7 @@ end:
}
const AVCodecParser ff_dolby_e_parser = {
- .codec_ids = { AV_CODEC_ID_DOLBY_E },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DOLBY_E),
.priv_data_size = sizeof(DBEParseContext),
.parser_parse = dolby_e_parse,
};
diff --git a/libavcodec/dpx_parser.c b/libavcodec/dpx_parser.c
index b74e6c5c68..9ca17bd94d 100644
--- a/libavcodec/dpx_parser.c
+++ b/libavcodec/dpx_parser.c
@@ -28,6 +28,7 @@
#include "libavutil/common.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct DPXParseContext {
ParseContext pc;
@@ -109,7 +110,7 @@ flush:
}
const AVCodecParser ff_dpx_parser = {
- .codec_ids = { AV_CODEC_ID_DPX },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DPX),
.priv_data_size = sizeof(DPXParseContext),
.parser_parse = dpx_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/dvaudio_parser.c b/libavcodec/dvaudio_parser.c
index e99ffc0517..1b4253aa83 100644
--- a/libavcodec/dvaudio_parser.c
+++ b/libavcodec/dvaudio_parser.c
@@ -25,6 +25,7 @@
#include "avcodec.h"
#include "dvaudio.h"
+#include "parser_internal.h"
static int dvaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
@@ -41,6 +42,6 @@ static int dvaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_dvaudio_parser = {
- .codec_ids = { AV_CODEC_ID_DVAUDIO },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DVAUDIO),
.parser_parse = dvaudio_parse,
};
diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c
index b2d5446867..68c2b77b39 100644
--- a/libavcodec/dvbsub_parser.c
+++ b/libavcodec/dvbsub_parser.c
@@ -25,6 +25,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "parser_internal.h"
/* Parser (mostly) copied from dvdsub.c */
@@ -164,7 +165,7 @@ static int dvbsub_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_dvbsub_parser = {
- .codec_ids = { AV_CODEC_ID_DVB_SUBTITLE },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DVB_SUBTITLE),
.priv_data_size = sizeof(DVBSubParseContext),
.parser_parse = dvbsub_parse,
};
diff --git a/libavcodec/dvd_nav_parser.c b/libavcodec/dvd_nav_parser.c
index 3005a10572..bb8c284ad5 100644
--- a/libavcodec/dvd_nav_parser.c
+++ b/libavcodec/dvd_nav_parser.c
@@ -20,6 +20,7 @@
*/
#include "avcodec.h"
+#include "parser_internal.h"
#include "libavutil/intreadwrite.h"
#define PCI_SIZE 980
@@ -108,7 +109,7 @@ static int dvd_nav_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_dvd_nav_parser = {
- .codec_ids = { AV_CODEC_ID_DVD_NAV },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DVD_NAV),
.priv_data_size = sizeof(DVDNavParseContext),
.parser_init = dvd_nav_parse_init,
.parser_parse = dvd_nav_parse,
diff --git a/libavcodec/dvdsub_parser.c b/libavcodec/dvdsub_parser.c
index 8871b6a383..fd5baf719f 100644
--- a/libavcodec/dvdsub_parser.c
+++ b/libavcodec/dvdsub_parser.c
@@ -24,6 +24,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "avcodec.h"
+#include "parser_internal.h"
/* parser definition */
typedef struct DVDSubParseContext {
@@ -85,7 +86,7 @@ static av_cold void dvdsub_parse_close(AVCodecParserContext *s)
}
const AVCodecParser ff_dvdsub_parser = {
- .codec_ids = { AV_CODEC_ID_DVD_SUBTITLE },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DVD_SUBTITLE),
.priv_data_size = sizeof(DVDSubParseContext),
.parser_parse = dvdsub_parse,
.parser_close = dvdsub_parse_close,
diff --git a/libavcodec/evc_parser.c b/libavcodec/evc_parser.c
index ea6675693e..5cd9b5544c 100644
--- a/libavcodec/evc_parser.c
+++ b/libavcodec/evc_parser.c
@@ -24,6 +24,7 @@
#include "bytestream.h"
#include "evc.h"
#include "evc_parse.h"
+#include "parser_internal.h"
#include "libavutil/attributes.h"
@@ -372,7 +373,7 @@ static av_cold void evc_parser_close(AVCodecParserContext *s)
}
const AVCodecParser ff_evc_parser = {
- .codec_ids = { AV_CODEC_ID_EVC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_EVC),
.priv_data_size = sizeof(EVCParserContext),
.parser_parse = evc_parse,
.parser_close = evc_parser_close,
diff --git a/libavcodec/ffv1_parser.c b/libavcodec/ffv1_parser.c
index e54854d84f..5f17d6a75b 100644
--- a/libavcodec/ffv1_parser.c
+++ b/libavcodec/ffv1_parser.c
@@ -18,6 +18,7 @@
#include "avcodec.h"
#include "ffv1.h"
+#include "parser_internal.h"
#include "rangecoder.h"
#include "libavutil/attributes.h"
@@ -81,7 +82,7 @@ static av_cold void ffv1_close(AVCodecParserContext *s)
}
const AVCodecParser ff_ffv1_parser = {
- .codec_ids = { AV_CODEC_ID_FFV1 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_FFV1),
.priv_data_size = sizeof(FFV1ParseContext),
.parser_parse = parse,
.parser_close = ffv1_close,
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index c310832617..ed0f4bc336 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -36,6 +36,7 @@
#include "libavutil/crc.h"
#include "libavutil/mem.h"
#include "flac_parse.h"
+#include "parser_internal.h"
/** maximum number of adjacent headers that compare CRCs against each other */
#define FLAC_MAX_SEQUENTIAL_HEADERS 4
@@ -903,7 +904,7 @@ static av_cold void flac_parse_close(AVCodecParserContext *c)
}
const AVCodecParser ff_flac_parser = {
- .codec_ids = { AV_CODEC_ID_FLAC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_FLAC),
.priv_data_size = sizeof(FLACParseContext),
.parser_init = flac_parse_init,
.parser_parse = flac_parse,
diff --git a/libavcodec/ftr_parser.c b/libavcodec/ftr_parser.c
index 656fd289f6..422b775d7c 100644
--- a/libavcodec/ftr_parser.c
+++ b/libavcodec/ftr_parser.c
@@ -28,6 +28,7 @@
#include "adts_header.h"
#include "adts_parser.h"
#include "mpeg4audio.h"
+#include "parser_internal.h"
typedef struct FTRParseContext {
ParseContext pc;
@@ -97,7 +98,7 @@ static int ftr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_ftr_parser = {
- .codec_ids = { AV_CODEC_ID_FTR },
+ PARSER_CODEC_LIST(AV_CODEC_ID_FTR),
.priv_data_size = sizeof(FTRParseContext),
.parser_parse = ftr_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/g723_1_parser.c b/libavcodec/g723_1_parser.c
index 2ed1a8ab19..0deec9fdf8 100644
--- a/libavcodec/g723_1_parser.c
+++ b/libavcodec/g723_1_parser.c
@@ -23,6 +23,7 @@
#include "parser.h"
#include "g723_1.h"
+#include "parser_internal.h"
typedef struct G723_1ParseContext {
ParseContext pc;
@@ -53,7 +54,7 @@ static int g723_1_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_g723_1_parser = {
- .codec_ids = { AV_CODEC_ID_G723_1 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_G723_1),
.priv_data_size = sizeof(G723_1ParseContext),
.parser_parse = g723_1_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/g729_parser.c b/libavcodec/g729_parser.c
index d51a78877d..c107436a42 100644
--- a/libavcodec/g729_parser.c
+++ b/libavcodec/g729_parser.c
@@ -27,6 +27,7 @@
#include "parser.h"
#include "g729.h"
+#include "parser_internal.h"
typedef struct G729ParseContext {
ParseContext pc;
@@ -85,7 +86,7 @@ static int g729_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_g729_parser = {
- .codec_ids = { AV_CODEC_ID_G729, AV_CODEC_ID_ACELP_KELVIN },
+ PARSER_CODEC_LIST(AV_CODEC_ID_G729, AV_CODEC_ID_ACELP_KELVIN),
.priv_data_size = sizeof(G729ParseContext),
.parser_parse = g729_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/gif_parser.c b/libavcodec/gif_parser.c
index f5903585fa..ceb03b0aab 100644
--- a/libavcodec/gif_parser.c
+++ b/libavcodec/gif_parser.c
@@ -26,6 +26,7 @@
#include "gif.h"
#include "parser.h"
+#include "parser_internal.h"
typedef enum GIFParseStates {
GIF_HEADER = 1,
@@ -201,7 +202,7 @@ static int gif_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_gif_parser = {
- .codec_ids = { AV_CODEC_ID_GIF },
+ PARSER_CODEC_LIST(AV_CODEC_ID_GIF),
.priv_data_size = sizeof(GIFParseContext),
.parser_parse = gif_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/gsm_parser.c b/libavcodec/gsm_parser.c
index 3492806052..0162bdcc13 100644
--- a/libavcodec/gsm_parser.c
+++ b/libavcodec/gsm_parser.c
@@ -28,6 +28,7 @@
#include "libavutil/avassert.h"
#include "parser.h"
#include "gsm.h"
+#include "parser_internal.h"
typedef struct GSMParseContext {
ParseContext pc;
@@ -84,7 +85,7 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_gsm_parser = {
- .codec_ids = { AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS },
+ PARSER_CODEC_LIST(AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS),
.priv_data_size = sizeof(GSMParseContext),
.parser_parse = gsm_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/h261_parser.c b/libavcodec/h261_parser.c
index e0b84c509e..7bd912f8bf 100644
--- a/libavcodec/h261_parser.c
+++ b/libavcodec/h261_parser.c
@@ -26,6 +26,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
static int h261_find_frame_end(ParseContext *pc, AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
@@ -87,7 +88,7 @@ static int h261_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_h261_parser = {
- .codec_ids = { AV_CODEC_ID_H261 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_H261),
.priv_data_size = sizeof(ParseContext),
.parser_parse = h261_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/h263_parser.c b/libavcodec/h263_parser.c
index f70a791177..2df6182d78 100644
--- a/libavcodec/h263_parser.c
+++ b/libavcodec/h263_parser.c
@@ -25,6 +25,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
{
@@ -88,7 +89,7 @@ static int h263_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_h263_parser = {
- .codec_ids = { AV_CODEC_ID_H263 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_H263),
.priv_data_size = sizeof(ParseContext),
.parser_parse = h263_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 722cbcb42f..9d3158d183 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -49,6 +49,7 @@
#include "mpegutils.h"
#include "parser.h"
#include "libavutil/refstruct.h"
+#include "parser_internal.h"
#include "startcode.h"
typedef struct H264ParseContext {
@@ -683,7 +684,7 @@ static av_cold int init(AVCodecParserContext *s)
}
const AVCodecParser ff_h264_parser = {
- .codec_ids = { AV_CODEC_ID_H264 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_H264),
.priv_data_size = sizeof(H264ParseContext),
.parser_init = init,
.parser_parse = h264_parse,
diff --git a/libavcodec/hdr_parser.c b/libavcodec/hdr_parser.c
index 915fd38225..af8ffd06ca 100644
--- a/libavcodec/hdr_parser.c
+++ b/libavcodec/hdr_parser.c
@@ -26,6 +26,7 @@
#include "libavutil/intreadwrite.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct HDRParseContext {
ParseContext pc;
@@ -72,7 +73,7 @@ static int hdr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_hdr_parser = {
- .codec_ids = { AV_CODEC_ID_RADIANCE_HDR },
+ PARSER_CODEC_LIST(AV_CODEC_ID_RADIANCE_HDR),
.priv_data_size = sizeof(HDRParseContext),
.parser_parse = hdr_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/hevc/parser.c b/libavcodec/hevc/parser.c
index 16b40e2b10..1a6b7987a3 100644
--- a/libavcodec/hevc/parser.c
+++ b/libavcodec/hevc/parser.c
@@ -25,6 +25,7 @@
#include "golomb.h"
#include "hevc.h"
+#include "parser_internal.h"
#include "parse.h"
#include "ps.h"
#include "sei.h"
@@ -353,7 +354,7 @@ static void hevc_parser_close(AVCodecParserContext *s)
}
const AVCodecParser ff_hevc_parser = {
- .codec_ids = { AV_CODEC_ID_HEVC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_HEVC),
.priv_data_size = sizeof(HEVCParserContext),
.parser_parse = hevc_parse,
.parser_close = hevc_parser_close,
diff --git a/libavcodec/ipu_parser.c b/libavcodec/ipu_parser.c
index 1193a65b1b..d278e8b449 100644
--- a/libavcodec/ipu_parser.c
+++ b/libavcodec/ipu_parser.c
@@ -25,6 +25,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
typedef struct IPUParseContext {
ParseContext pc;
@@ -70,7 +71,7 @@ static int ipu_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_ipu_parser = {
- .codec_ids = { AV_CODEC_ID_IPU },
+ PARSER_CODEC_LIST(AV_CODEC_ID_IPU),
.priv_data_size = sizeof(IPUParseContext),
.parser_parse = ipu_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index e96efc28ed..2ef29582a7 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -25,6 +25,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
/* Whether frame is jp2 file or codestream
*/
@@ -212,7 +213,7 @@ static int jpeg2000_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_jpeg2000_parser = {
- .codec_ids = { AV_CODEC_ID_JPEG2000 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_JPEG2000),
.priv_data_size = sizeof(JPEG2000ParserContext),
.parser_parse = jpeg2000_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c
index 3981b0cec0..ca00a86a0b 100644
--- a/libavcodec/jpegxl_parser.c
+++ b/libavcodec/jpegxl_parser.c
@@ -32,6 +32,7 @@
#include "bytestream.h"
#include "codec_id.h"
+#include "parser_internal.h"
#define UNCHECKED_BITSTREAM_READER 0
#define BITSTREAM_READER_LE
#include "get_bits.h"
@@ -1546,7 +1547,7 @@ flush:
}
const AVCodecParser ff_jpegxl_parser = {
- .codec_ids = { AV_CODEC_ID_JPEGXL, AV_CODEC_ID_JPEGXL_ANIM },
+ PARSER_CODEC_LIST(AV_CODEC_ID_JPEGXL, AV_CODEC_ID_JPEGXL_ANIM),
.priv_data_size = sizeof(JXLParseContext),
.parser_parse = jpegxl_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/latm_parser.c b/libavcodec/latm_parser.c
index 8cc2024c4f..b06103aef8 100644
--- a/libavcodec/latm_parser.c
+++ b/libavcodec/latm_parser.c
@@ -25,6 +25,7 @@
#include <stdint.h>
#include "parser.h"
+#include "parser_internal.h"
#define LATM_HEADER 0x56e000 // 0x2b7 (11 bits)
#define LATM_MASK 0xFFE000 // top 11 bits
@@ -105,7 +106,7 @@ static int latm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_aac_latm_parser = {
- .codec_ids = { AV_CODEC_ID_AAC_LATM },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AAC_LATM),
.priv_data_size = sizeof(LATMParseContext),
.parser_parse = latm_parse,
.parser_close = ff_parse_close
diff --git a/libavcodec/misc4_parser.c b/libavcodec/misc4_parser.c
index d234dbb629..867e9b0a4c 100644
--- a/libavcodec/misc4_parser.c
+++ b/libavcodec/misc4_parser.c
@@ -19,6 +19,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
typedef struct MISC4Context {
ParseContext pc;
@@ -74,7 +75,7 @@ static int misc4_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_misc4_parser = {
- .codec_ids = { AV_CODEC_ID_MISC4 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_MISC4),
.priv_data_size = sizeof(MISC4Context),
.parser_parse = misc4_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/mjpeg_parser.c b/libavcodec/mjpeg_parser.c
index 62b923b625..152580b354 100644
--- a/libavcodec/mjpeg_parser.c
+++ b/libavcodec/mjpeg_parser.c
@@ -27,6 +27,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
typedef struct MJPEGParserContext{
ParseContext pc;
@@ -129,7 +130,7 @@ static int jpeg_parse(AVCodecParserContext *s,
const AVCodecParser ff_mjpeg_parser = {
- .codec_ids = { AV_CODEC_ID_MJPEG, AV_CODEC_ID_JPEGLS },
+ PARSER_CODEC_LIST(AV_CODEC_ID_MJPEG, AV_CODEC_ID_JPEGLS),
.priv_data_size = sizeof(MJPEGParserContext),
.parser_parse = jpeg_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index d391390dd5..6ed0fa20a8 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -31,6 +31,7 @@
#include "parser.h"
#include "mlp_parse.h"
#include "mlp.h"
+#include "parser_internal.h"
typedef struct MLPParseContext
{
@@ -205,7 +206,7 @@ lost_sync:
}
const AVCodecParser ff_mlp_parser = {
- .codec_ids = { AV_CODEC_ID_MLP, AV_CODEC_ID_TRUEHD },
+ PARSER_CODEC_LIST(AV_CODEC_ID_MLP, AV_CODEC_ID_TRUEHD),
.priv_data_size = sizeof(MLPParseContext),
.parser_init = mlp_init,
.parser_parse = mlp_parse,
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index a2a22234f2..5a75e250d1 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -27,6 +27,7 @@
#include "mpegvideo.h"
#include "mpeg4videodec.h"
#include "mpeg4videodefs.h"
+#include "parser_internal.h"
struct Mp4vParseContext {
ParseContext pc;
@@ -156,7 +157,7 @@ static int mpeg4video_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_mpeg4video_parser = {
- .codec_ids = { AV_CODEC_ID_MPEG4 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_MPEG4),
.priv_data_size = sizeof(struct Mp4vParseContext),
.parser_init = mpeg4video_parse_init,
.parser_parse = mpeg4video_parse,
diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
index d54366f10a..865d9298d3 100644
--- a/libavcodec/mpegaudio_parser.c
+++ b/libavcodec/mpegaudio_parser.c
@@ -22,6 +22,7 @@
#include "parser.h"
#include "mpegaudiodecheader.h"
+#include "parser_internal.h"
#include "libavutil/common.h"
#include "libavformat/apetag.h" // for APE tag.
#include "libavformat/id3v1.h" // for ID3v1_TAG_SIZE
@@ -137,7 +138,8 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
const AVCodecParser ff_mpegaudio_parser = {
- .codec_ids = { AV_CODEC_ID_MP1, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU },
+ PARSER_CODEC_LIST(AV_CODEC_ID_MP1, AV_CODEC_ID_MP2,
+ AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU),
.priv_data_size = sizeof(MpegAudioParseContext),
.parser_parse = mpegaudio_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index cf9eaddf80..b80e70a740 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -25,6 +25,7 @@
#include "parser.h"
#include "mpeg12.h"
#include "mpeg12data.h"
+#include "parser_internal.h"
#include "startcode.h"
struct MpvParseContext {
@@ -300,7 +301,7 @@ static av_cold int mpegvideo_parse_init(AVCodecParserContext *s)
}
const AVCodecParser ff_mpegvideo_parser = {
- .codec_ids = { AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO },
+ PARSER_CODEC_LIST(AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO),
.priv_data_size = sizeof(struct MpvParseContext),
.parser_init = mpegvideo_parse_init,
.parser_parse = mpegvideo_parse,
diff --git a/libavcodec/opus/parser.c b/libavcodec/opus/parser.c
index 9bf0b31fba..1fe011724c 100644
--- a/libavcodec/opus/parser.c
+++ b/libavcodec/opus/parser.c
@@ -31,6 +31,7 @@
#include "opus.h"
#include "parse.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct OpusParserContext {
ParseContext pc;
@@ -214,7 +215,7 @@ fail:
}
const AVCodecParser ff_opus_parser = {
- .codec_ids = { AV_CODEC_ID_OPUS },
+ PARSER_CODEC_LIST(AV_CODEC_ID_OPUS),
.priv_data_size = sizeof(OpusParserContext),
.parser_parse = opus_parse,
.parser_close = ff_parse_close
diff --git a/libavcodec/parser_internal.h b/libavcodec/parser_internal.h
new file mode 100644
index 0000000000..81ccceeedf
--- /dev/null
+++ b/libavcodec/parser_internal.h
@@ -0,0 +1,38 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_PARSER_INTERNAL_H
+#define AVCODEC_PARSER_INTERNAL_H
+
+#include "libavutil/macros.h"
+#include "codec_id.h"
+
+#define EIGTH_ARG(a,b,c,d,e,f,g,h,...) h
+#define NO_FAIL
+// Expands to nothing if <= 7 args; induces compilation failure if not.
+#define CHECK_FOR_TOO_MANY_IDS(...) AV_JOIN(EIGTH_ARG(__VA_ARGS__, NO, NO, NO, NO, NO, NO, NO, NO), _FAIL)
+
+// For compatibility with MSVC's old, spec-incompliant preprocessor.
+#define PASSTHROUGH(...) __VA_ARGS__
+#define FIRST_SEVEN2(a,b,c,d,e,f,g,...) a,b,c,d,e,f,g
+#define FIRST_SEVEN(...) PASSTHROUGH(FIRST_SEVEN2(__VA_ARGS__))
+#define TIMES_SEVEN(a) a,a,a,a,a,a,a
+#define PARSER_CODEC_LIST(...) CHECK_FOR_TOO_MANY_IDS(__VA_ARGS__) \
+ .codec_ids = { FIRST_SEVEN(__VA_ARGS__, TIMES_SEVEN(AV_CODEC_ID_NONE)) }
+
+#endif /* AVCODEC_PARSER_INTERNAL_H */
diff --git a/libavcodec/png_parser.c b/libavcodec/png_parser.c
index 314de1b436..e4af1f2e09 100644
--- a/libavcodec/png_parser.c
+++ b/libavcodec/png_parser.c
@@ -25,6 +25,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
#include "png.h"
typedef struct PNGParseContext {
@@ -111,7 +112,7 @@ flush:
}
const AVCodecParser ff_png_parser = {
- .codec_ids = { AV_CODEC_ID_PNG },
+ PARSER_CODEC_LIST(AV_CODEC_ID_PNG),
.priv_data_size = sizeof(PNGParseContext),
.parser_parse = png_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index 74f918a94b..65dbaf86f6 100644
--- a/libavcodec/pnm_parser.c
+++ b/libavcodec/pnm_parser.c
@@ -23,6 +23,7 @@
#include "libavutil/imgutils.h"
#include "parser.h" //for ParseContext
+#include "parser_internal.h"
#include "pnm.h"
typedef struct PNMParseContext {
@@ -134,9 +135,9 @@ end:
}
const AVCodecParser ff_pnm_parser = {
- .codec_ids = { AV_CODEC_ID_PGM, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PPM,
- AV_CODEC_ID_PBM, AV_CODEC_ID_PAM, AV_CODEC_ID_PFM,
- AV_CODEC_ID_PHM },
+ PARSER_CODEC_LIST(AV_CODEC_ID_PGM, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PPM,
+ AV_CODEC_ID_PBM, AV_CODEC_ID_PAM, AV_CODEC_ID_PFM,
+ AV_CODEC_ID_PHM),
.priv_data_size = sizeof(PNMParseContext),
.parser_parse = pnm_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/prores_parser.c b/libavcodec/prores_parser.c
index d778f839bd..9b66c3b415 100644
--- a/libavcodec/prores_parser.c
+++ b/libavcodec/prores_parser.c
@@ -20,6 +20,7 @@
#include "bytestream.h"
#include "avcodec.h"
+#include "parser_internal.h"
static int parse(AVCodecParserContext *s,
AVCodecContext *avctx,
@@ -123,6 +124,6 @@ static int parse(AVCodecParserContext *s,
}
const AVCodecParser ff_prores_parser = {
- .codec_ids = { AV_CODEC_ID_PRORES },
+ PARSER_CODEC_LIST(AV_CODEC_ID_PRORES),
.parser_parse = parse,
};
diff --git a/libavcodec/prores_raw_parser.c b/libavcodec/prores_raw_parser.c
index cc6b75319e..95efe28b0a 100644
--- a/libavcodec/prores_raw_parser.c
+++ b/libavcodec/prores_raw_parser.c
@@ -20,6 +20,7 @@
#include "parser.h"
#include "bytestream.h"
+#include "parser_internal.h"
static int prores_raw_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
@@ -97,6 +98,6 @@ static int prores_raw_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_prores_raw_parser = {
- .codec_ids = { AV_CODEC_ID_PRORES_RAW },
+ PARSER_CODEC_LIST(AV_CODEC_ID_PRORES_RAW),
.parser_parse = prores_raw_parse,
};
diff --git a/libavcodec/qoi_parser.c b/libavcodec/qoi_parser.c
index e5af11e948..1c20d334d0 100644
--- a/libavcodec/qoi_parser.c
+++ b/libavcodec/qoi_parser.c
@@ -25,6 +25,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
typedef struct QOIParseContext {
ParseContext pc;
@@ -70,7 +71,7 @@ static int qoi_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_qoi_parser = {
- .codec_ids = { AV_CODEC_ID_QOI },
+ PARSER_CODEC_LIST(AV_CODEC_ID_QOI),
.priv_data_size = sizeof(QOIParseContext),
.parser_parse = qoi_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/rv34_parser.c b/libavcodec/rv34_parser.c
index 2997a4db70..3ce1abf60a 100644
--- a/libavcodec/rv34_parser.c
+++ b/libavcodec/rv34_parser.c
@@ -25,6 +25,7 @@
*/
#include "avcodec.h"
+#include "parser_internal.h"
#include "libavutil/intreadwrite.h"
typedef struct RV34ParseContext {
@@ -76,7 +77,7 @@ static int rv34_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_rv34_parser = {
- .codec_ids = { AV_CODEC_ID_RV30, AV_CODEC_ID_RV40 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_RV30, AV_CODEC_ID_RV40),
.priv_data_size = sizeof(RV34ParseContext),
.parser_parse = rv34_parse,
};
diff --git a/libavcodec/sbc_parser.c b/libavcodec/sbc_parser.c
index 2d427cc7cb..9cd225aa7b 100644
--- a/libavcodec/sbc_parser.c
+++ b/libavcodec/sbc_parser.c
@@ -22,6 +22,7 @@
#include "sbc.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct SBCParseContext {
ParseContext pc;
@@ -117,7 +118,7 @@ static int sbc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_sbc_parser = {
- .codec_ids = { AV_CODEC_ID_SBC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_SBC),
.priv_data_size = sizeof(SBCParseContext),
.parser_parse = sbc_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/sipr_parser.c b/libavcodec/sipr_parser.c
index e01da3c8a8..89352663a5 100644
--- a/libavcodec/sipr_parser.c
+++ b/libavcodec/sipr_parser.c
@@ -22,6 +22,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
typedef struct SiprParserContext{
ParseContext pc;
@@ -67,7 +68,7 @@ static int sipr_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_sipr_parser = {
- .codec_ids = { AV_CODEC_ID_SIPR },
+ PARSER_CODEC_LIST(AV_CODEC_ID_SIPR),
.priv_data_size = sizeof(SiprParserContext),
.parser_parse = sipr_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/tak_parser.c b/libavcodec/tak_parser.c
index 7f5f5314af..47931288b7 100644
--- a/libavcodec/tak_parser.c
+++ b/libavcodec/tak_parser.c
@@ -27,6 +27,7 @@
#define CACHED_BITSTREAM_READER !ARCH_X86_32
#define BITSTREAM_READER_LE
#include "parser.h"
+#include "parser_internal.h"
#include "tak.h"
typedef struct TAKParseContext {
@@ -124,7 +125,7 @@ fail:
}
const AVCodecParser ff_tak_parser = {
- .codec_ids = { AV_CODEC_ID_TAK },
+ PARSER_CODEC_LIST(AV_CODEC_ID_TAK),
.priv_data_size = sizeof(TAKParseContext),
.parser_parse = tak_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index 05094d782f..f5bc8d7126 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -28,6 +28,7 @@
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "parser.h"
+#include "parser_internal.h"
#include "vc1.h"
#include "get_bits.h"
#include "vc1dsp.h"
@@ -272,7 +273,7 @@ static av_cold int vc1_parse_init(AVCodecParserContext *s)
}
const AVCodecParser ff_vc1_parser = {
- .codec_ids = { AV_CODEC_ID_VC1 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_VC1),
.priv_data_size = sizeof(VC1ParseContext),
.parser_init = vc1_parse_init,
.parser_parse = vc1_parse,
diff --git a/libavcodec/vorbis_parser.c b/libavcodec/vorbis_parser.c
index 25884b6b8a..a3b0a4e5c4 100644
--- a/libavcodec/vorbis_parser.c
+++ b/libavcodec/vorbis_parser.c
@@ -31,6 +31,7 @@
#include "libavutil/mem.h"
#include "get_bits.h"
+#include "parser_internal.h"
#include "xiph.h"
#include "vorbis_parser_internal.h"
@@ -336,7 +337,7 @@ static av_cold void vorbis_parser_close(AVCodecParserContext *ctx)
}
const AVCodecParser ff_vorbis_parser = {
- .codec_ids = { AV_CODEC_ID_VORBIS },
+ PARSER_CODEC_LIST(AV_CODEC_ID_VORBIS),
.priv_data_size = sizeof(VorbisParseContext),
.parser_parse = vorbis_parse,
.parser_close = vorbis_parser_close,
diff --git a/libavcodec/vp3_parser.c b/libavcodec/vp3_parser.c
index e8bfebdc39..9be3f70596 100644
--- a/libavcodec/vp3_parser.c
+++ b/libavcodec/vp3_parser.c
@@ -19,6 +19,7 @@
*/
#include "avcodec.h"
+#include "parser_internal.h"
static int parse(AVCodecParserContext *s,
AVCodecContext *avctx,
@@ -36,9 +37,7 @@ static int parse(AVCodecParserContext *s,
}
const AVCodecParser ff_vp3_parser = {
- .codec_ids = {
- AV_CODEC_ID_THEORA, AV_CODEC_ID_VP3,
- AV_CODEC_ID_VP6, AV_CODEC_ID_VP6F, AV_CODEC_ID_VP6A
- },
+ PARSER_CODEC_LIST(AV_CODEC_ID_THEORA, AV_CODEC_ID_VP3,
+ AV_CODEC_ID_VP6, AV_CODEC_ID_VP6F, AV_CODEC_ID_VP6A),
.parser_parse = parse,
};
diff --git a/libavcodec/vp8_parser.c b/libavcodec/vp8_parser.c
index 98b752bfb9..14c0c1462b 100644
--- a/libavcodec/vp8_parser.c
+++ b/libavcodec/vp8_parser.c
@@ -19,6 +19,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "parser_internal.h"
static int parse(AVCodecParserContext *s,
AVCodecContext *avctx,
@@ -74,6 +75,6 @@ static int parse(AVCodecParserContext *s,
}
const AVCodecParser ff_vp8_parser = {
- .codec_ids = { AV_CODEC_ID_VP8 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_VP8),
.parser_parse = parse,
};
diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c
index 72df554da5..7e1a06201a 100644
--- a/libavcodec/vp9_parser.c
+++ b/libavcodec/vp9_parser.c
@@ -23,6 +23,7 @@
#include "avcodec.h"
#include "get_bits.h"
+#include "parser_internal.h"
static int parse(AVCodecParserContext *ctx,
AVCodecContext *avctx,
@@ -64,6 +65,6 @@ static int parse(AVCodecParserContext *ctx,
}
const AVCodecParser ff_vp9_parser = {
- .codec_ids = { AV_CODEC_ID_VP9 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_VP9),
.parser_parse = parse,
};
diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c
index 0c7362dde4..4453aaa61d 100644
--- a/libavcodec/vvc_parser.c
+++ b/libavcodec/vvc_parser.c
@@ -24,6 +24,7 @@
#include "cbs.h"
#include "cbs_h266.h"
#include "parser.h"
+#include "parser_internal.h"
#define START_CODE 0x000001 ///< start_code_prefix_one_3bytes
#define IS_IDR(nut) (nut == VVC_IDR_W_RADL || nut == VVC_IDR_N_LP)
@@ -506,7 +507,7 @@ static av_cold void vvc_parser_close(AVCodecParserContext *s)
}
const AVCodecParser ff_vvc_parser = {
- .codec_ids = { AV_CODEC_ID_VVC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_VVC),
.priv_data_size = sizeof(VVCParserContext),
.parser_init = vvc_parser_init,
.parser_close = vvc_parser_close,
diff --git a/libavcodec/webp_parser.c b/libavcodec/webp_parser.c
index bd5f94dac5..e3edc348e4 100644
--- a/libavcodec/webp_parser.c
+++ b/libavcodec/webp_parser.c
@@ -27,6 +27,7 @@
#include "libavutil/common.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct WebPParseContext {
ParseContext pc;
@@ -105,7 +106,7 @@ flush:
}
const AVCodecParser ff_webp_parser = {
- .codec_ids = { AV_CODEC_ID_WEBP },
+ PARSER_CODEC_LIST(AV_CODEC_ID_WEBP),
.priv_data_size = sizeof(WebPParseContext),
.parser_parse = webp_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/xbm_parser.c b/libavcodec/xbm_parser.c
index 436aec96ab..c7e7ce9282 100644
--- a/libavcodec/xbm_parser.c
+++ b/libavcodec/xbm_parser.c
@@ -30,6 +30,7 @@
#include "libavutil/avutil.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct XBMParseContext {
ParseContext pc;
@@ -101,7 +102,7 @@ static int xbm_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_xbm_parser = {
- .codec_ids = { AV_CODEC_ID_XBM },
+ PARSER_CODEC_LIST(AV_CODEC_ID_XBM),
.priv_data_size = sizeof(XBMParseContext),
.parser_init = xbm_init,
.parser_parse = xbm_parse,
diff --git a/libavcodec/xma_parser.c b/libavcodec/xma_parser.c
index 26db266a3e..eae39fd031 100644
--- a/libavcodec/xma_parser.c
+++ b/libavcodec/xma_parser.c
@@ -22,6 +22,7 @@
*/
#include "avcodec.h"
+#include "parser_internal.h"
typedef struct XMAParserContext{
int skip_packets;
@@ -56,7 +57,7 @@ static int xma_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_xma_parser = {
- .codec_ids = { AV_CODEC_ID_XMA2 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_XMA2),
.priv_data_size = sizeof(XMAParserContext),
.parser_parse = xma_parse,
};
diff --git a/libavcodec/xwd_parser.c b/libavcodec/xwd_parser.c
index ab5fe86070..cc554c3c97 100644
--- a/libavcodec/xwd_parser.c
+++ b/libavcodec/xwd_parser.c
@@ -26,6 +26,7 @@
#include "libavutil/intreadwrite.h"
#include "parser.h"
+#include "parser_internal.h"
#include "xwd.h"
typedef struct XWDParseContext {
@@ -96,7 +97,7 @@ static int xwd_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_xwd_parser = {
- .codec_ids = { AV_CODEC_ID_XWD },
+ PARSER_CODEC_LIST(AV_CODEC_ID_XWD),
.priv_data_size = sizeof(XWDParseContext),
.parser_parse = xwd_parse,
.parser_close = ff_parse_close,
commit 12f7a7724d5aa46d1cb80a2fd93281f73c3bfd0a
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Sun Oct 26 09:33:25 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 16:57:02 2025 +0100
avcodec: Remove unnecessary parser.h inclusions
It only contains declarations for some auxiliary functions for parsing
that parsers that only work with complete packets don't need.
Reviewed-by: James Almer <jamrial(a)gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index ed6e1b61ad..0a07a9647e 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -24,9 +24,9 @@
#include "libavutil/avassert.h"
#include "av1_parse.h"
+#include "avcodec.h"
#include "cbs.h"
#include "cbs_av1.h"
-#include "parser.h"
typedef struct AV1ParseContext {
CodedBitstreamContext *cbc;
diff --git a/libavcodec/cook_parser.c b/libavcodec/cook_parser.c
index 0d9473845e..404f611cf4 100644
--- a/libavcodec/cook_parser.c
+++ b/libavcodec/cook_parser.c
@@ -28,7 +28,7 @@
#include <stdint.h>
#include "libavutil/intreadwrite.h"
-#include "parser.h"
+#include "avcodec.h"
typedef struct CookParseContext {
int duration;
diff --git a/libavcodec/dvaudio_parser.c b/libavcodec/dvaudio_parser.c
index ef6bd45582..e99ffc0517 100644
--- a/libavcodec/dvaudio_parser.c
+++ b/libavcodec/dvaudio_parser.c
@@ -23,7 +23,7 @@
* Determines the duration for each packet.
*/
-#include "parser.h"
+#include "avcodec.h"
#include "dvaudio.h"
static int dvaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
diff --git a/libavcodec/dvd_nav_parser.c b/libavcodec/dvd_nav_parser.c
index 3ea4cd1ef5..3005a10572 100644
--- a/libavcodec/dvd_nav_parser.c
+++ b/libavcodec/dvd_nav_parser.c
@@ -18,9 +18,9 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
#include "avcodec.h"
-#include "get_bits.h"
-#include "parser.h"
+#include "libavutil/intreadwrite.h"
#define PCI_SIZE 980
#define DSI_SIZE 1018
diff --git a/libavcodec/vp3_parser.c b/libavcodec/vp3_parser.c
index 1bed43e779..e8bfebdc39 100644
--- a/libavcodec/vp3_parser.c
+++ b/libavcodec/vp3_parser.c
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "parser.h"
+#include "avcodec.h"
static int parse(AVCodecParserContext *s,
AVCodecContext *avctx,
diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c
index ffcb93505f..72df554da5 100644
--- a/libavcodec/vp9_parser.c
+++ b/libavcodec/vp9_parser.c
@@ -21,9 +21,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/intreadwrite.h"
-#include "libavcodec/get_bits.h"
-#include "parser.h"
+#include "avcodec.h"
+#include "get_bits.h"
static int parse(AVCodecParserContext *ctx,
AVCodecContext *avctx,
diff --git a/libavcodec/xma_parser.c b/libavcodec/xma_parser.c
index dc8a197c67..26db266a3e 100644
--- a/libavcodec/xma_parser.c
+++ b/libavcodec/xma_parser.c
@@ -21,7 +21,7 @@
* XMA2 audio parser
*/
-#include "parser.h"
+#include "avcodec.h"
typedef struct XMAParserContext{
int skip_packets;
-----------------------------------------------------------------------
Summary of changes:
configure | 4 +-
doc/APIchanges | 8 +++
libavcodec/aac_parser.c | 11 +--
libavcodec/ac3_parser.c | 11 +--
libavcodec/adx_parser.c | 10 +--
libavcodec/ahx_parser.c | 9 +--
libavcodec/amr_parser.c | 11 +--
libavcodec/apv_parser.c | 11 +--
libavcodec/av1_parser.c | 13 ++--
libavcodec/avcodec.h | 22 ++++++
libavcodec/avs2_parser.c | 9 +--
libavcodec/avs3_parser.c | 9 +--
libavcodec/bmp_parser.c | 9 +--
libavcodec/cavs_parser.c | 9 +--
libavcodec/cook_parser.c | 9 +--
libavcodec/cri_parser.c | 9 +--
libavcodec/dca_parser.c | 11 +--
libavcodec/dirac_parser.c | 9 +--
libavcodec/dnxhd_parser.c | 9 +--
libavcodec/dnxuc_parser.c | 9 +--
libavcodec/dolby_e_parser.c | 7 +-
libavcodec/dpx_parser.c | 9 +--
libavcodec/dvaudio_parser.c | 9 +--
libavcodec/dvbsub_parser.c | 7 +-
libavcodec/dvd_nav_parser.c | 13 ++--
libavcodec/dvdsub_parser.c | 9 +--
libavcodec/evc_parser.c | 9 +--
libavcodec/ffv1_parser.c | 9 +--
libavcodec/flac_parser.c | 11 +--
libavcodec/ftr_parser.c | 9 +--
libavcodec/g723_1_parser.c | 9 +--
libavcodec/g729_parser.c | 9 +--
libavcodec/gif_parser.c | 9 +--
libavcodec/gsm_parser.c | 9 +--
libavcodec/h261_parser.c | 9 +--
libavcodec/h263_parser.c | 9 +--
libavcodec/h264_parser.c | 11 +--
libavcodec/hdr_parser.c | 9 +--
libavcodec/hevc/parser.c | 9 +--
libavcodec/ipu_parser.c | 9 +--
libavcodec/jpeg2000_parser.c | 9 +--
libavcodec/jpegxl_parser.c | 9 +--
libavcodec/latm_parser.c | 9 +--
libavcodec/misc4_parser.c | 9 +--
libavcodec/mjpeg_parser.c | 9 +--
libavcodec/mlp_parser.c | 11 +--
libavcodec/mpeg4video_parser.c | 11 +--
libavcodec/mpegaudio_parser.c | 10 +--
libavcodec/mpegvideo_parser.c | 11 +--
libavcodec/opus/parser.c | 9 +--
libavcodec/parser.c | 21 ++++--
libavcodec/parser_internal.h | 83 ++++++++++++++++++++++
libavcodec/parsers.c | 153 ++++++++++++++++++++++-------------------
libavcodec/png_parser.c | 9 +--
libavcodec/pnm_parser.c | 13 ++--
libavcodec/prores_parser.c | 7 +-
libavcodec/prores_raw_parser.c | 7 +-
libavcodec/qoi_parser.c | 9 +--
libavcodec/rv34_parser.c | 7 +-
libavcodec/sbc_parser.c | 9 +--
libavcodec/sipr_parser.c | 9 +--
libavcodec/tak_parser.c | 9 +--
libavcodec/vc1_parser.c | 11 +--
libavcodec/version.h | 4 +-
libavcodec/version_major.h | 3 +
libavcodec/vorbis_parser.c | 9 +--
libavcodec/vp3_parser.c | 13 ++--
libavcodec/vp8_parser.c | 7 +-
libavcodec/vp9_parser.c | 12 ++--
libavcodec/vvc_parser.c | 11 +--
libavcodec/webp_parser.c | 9 +--
libavcodec/xbm_parser.c | 11 +--
libavcodec/xma_parser.c | 9 +--
libavcodec/xwd_parser.c | 9 +--
74 files changed, 564 insertions(+), 363 deletions(-)
create mode 100644 libavcodec/parser_internal.h
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. 633d424b1b avutil/csp: don't dereference NULL pointer in av_csp_primaries_desc_from_id()
by ffmpeg-git@ffmpeg.org 01 Nov '25
by ffmpeg-git@ffmpeg.org 01 Nov '25
01 Nov '25
The branch, master has been updated
via 633d424b1b4b3e50849f5174bbd1dc673eeeedca (commit)
via 492310ec6effcbd67ee6e768c84aceadc5683093 (commit)
via acd2cfe2eb1164b5c299489ecab313756a4ad796 (commit)
from 9c266084fe735752dffdd77d4e791d7b80ac55d0 (commit)
- Log -----------------------------------------------------------------
commit 633d424b1b4b3e50849f5174bbd1dc673eeeedca
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Fri Oct 31 16:05:02 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Sat Nov 1 12:41:23 2025 -0300
avutil/csp: don't dereference NULL pointer in av_csp_primaries_desc_from_id()
Fixes CID 1668265.
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/libavutil/csp.c b/libavutil/csp.c
index c8ecddc110..8ff53cff5f 100644
--- a/libavutil/csp.c
+++ b/libavutil/csp.c
@@ -100,7 +100,7 @@ const AVColorPrimariesDesc *av_csp_primaries_desc_from_id(enum AVColorPrimaries
else if (((unsigned)prm >= AVCOL_PRI_EXT_BASE) &&
((unsigned)prm < AVCOL_PRI_EXT_NB))
p = &color_primaries_ext[prm - AVCOL_PRI_EXT_BASE];
- if (!p->prim.r.x.num)
+ if (!p || !p->prim.r.x.num)
return NULL;
return p;
}
commit 492310ec6effcbd67ee6e768c84aceadc5683093
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Fri Oct 31 15:56:40 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Sat Nov 1 12:41:23 2025 -0300
fftools/ffmpeg_demux: fix memory leak when creating tile grid filtergraphs
If av_packet_side_data_to_frame() fails, graph_str will leak.
Fixes CID 1668266.
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 29ef86b7c9..cb79dd7611 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1702,17 +1702,22 @@ static int istg_parse_tile_grid(const OptionsContext *o, Demuxer *d, InputStream
ret = av_packet_side_data_to_frame(&opts.side_data, &opts.nb_side_data, sd, 0);
if (ret < 0 && ret != AVERROR(EINVAL))
- return ret;
+ goto fail;
}
ret = fg_create(NULL, &graph_str, d->sch, &opts);
if (ret < 0)
- return ret;
+ goto fail;
istg->fg = filtergraphs[nb_filtergraphs-1];
istg->fg->is_internal = 1;
- return 0;
+ ret = 0;
+fail:
+ if (ret < 0)
+ av_freep(&graph_str);
+
+ return ret;
}
static int istg_add(const OptionsContext *o, Demuxer *d, AVStreamGroup *stg)
commit acd2cfe2eb1164b5c299489ecab313756a4ad796
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Fri Oct 31 15:54:27 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Sat Nov 1 12:41:23 2025 -0300
fftools/ffmpeg: make fg_create{_simple,} clear the input string pointer
The graph string is either freed or attached to the filtergraph, so it's best to
not leave a dangling pointer with the caller.
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index c866980251..cc2ea1a56e 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -811,7 +811,7 @@ int parse_and_set_vsync(const char *arg, enum VideoSyncMethod *vsync_var, int fi
int filtergraph_is_simple(const FilterGraph *fg);
int fg_create_simple(FilterGraph **pfg,
InputStream *ist,
- char *graph_desc,
+ char **graph_desc,
Scheduler *sch, unsigned sched_idx_enc,
const OutputFilterOptions *opts);
int fg_finalise_bindings(void);
@@ -834,10 +834,10 @@ int ofilter_bind_enc(OutputFilter *ofilter,
/**
* Create a new filtergraph in the global filtergraph list.
*
- * @param graph_desc Graph description; an av_malloc()ed string, filtergraph
+ * @param graph_desc Pointer to graph description; an av_malloc()ed string, filtergraph
* takes ownership of it.
*/
-int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch,
+int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch,
const OutputFilterOptions *opts);
void fg_free(FilterGraph **pfg);
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 6901f59dd0..29ef86b7c9 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1705,7 +1705,7 @@ static int istg_parse_tile_grid(const OptionsContext *o, Demuxer *d, InputStream
return ret;
}
- ret = fg_create(NULL, graph_str, d->sch, &opts);
+ ret = fg_create(NULL, &graph_str, d->sch, &opts);
if (ret < 0)
return ret;
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index b0244fa774..9f962e6b8c 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1085,7 +1085,7 @@ static const AVClass fg_class = {
.category = AV_CLASS_CATEGORY_FILTER,
};
-int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch,
+int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch,
const OutputFilterOptions *opts)
{
FilterGraphPriv *fgp;
@@ -1097,7 +1097,7 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch,
fgp = av_mallocz(sizeof(*fgp));
if (!fgp) {
- av_freep(&graph_desc);
+ av_freep(graph_desc);
return AVERROR(ENOMEM);
}
fg = &fgp->fg;
@@ -1108,7 +1108,7 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch,
} else {
ret = av_dynarray_add_nofree(&filtergraphs, &nb_filtergraphs, fgp);
if (ret < 0) {
- av_freep(&graph_desc);
+ av_freep(graph_desc);
av_freep(&fgp);
return ret;
}
@@ -1117,11 +1117,13 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch,
}
fg->class = &fg_class;
- fg->graph_desc = graph_desc;
+ fg->graph_desc = *graph_desc;
fgp->disable_conversions = !auto_conversion_filters;
fgp->nb_threads = -1;
fgp->sch = sch;
+ *graph_desc = NULL;
+
snprintf(fgp->log_name, sizeof(fgp->log_name), "fc#%d", fg->index);
fgp->frame = av_frame_alloc();
@@ -1245,7 +1247,7 @@ fail:
int fg_create_simple(FilterGraph **pfg,
InputStream *ist,
- char *graph_desc,
+ char **graph_desc,
Scheduler *sch, unsigned sched_idx_enc,
const OutputFilterOptions *opts)
{
@@ -1270,7 +1272,7 @@ int fg_create_simple(FilterGraph **pfg,
"to have exactly 1 input and 1 output. "
"However, it had %d input(s) and %d output(s). Please adjust, "
"or use a complex filtergraph (-filter_complex) instead.\n",
- graph_desc, fg->nb_inputs, fg->nb_outputs);
+ *graph_desc, fg->nb_inputs, fg->nb_outputs);
return AVERROR(EINVAL);
}
if (fg->outputs[0]->type != type) {
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index be1dbad479..bcbbee9126 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1003,7 +1003,7 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter,
ost->filter = ofilter;
ret = ofilter_bind_enc(ofilter, ms->sch_idx_enc, &opts);
} else {
- ret = fg_create_simple(&ost->fg_simple, ost->ist, filters,
+ ret = fg_create_simple(&ost->fg_simple, ost->ist, &filters,
mux->sch, ms->sch_idx_enc, &opts);
if (ret >= 0)
ost->filter = ost->fg_simple->outputs[0];
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f51523d2e0..80bb9236af 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1496,7 +1496,7 @@ int ffmpeg_parse_options(int argc, char **argv, Scheduler *sch)
/* create complex filtergraphs */
for (int i = 0; i < go.nb_filtergraphs; i++) {
- ret = fg_create(NULL, go.filtergraphs[i], sch, NULL);
+ ret = fg_create(NULL, &go.filtergraphs[i], sch, NULL);
go.filtergraphs[i] = NULL;
if (ret < 0)
goto fail;
-----------------------------------------------------------------------
Summary of changes:
fftools/ffmpeg.h | 6 +++---
fftools/ffmpeg_demux.c | 13 +++++++++----
fftools/ffmpeg_filter.c | 14 ++++++++------
fftools/ffmpeg_mux_init.c | 2 +-
fftools/ffmpeg_opt.c | 2 +-
libavutil/csp.c | 2 +-
6 files changed, 23 insertions(+), 16 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. 9c266084fe avcodec/vc1_parser: stop splitting ENDOFSEQ markers into separate packets
by ffmpeg-git@ffmpeg.org 01 Nov '25
by ffmpeg-git@ffmpeg.org 01 Nov '25
01 Nov '25
The branch, master has been updated
via 9c266084fe735752dffdd77d4e791d7b80ac55d0 (commit)
via 9ab6a94195f584b0400819f8fe790afe71611076 (commit)
from fc2c030fb2b24582730ccf0e81631b297408fb94 (commit)
- Log -----------------------------------------------------------------
commit 9c266084fe735752dffdd77d4e791d7b80ac55d0
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Wed Oct 29 12:47:11 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Sat Nov 1 12:23:19 2025 -0300
avcodec/vc1_parser: stop splitting ENDOFSEQ markers into separate packets
The decode API can handle outputting delayed frames without relying on the
parser splitting off the ENDOFSEQ marker.
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index 124a7a771f..05094d782f 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -216,7 +216,8 @@ static int vc1_parse(AVCodecParserContext *s,
if (!pic_found && (b == (VC1_CODE_FRAME & 0xFF) || b == (VC1_CODE_FIELD & 0xFF))) {
pic_found = 1;
}
- else if (pic_found && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)) {
+ else if (pic_found && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)
+ && b != (VC1_CODE_ENDOFSEQ & 0xFF)) {
next = i - 4;
pic_found = b == (VC1_CODE_FRAME & 0xFF);
break;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 2618016a83..d6e0724326 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
#include "version_major.h"
#define LIBAVCODEC_VERSION_MINOR 17
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
commit 9ab6a94195f584b0400819f8fe790afe71611076
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Wed Oct 29 12:17:56 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Sat Nov 1 12:22:49 2025 -0300
avcodec/vc1dec: look for ENDOFSEQ markers at the end of a packet's payload
This is in preparation for the parser no longer splitting them into their own
packets.
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 1925384ba5..6caa418134 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -832,8 +832,11 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict,
if(s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
s->low_delay = 1;
+ if (buf_size >= 4 && AV_RB32(&buf[buf_size-4]) == VC1_CODE_ENDOFSEQ)
+ buf_size -= 4;
+
/* no supplementary picture */
- if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) {
+ if (buf_size == 0) {
/* special case for last picture */
if (s->low_delay == 0 && s->next_pic.ptr) {
if ((ret = av_frame_ref(pict, s->next_pic.ptr->f)) < 0)
-----------------------------------------------------------------------
Summary of changes:
libavcodec/vc1_parser.c | 3 ++-
libavcodec/vc1dec.c | 5 ++++-
libavcodec/version.h | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. fc2c030fb2 avcodec/vc1dec: Deduplicate cleanup code
by ffmpeg-git@ffmpeg.org 01 Nov '25
by ffmpeg-git@ffmpeg.org 01 Nov '25
01 Nov '25
The branch, master has been updated
via fc2c030fb2b24582730ccf0e81631b297408fb94 (commit)
via a44f7b6c4fb7d8357adc6a0326339db2793a0b56 (commit)
from b91081274f5a5b5f0f1ce820331f702378a425e8 (commit)
- Log -----------------------------------------------------------------
commit fc2c030fb2b24582730ccf0e81631b297408fb94
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Wed Oct 29 15:59:17 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 15:47:45 2025 +0100
avcodec/vc1dec: Deduplicate cleanup code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 35d8c68f45..1925384ba5 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1366,12 +1366,7 @@ image:
}
end:
- av_free(buf2);
- for (i = 0; i < n_slices; i++)
- av_free(slices[i].buf);
- av_free(slices);
- return buf_size;
-
+ ret = buf_size;
err:
av_free(buf2);
for (i = 0; i < n_slices; i++)
commit a44f7b6c4fb7d8357adc6a0326339db2793a0b56
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Wed Oct 29 15:47:47 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 15:47:45 2025 +0100
avcodec/vc1dec: Don't initialize write-only intra_scantable
VC-1 does not use it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 55225baec9..35d8c68f45 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -468,9 +468,6 @@ av_cold int ff_vc1_decode_init(AVCodecContext *avctx)
if (ret < 0)
return ret;
- ff_permute_scantable(s->intra_scantable.permutated, ff_wmv1_scantable[1],
- s->idsp.idct_permutation);
-
ret = vc1_decode_init_alloc_tables(v);
if (ret < 0) {
vc1_decode_reset(avctx);
-----------------------------------------------------------------------
Summary of changes:
libavcodec/vc1dec.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. b91081274f avcodec/x86/h264_qpel: Add and use ff_{avg,put}_pixels16x16_l2_sse2()
by ffmpeg-git@ffmpeg.org 01 Nov '25
by ffmpeg-git@ffmpeg.org 01 Nov '25
01 Nov '25
The branch, master has been updated
via b91081274f5a5b5f0f1ce820331f702378a425e8 (commit)
via 529a048c314d63741f3dd1e9ffbf77c5a68d2d0e (commit)
via 5715eb1274a99ae272fa8c6c2acf4ed4d9f776f6 (commit)
from b03b45cf22184bd2a94ac7b7fdea8eb8f1620d83 (commit)
- Log -----------------------------------------------------------------
commit b91081274f5a5b5f0f1ce820331f702378a425e8
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Wed Oct 29 15:07:40 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 15:17:05 2025 +0100
avcodec/x86/h264_qpel: Add and use ff_{avg,put}_pixels16x16_l2_sse2()
This avoids mmx (the size 16 h264qpel dsp now no longer uses any mmx)
and improves performance, particularly for the avg case:
Old benchmarks:
avg_h264_qpel_16_mc01_8_c: 780.0 ( 1.00x)
avg_h264_qpel_16_mc01_8_sse2: 91.2 ( 8.55x)
avg_h264_qpel_16_mc03_8_c: 804.0 ( 1.00x)
avg_h264_qpel_16_mc03_8_sse2: 91.2 ( 8.82x)
put_h264_qpel_16_mc01_8_c: 779.5 ( 1.00x)
put_h264_qpel_16_mc01_8_sse2: 82.8 ( 9.41x)
put_h264_qpel_16_mc03_8_c: 770.1 ( 1.00x)
put_h264_qpel_16_mc03_8_sse2: 82.5 ( 9.33x)
New benchmarks:
avg_h264_qpel_16_mc01_8_c: 783.9 ( 1.00x)
avg_h264_qpel_16_mc01_8_sse2: 84.1 ( 9.32x)
avg_h264_qpel_16_mc03_8_c: 797.4 ( 1.00x)
avg_h264_qpel_16_mc03_8_sse2: 83.9 ( 9.51x)
put_h264_qpel_16_mc01_8_c: 767.4 ( 1.00x)
put_h264_qpel_16_mc01_8_sse2: 80.5 ( 9.53x)
put_h264_qpel_16_mc03_8_c: 779.9 ( 1.00x)
put_h264_qpel_16_mc03_8_sse2: 80.3 ( 9.71x)
(qpeldsp will use these functions when it gets ported to SSE2;
then the mmxext functions will be removed as well.)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c
index b17ee7e02d..f2bcca1e11 100644
--- a/libavcodec/x86/h264_qpel.c
+++ b/libavcodec/x86/h264_qpel.c
@@ -42,8 +42,6 @@ void ff_avg_pixels4x4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t
ff_avg_pixels4x4_l2_mmxext((dst), (src1), (src2), (dststride))
#define ff_put_pixels8x8_l2_sse2 ff_put_pixels8x8_l2_mmxext
#define ff_avg_pixels8x8_l2_sse2 ff_avg_pixels8x8_l2_mmxext
-#define ff_put_pixels16x16_l2_sse2 ff_put_pixels16x16_l2_mmxext
-#define ff_avg_pixels16x16_l2_sse2 ff_avg_pixels16x16_l2_mmxext
#define DEF_QPEL(OPNAME)\
void ff_ ## OPNAME ## _h264_qpel4_h_lowpass_mmxext(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride);\
diff --git a/libavcodec/x86/qpel.asm b/libavcodec/x86/qpel.asm
index be8bc4f579..8f18cf93db 100644
--- a/libavcodec/x86/qpel.asm
+++ b/libavcodec/x86/qpel.asm
@@ -34,53 +34,58 @@ SECTION .text
mova %2, %1
%endmacro
-%macro PIXELS8_L2 1
+%macro PIXELS_L2 2-3 ; avg vs put, size, size+1
%define OP op_%1
%ifidn %1, put
+%if notcpuflag(sse2) ; SSE2 currently only uses 16x16
; void ff_put_pixels8x9_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride)
-cglobal put_pixels8x9_l2, 5,6
- mova m0, [r1]
- mova m1, [r2]
+cglobal put_pixels%2x%3_l2, 5,6,2
+ movu m0, [r1]
+ pavgb m0, [r2]
add r1, r4
- add r2, 8
- pavgb m0, m1
+ add r2, mmsize
OP m0, [r0]
add r0, r3
; FIXME: avoid jump if prologue is empty
- jmp %1_pixels8x8_after_prologue_ %+ cpuname
+ jmp %1_pixels%2x%2_after_prologue_ %+ cpuname
+%endif
%endif
; void ff_avg/put_pixels8x8_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride)
-cglobal %1_pixels8x8_l2, 5,6
-%1_pixels8x8_after_prologue_ %+ cpuname:
- mov r5d, 8
+cglobal %1_pixels%2x%2_l2, 5,6,2
+%1_pixels%2x%2_after_prologue_ %+ cpuname:
+ mov r5d, %2
.loop:
- mova m0, [r1]
- mova m1, [r1+r4]
+ movu m0, [r1]
+ movu m1, [r1+r4]
lea r1, [r1+2*r4]
pavgb m0, [r2]
- pavgb m1, [r2+8]
+ pavgb m1, [r2+mmsize]
OP m0, [r0]
OP m1, [r0+r3]
lea r0, [r0+2*r3]
- mova m0, [r1]
- mova m1, [r1+r4]
+ movu m0, [r1]
+ movu m1, [r1+r4]
lea r1, [r1+2*r4]
- pavgb m0, [r2+16]
- pavgb m1, [r2+24]
+ pavgb m0, [r2+2*mmsize]
+ pavgb m1, [r2+3*mmsize]
OP m0, [r0]
OP m1, [r0+r3]
lea r0, [r0+2*r3]
- add r2, 32
+ add r2, 4*mmsize
sub r5d, 4
jne .loop
RET
%endmacro
INIT_MMX mmxext
-PIXELS8_L2 put
-PIXELS8_L2 avg
+PIXELS_L2 put, 8, 9
+PIXELS_L2 avg, 8
+
+INIT_XMM sse2
+PIXELS_L2 put, 16, 17
+PIXELS_L2 avg, 16
%macro PIXELS16_L2 1
%define OP op_%1
diff --git a/libavcodec/x86/qpel.h b/libavcodec/x86/qpel.h
index c4b6ee0413..61c0473331 100644
--- a/libavcodec/x86/qpel.h
+++ b/libavcodec/x86/qpel.h
@@ -31,8 +31,14 @@ void ff_avg_pixels8x8_l2_mmxext(uint8_t *dst,
void ff_put_pixels16x16_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
+void ff_put_pixels16x16_l2_sse2(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_avg_pixels16x16_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
+void ff_avg_pixels16x16_l2_sse2(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
#endif /* AVCODEC_X86_QPEL_H */
commit 529a048c314d63741f3dd1e9ffbf77c5a68d2d0e
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Wed Oct 29 14:37:20 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 15:17:05 2025 +0100
avcodec/x86/qpel: Add specializations for put_l2 functions
These functions are currently always called with height either
being equal to the block size or block size+1. height is
a compile-time constant at every callsite. This makes it possible
to split this function into two to avoid the check inside
the function for whether height is odd or even.
The corresponding avg function is only used with height == block size,
so that it does not have a height parameter at all. Removing the
parameter from the put_l2 functions as well therefore simplifies
the C code.
The new functions increase the size of .text from qpel{dsp}.o
by 32B here, yet they save 464B of C code here.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c
index 30851e266e..b17ee7e02d 100644
--- a/libavcodec/x86/h264_qpel.c
+++ b/libavcodec/x86/h264_qpel.c
@@ -32,20 +32,18 @@
#if HAVE_X86ASM
void ff_avg_pixels4_mmxext(uint8_t *dst, const uint8_t *src, ptrdiff_t stride);
-void ff_put_pixels4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t stride);
-void ff_avg_pixels4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t stride);
-#define ff_put_pixels4_l2_mmxext(dst, src1, src2, dststride, src1stride, h) \
- ff_put_pixels4_l2_mmxext((dst), (src1), (src2), (dststride))
-#define ff_avg_pixels4_l2_mmxext(dst, src1, src2, dststride, src1stride, h) \
- ff_avg_pixels4_l2_mmxext((dst), (src1), (src2), (dststride))
-#define ff_put_pixels8_l2_sse2 ff_put_pixels8_l2_mmxext
-#define ff_avg_pixels8_l2_sse2(dst, src1, src2, dststride, src1stride, h) \
- ff_avg_pixels8_l2_mmxext((dst), (src1), (src2), (dststride), (src1stride))
-#define ff_put_pixels16_l2_sse2 ff_put_pixels16_l2_mmxext
-#define ff_avg_pixels16_l2_sse2(dst, src1, src2, dststride, src1stride, h) \
- ff_avg_pixels16_l2_mmxext((dst), (src1), (src2), (dststride), (src1stride))
+void ff_put_pixels4x4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t stride);
+void ff_avg_pixels4x4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t stride);
+#define ff_put_pixels4x4_l2_mmxext(dst, src1, src2, dststride, src1stride) \
+ ff_put_pixels4x4_l2_mmxext((dst), (src1), (src2), (dststride))
+#define ff_avg_pixels4x4_l2_mmxext(dst, src1, src2, dststride, src1stride) \
+ ff_avg_pixels4x4_l2_mmxext((dst), (src1), (src2), (dststride))
+#define ff_put_pixels8x8_l2_sse2 ff_put_pixels8x8_l2_mmxext
+#define ff_avg_pixels8x8_l2_sse2 ff_avg_pixels8x8_l2_mmxext
+#define ff_put_pixels16x16_l2_sse2 ff_put_pixels16x16_l2_mmxext
+#define ff_avg_pixels16x16_l2_sse2 ff_avg_pixels16x16_l2_mmxext
#define DEF_QPEL(OPNAME)\
void ff_ ## OPNAME ## _h264_qpel4_h_lowpass_mmxext(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride);\
@@ -177,7 +175,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, const uin
{\
LOCAL_ALIGNED(ALIGN, uint8_t, temp, [SIZE*SIZE]);\
ff_put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
- ff_ ## OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, temp, stride, stride, SIZE);\
+ ff_ ## OPNAME ## pixels ## SIZE ## x ## SIZE ## _l2_ ## MMX(dst, src, temp, stride, stride);\
}\
\
static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
@@ -189,7 +187,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, const uin
{\
LOCAL_ALIGNED(ALIGN, uint8_t, temp, [SIZE*SIZE]);\
ff_put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
- ff_ ## OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+stride, temp, stride, stride, SIZE);\
+ ff_ ## OPNAME ## pixels ## SIZE ## x ## SIZE ## _l2_ ## MMX(dst, src+stride, temp, stride, stride);\
}\
#define H264_MC_HV(OPNAME, SIZE, MMX, ALIGN, SHIFT5_EXT) \
diff --git a/libavcodec/x86/h264_qpel_8bit.asm b/libavcodec/x86/h264_qpel_8bit.asm
index 6e082819ac..3aa1f233a0 100644
--- a/libavcodec/x86/h264_qpel_8bit.asm
+++ b/libavcodec/x86/h264_qpel_8bit.asm
@@ -69,11 +69,11 @@ cglobal avg_pixels4, 3,4
mova %2, %1
%endmacro
-; void ff_put/avg_pixels4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
-; ptrdiff_t stride)
+; void ff_put/avg_pixels4x4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+; ptrdiff_t stride)
%macro PIXELS4_L2 1
%define OP op_%1h
-cglobal %1_pixels4_l2, 4,4
+cglobal %1_pixels4x4_l2, 4,4
mova m0, [r1]
mova m1, [r1+r3]
lea r1, [r1+2*r3]
diff --git a/libavcodec/x86/qpel.asm b/libavcodec/x86/qpel.asm
index 93f0d007c3..be8bc4f579 100644
--- a/libavcodec/x86/qpel.asm
+++ b/libavcodec/x86/qpel.asm
@@ -37,11 +37,9 @@ SECTION .text
%macro PIXELS8_L2 1
%define OP op_%1
%ifidn %1, put
-; void ff_put_pixels8_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
-; ptrdiff_t dstStride, ptrdiff_t src1Stride, int h)
-cglobal put_pixels8_l2, 6,6
- test r5d, 1
- je .loop
+; void ff_put_pixels8x9_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+; ptrdiff_t dstStride, ptrdiff_t src1Stride)
+cglobal put_pixels8x9_l2, 5,6
mova m0, [r1]
mova m1, [r2]
add r1, r4
@@ -49,13 +47,14 @@ cglobal put_pixels8_l2, 6,6
pavgb m0, m1
OP m0, [r0]
add r0, r3
- dec r5d
-%else
-; void ff_avg_pixels8_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
-; ptrdiff_t dstStride, ptrdiff_t src1Stride)
-cglobal avg_pixels8_l2, 5,6
- mov r5d, 8
+ ; FIXME: avoid jump if prologue is empty
+ jmp %1_pixels8x8_after_prologue_ %+ cpuname
%endif
+; void ff_avg/put_pixels8x8_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+; ptrdiff_t dstStride, ptrdiff_t src1Stride)
+cglobal %1_pixels8x8_l2, 5,6
+%1_pixels8x8_after_prologue_ %+ cpuname:
+ mov r5d, 8
.loop:
mova m0, [r1]
mova m1, [r1+r4]
@@ -86,11 +85,9 @@ PIXELS8_L2 avg
%macro PIXELS16_L2 1
%define OP op_%1
%ifidn %1, put
-; void ff_put_pixels16_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
-; ptrdiff_t dstStride, ptrdiff_t src1Stride, int h)
-cglobal put_pixels16_l2, 6,6
- test r5d, 1
- je .loop
+; void ff_put_pixels16x17_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+; ptrdiff_t dstStride, ptrdiff_t src1Stride)
+cglobal put_pixels16x17_l2, 5,6
mova m0, [r1]
mova m1, [r1+8]
pavgb m0, [r2]
@@ -100,13 +97,14 @@ cglobal put_pixels16_l2, 6,6
OP m0, [r0]
OP m1, [r0+8]
add r0, r3
- dec r5d
-%else
-; void ff_avg_pixels16_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
-; ptrdiff_t dstStride, ptrdiff_t src1Stride)
-cglobal avg_pixels16_l2, 5,6
- mov r5d, 16
+ ; FIXME: avoid jump if prologue is empty
+ jmp %1_pixels16x16_after_prologue_ %+ cpuname
%endif
+; void ff_avg/put_pixels16x16_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+; ptrdiff_t dstStride, ptrdiff_t src1Stride)
+cglobal %1_pixels16x16_l2, 5,6
+%1_pixels16x16_after_prologue_ %+ cpuname:
+ mov r5d, 16
.loop:
mova m0, [r1]
mova m1, [r1+8]
diff --git a/libavcodec/x86/qpel.h b/libavcodec/x86/qpel.h
index b30d5e23dc..c4b6ee0413 100644
--- a/libavcodec/x86/qpel.h
+++ b/libavcodec/x86/qpel.h
@@ -22,17 +22,17 @@
#include <stddef.h>
#include <stdint.h>
-void ff_put_pixels8_l2_mmxext(uint8_t *dst,
- const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
-void ff_avg_pixels8_l2_mmxext(uint8_t *dst,
- const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride);
-void ff_put_pixels16_l2_mmxext(uint8_t *dst,
- const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
-void ff_avg_pixels16_l2_mmxext(uint8_t *dst,
- const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride);
+void ff_put_pixels8x8_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
+void ff_avg_pixels8x8_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
+void ff_put_pixels16x16_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
+void ff_avg_pixels16x16_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
#endif /* AVCODEC_X86_QPEL_H */
diff --git a/libavcodec/x86/qpeldsp.asm b/libavcodec/x86/qpeldsp.asm
index 7fa7dbd2dc..52ddd8a8b2 100644
--- a/libavcodec/x86/qpeldsp.asm
+++ b/libavcodec/x86/qpeldsp.asm
@@ -32,13 +32,11 @@ cextern pw_20
SECTION .text
-; void ff_put_no_rnd_pixels8_l2(uint8_t *dst, uint8_t *src1, uint8_t *src2,
-; ptrdiff_t dstStride, ptrdiff_t src1Stride, int h)
%macro PUT_NO_RND_PIXELS8_L2 0
-cglobal put_no_rnd_pixels8_l2, 6,6
+; void ff_put_no_rnd_pixels8x9_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+; ptrdiff_t dstStride, ptrdiff_t src1Stride)
+cglobal put_no_rnd_pixels8x9_l2, 5,6
pcmpeqb m6, m6
- test r5d, 1
- je .loop
mova m0, [r1]
mova m1, [r2]
add r1, r4
@@ -49,7 +47,14 @@ cglobal put_no_rnd_pixels8_l2, 6,6
pxor m0, m6
mova [r0], m0
add r0, r3
- dec r5d
+ jmp put_no_rnd_pixels8x8_after_prologue_ %+ cpuname
+
+; void ff_put_no_rnd_pixels8x8_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+; ptrdiff_t dstStride, ptrdiff_t src1Stride)
+cglobal put_no_rnd_pixels8x8_l2, 5,6
+ pcmpeqb m6, m6
+put_no_rnd_pixels8x8_after_prologue_ %+ cpuname:
+ mov r5d, 8
.loop:
mova m0, [r1]
add r1, r4
@@ -97,13 +102,11 @@ INIT_MMX mmxext
PUT_NO_RND_PIXELS8_L2
-; void ff_put_no_rnd_pixels16_l2(uint8_t *dst, uint8_t *src1, uint8_t *src2,
-; ptrdiff_t dstStride, ptrdiff_t src1Stride, int h)
+; void ff_put_no_rnd_pixels16x17_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+; ptrdiff_t dstStride, ptrdiff_t src1Stride)
%macro PUT_NO_RND_PIXELS16_l2 0
-cglobal put_no_rnd_pixels16_l2, 6,6
+cglobal put_no_rnd_pixels16x17_l2, 5,6
pcmpeqb m6, m6
- test r5d, 1
- je .loop
mova m0, [r1]
mova m1, [r1+8]
mova m2, [r2]
@@ -121,7 +124,14 @@ cglobal put_no_rnd_pixels16_l2, 6,6
mova [r0], m0
mova [r0+8], m1
add r0, r3
- dec r5d
+ jmp put_no_rnd_pixels16x16_after_prologue_ %+ cpuname
+
+; void ff_put_no_rnd_pixels16x16_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+; ptrdiff_t dstStride, ptrdiff_t src1Stride)
+cglobal put_no_rnd_pixels16x16_l2, 5,6
+ pcmpeqb m6, m6
+put_no_rnd_pixels16x16_after_prologue_ %+ cpuname:
+ mov r5d, 16
.loop:
mova m0, [r1]
mova m1, [r1+8]
diff --git a/libavcodec/x86/qpeldsp_init.c b/libavcodec/x86/qpeldsp_init.c
index f88c804a48..cab2ac433a 100644
--- a/libavcodec/x86/qpeldsp_init.c
+++ b/libavcodec/x86/qpeldsp_init.c
@@ -31,12 +31,24 @@
#include "fpel.h"
#include "qpel.h"
-void ff_put_no_rnd_pixels8_l2_mmxext(uint8_t *dst,
- const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
-void ff_put_no_rnd_pixels16_l2_mmxext(uint8_t *dst,
- const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
+void ff_put_pixels8x9_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
+void ff_put_pixels16x17_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
+void ff_put_no_rnd_pixels8x8_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
+void ff_put_no_rnd_pixels8x9_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
+void ff_put_no_rnd_pixels16x16_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
+void ff_put_no_rnd_pixels16x17_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_mpeg4_qpel16_h_lowpass_mmxext(uint8_t *dst, const uint8_t *src,
ptrdiff_t dstStride, ptrdiff_t srcStride, int h);
void ff_avg_mpeg4_qpel16_h_lowpass_mmxext(uint8_t *dst, const uint8_t *src,
@@ -70,7 +82,7 @@ void ff_put_no_rnd_mpeg4_qpel8_v_lowpass_mmxext(uint8_t *dst,
#if HAVE_X86ASM
-#define QPEL_OP(OPNAME, RND, MMX, ARG) \
+#define QPEL_OP(OPNAME, RND, MMX) \
static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, \
const uint8_t *src, \
ptrdiff_t stride) \
@@ -79,8 +91,8 @@ static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, \
stride, 8); \
- ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, src, half, \
- stride, stride, 8)); \
+ ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, src, half, \
+ stride, stride); \
} \
\
static void OPNAME ## qpel8_mc20_ ## MMX(uint8_t *dst, \
@@ -99,8 +111,8 @@ static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, \
stride, 8); \
- ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, src + 1, half, \
- stride, stride, 8)); \
+ ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, src + 1, half, \
+ stride, stride); \
} \
\
static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, \
@@ -111,8 +123,8 @@ static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, \
8, stride); \
- ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, src, half, \
- stride, stride, 8)); \
+ ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, src, half, \
+ stride, stride); \
} \
\
static void OPNAME ## qpel8_mc02_ ## MMX(uint8_t *dst, \
@@ -131,8 +143,8 @@ static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, \
8, stride); \
- ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, src + stride, half, \
- stride, stride, 8)); \
+ ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, src + stride, half, \
+ stride, stride); \
} \
\
static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, \
@@ -144,11 +156,11 @@ static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
- ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, \
- stride, 9); \
+ ff_put ## RND ## pixels8x9_l2_ ## MMX(halfH, src, halfH, 8, \
+ stride); \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
- ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, halfH, halfHV, \
- stride, 8, 8)); \
+ ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, halfH, halfHV, \
+ stride, 8); \
} \
\
static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, \
@@ -160,11 +172,11 @@ static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
- ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src + 1, halfH, 8, \
- stride, 9); \
+ ff_put ## RND ## pixels8x9_l2_ ## MMX(halfH, src + 1, halfH, 8, \
+ stride); \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
- ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, halfH, halfHV, \
- stride, 8, 8)); \
+ ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, halfH, halfHV, \
+ stride, 8); \
} \
\
static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, \
@@ -176,11 +188,11 @@ static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
- ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, \
- stride, 9); \
+ ff_put ## RND ## pixels8x9_l2_ ## MMX(halfH, src, halfH, 8, \
+ stride); \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
- ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, halfH + 8, halfHV, \
- stride, 8, 8)); \
+ ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, halfH + 8, halfHV, \
+ stride, 8); \
} \
\
static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, \
@@ -192,11 +204,11 @@ static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
- ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src + 1, halfH, 8, \
- stride, 9); \
+ ff_put ## RND ## pixels8x9_l2_ ## MMX(halfH, src + 1, halfH, 8, \
+ stride); \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
- ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, halfH + 8, halfHV, \
- stride, 8, 8)); \
+ ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, halfH + 8, halfHV, \
+ stride, 8); \
} \
\
static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, \
@@ -209,8 +221,8 @@ static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
- ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, halfH, halfHV, \
- stride, 8, 8)); \
+ ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, halfH, halfHV, \
+ stride, 8); \
} \
\
static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, \
@@ -223,8 +235,8 @@ static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
- ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, halfH + 8, halfHV, \
- stride, 8, 8)); \
+ ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, halfH + 8, halfHV, \
+ stride, 8); \
} \
\
static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, \
@@ -235,8 +247,8 @@ static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, \
uint8_t *const halfH = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
- ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, \
- 8, stride, 9); \
+ ff_put ## RND ## pixels8x9_l2_ ## MMX(halfH, src, halfH, \
+ 8, stride); \
ff_ ## OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, \
stride, 8); \
} \
@@ -249,8 +261,8 @@ static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, \
uint8_t *const halfH = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
- ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src + 1, halfH, 8, \
- stride, 9); \
+ ff_put ## RND ## pixels8x9_l2_ ## MMX(halfH, src + 1, halfH, 8, \
+ stride); \
ff_ ## OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, \
stride, 8); \
} \
@@ -275,8 +287,8 @@ static void OPNAME ## qpel16_mc10_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, \
stride, 16); \
- ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, src, half, \
- stride, stride, 16)); \
+ ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, src, half, \
+ stride, stride); \
} \
\
static void OPNAME ## qpel16_mc20_ ## MMX(uint8_t *dst, \
@@ -295,8 +307,8 @@ static void OPNAME ## qpel16_mc30_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t*) temp; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, \
stride, 16); \
- ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, src + 1, half, \
- stride, stride, 16)); \
+ ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, src + 1, half, \
+ stride, stride); \
} \
\
static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, \
@@ -307,8 +319,8 @@ static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, \
stride); \
- ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, src, half, \
- stride, stride, 16)); \
+ ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, src, half, \
+ stride, stride); \
} \
\
static void OPNAME ## qpel16_mc02_ ## MMX(uint8_t *dst, \
@@ -327,8 +339,8 @@ static void OPNAME ## qpel16_mc03_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, \
stride); \
- ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, src+stride, half, \
- stride, stride, 16)); \
+ ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, src+stride, half, \
+ stride, stride); \
} \
\
static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, \
@@ -340,12 +352,12 @@ static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
stride, 17); \
- ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, \
- stride, 17); \
+ ff_put ## RND ## pixels16x17_l2_ ## MMX(halfH, src, halfH, 16, \
+ stride); \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
16, 16); \
- ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, halfH, halfHV, \
- stride, 16, 16)); \
+ ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, halfH, halfHV, \
+ stride, 16); \
} \
\
static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, \
@@ -357,12 +369,12 @@ static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
stride, 17); \
- ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src + 1, halfH, 16, \
- stride, 17); \
+ ff_put ## RND ## pixels16x17_l2_ ## MMX(halfH, src + 1, halfH, 16, \
+ stride); \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
16, 16); \
- ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, halfH, halfHV, \
- stride, 16, 16)); \
+ ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, halfH, halfHV, \
+ stride, 16); \
} \
\
static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, \
@@ -374,12 +386,12 @@ static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
stride, 17); \
- ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, \
- stride, 17); \
+ ff_put ## RND ## pixels16x17_l2_ ## MMX(halfH, src, halfH, 16, \
+ stride); \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
16, 16); \
- ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, halfH + 16, halfHV, \
- stride, 16, 16)); \
+ ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, halfH + 16, halfHV, \
+ stride, 16); \
} \
\
static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, \
@@ -391,12 +403,12 @@ static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
stride, 17); \
- ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src + 1, halfH, 16, \
- stride, 17); \
+ ff_put ## RND ## pixels16x17_l2_ ## MMX(halfH, src + 1, halfH, 16, \
+ stride); \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
16, 16); \
- ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, halfH + 16, halfHV, \
- stride, 16, 16)); \
+ ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, halfH + 16, halfHV, \
+ stride, 16); \
} \
\
static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, \
@@ -410,8 +422,8 @@ static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, \
stride, 17); \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
16, 16); \
- ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, halfH, halfHV, \
- stride, 16, 16)); \
+ ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, halfH, halfHV, \
+ stride, 16); \
} \
\
static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, \
@@ -425,8 +437,8 @@ static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, \
stride, 17); \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
16, 16); \
- ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, halfH + 16, halfHV, \
- stride, 16, 16)); \
+ ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, halfH + 16, halfHV, \
+ stride, 16); \
} \
\
static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, \
@@ -437,8 +449,8 @@ static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, \
uint8_t *const halfH = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
stride, 17); \
- ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, \
- stride, 17); \
+ ff_put ## RND ## pixels16x17_l2_ ## MMX(halfH, src, halfH, 16, \
+ stride); \
ff_ ## OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, \
stride, 16); \
} \
@@ -451,8 +463,8 @@ static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, \
uint8_t *const halfH = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
stride, 17); \
- ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src + 1, halfH, 16, \
- stride, 17); \
+ ff_put ## RND ## pixels16x17_l2_ ## MMX(halfH, src + 1, halfH, 16, \
+ stride); \
ff_ ## OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, \
stride, 16); \
} \
@@ -469,13 +481,9 @@ static void OPNAME ## qpel16_mc22_ ## MMX(uint8_t *dst, \
stride, 16); \
}
-#define PASSTHROUGH(...) __VA_ARGS__
-#define STRIP_HEIGHT(dst, src1, src2, dststride, srcstride, height) \
- (dst), (src1), (src2), (dststride), (srcstride)
-
-QPEL_OP(put_, _, mmxext, PASSTHROUGH)
-QPEL_OP(avg_, _, mmxext, STRIP_HEIGHT)
-QPEL_OP(put_no_rnd_, _no_rnd_, mmxext, PASSTHROUGH)
+QPEL_OP(put_, _, mmxext)
+QPEL_OP(avg_, _, mmxext)
+QPEL_OP(put_no_rnd_, _no_rnd_, mmxext)
#endif /* HAVE_X86ASM */
commit 5715eb1274a99ae272fa8c6c2acf4ed4d9f776f6
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Thu Oct 9 03:57:33 2025 +0200
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 15:17:05 2025 +0100
avcodec/x86/{h264_qpel,qpeldsp_init}: Move shared decls into header
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c
index 5d1445a8bb..30851e266e 100644
--- a/libavcodec/x86/h264_qpel.c
+++ b/libavcodec/x86/h264_qpel.c
@@ -28,6 +28,7 @@
#include "libavutil/x86/cpu.h"
#include "libavcodec/h264qpel.h"
#include "fpel.h"
+#include "qpel.h"
#if HAVE_X86ASM
void ff_avg_pixels4_mmxext(uint8_t *dst, const uint8_t *src, ptrdiff_t stride);
@@ -35,14 +36,6 @@ void ff_put_pixels4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *
ptrdiff_t stride);
void ff_avg_pixels4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
ptrdiff_t stride);
-void ff_put_pixels8_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
-void ff_avg_pixels8_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride);
-void ff_put_pixels16_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
-void ff_avg_pixels16_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride);
#define ff_put_pixels4_l2_mmxext(dst, src1, src2, dststride, src1stride, h) \
ff_put_pixels4_l2_mmxext((dst), (src1), (src2), (dststride))
#define ff_avg_pixels4_l2_mmxext(dst, src1, src2, dststride, src1stride, h) \
diff --git a/libavcodec/x86/qpel.h b/libavcodec/x86/qpel.h
new file mode 100644
index 0000000000..b30d5e23dc
--- /dev/null
+++ b/libavcodec/x86/qpel.h
@@ -0,0 +1,38 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_X86_QPEL_H
+#define AVCODEC_X86_QPEL_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+void ff_put_pixels8_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
+void ff_avg_pixels8_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
+void ff_put_pixels16_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
+void ff_avg_pixels16_l2_mmxext(uint8_t *dst,
+ const uint8_t *src1, const uint8_t *src2,
+ ptrdiff_t dstStride, ptrdiff_t src1Stride);
+
+#endif /* AVCODEC_X86_QPEL_H */
diff --git a/libavcodec/x86/qpeldsp_init.c b/libavcodec/x86/qpeldsp_init.c
index a1d1eb80b3..f88c804a48 100644
--- a/libavcodec/x86/qpeldsp_init.c
+++ b/libavcodec/x86/qpeldsp_init.c
@@ -27,25 +27,13 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/x86/cpu.h"
-#include "libavcodec/pixels.h"
#include "libavcodec/qpeldsp.h"
#include "fpel.h"
+#include "qpel.h"
-void ff_put_pixels8_l2_mmxext(uint8_t *dst,
- const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
void ff_put_no_rnd_pixels8_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
-void ff_avg_pixels8_l2_mmxext(uint8_t *dst,
- const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride);
-void ff_put_pixels16_l2_mmxext(uint8_t *dst,
- const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
-void ff_avg_pixels16_l2_mmxext(uint8_t *dst,
- const uint8_t *src1, const uint8_t *src2,
- ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_no_rnd_pixels16_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
-----------------------------------------------------------------------
Summary of changes:
libavcodec/x86/h264_qpel.c | 37 +++-----
libavcodec/x86/h264_qpel_8bit.asm | 6 +-
libavcodec/x86/qpel.asm | 77 +++++++++--------
libavcodec/x86/qpel.h | 44 ++++++++++
libavcodec/x86/qpeldsp.asm | 34 +++++---
libavcodec/x86/qpeldsp_init.c | 178 +++++++++++++++++++-------------------
6 files changed, 209 insertions(+), 167 deletions(-)
create mode 100644 libavcodec/x86/qpel.h
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. b03b45cf22 avcodec/x86/h264_chromamc: Remove MMX(EXT) funcs overridden by SSSE3
by ffmpeg-git@ffmpeg.org 01 Nov '25
by ffmpeg-git@ffmpeg.org 01 Nov '25
01 Nov '25
The branch, master has been updated
via b03b45cf22184bd2a94ac7b7fdea8eb8f1620d83 (commit)
via cb054ee89bcb9e4a035b86a42b6b3e5e6b78fec5 (commit)
via c607aae2b95b05bdc7066e3572737cb00a596e9f (commit)
via c6efe1abda600f15a87480d5bcc52a6df93983b8 (commit)
from e59d964a3c5a7b7dc2da511f0d51c65c5fba741d (commit)
- Log -----------------------------------------------------------------
commit b03b45cf22184bd2a94ac7b7fdea8eb8f1620d83
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Thu Oct 30 15:59:21 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 13:34:23 2025 +0100
avcodec/x86/h264_chromamc: Remove MMX(EXT) funcs overridden by SSSE3
SSSE3 is already quite old (introduced 2006 for Intel, 2011 for AMD),
so that the overwhelming majority of our users (particularly those
that actually update their FFmpeg) will be using the SSSE3 versions.
This commit therefore removes the MMX(EXT) functions overridden
by them (which don't abide by the ABI) to get closer to a removal
of emms_c.
Reviewed-by: Lynne <dev(a)lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/x86/h264_chromamc.asm b/libavcodec/x86/h264_chromamc.asm
index 8cdc0fe5a1..6a65d5cabd 100644
--- a/libavcodec/x86/h264_chromamc.asm
+++ b/libavcodec/x86/h264_chromamc.asm
@@ -25,39 +25,6 @@
SECTION_RODATA
-rnd_rv40_2d_tbl: times 4 dw 0
- times 4 dw 16
- times 4 dw 32
- times 4 dw 16
- times 4 dw 32
- times 4 dw 28
- times 4 dw 32
- times 4 dw 28
- times 4 dw 0
- times 4 dw 32
- times 4 dw 16
- times 4 dw 32
- times 4 dw 32
- times 4 dw 28
- times 4 dw 32
- times 4 dw 28
-rnd_rv40_1d_tbl: times 4 dw 0
- times 4 dw 2
- times 4 dw 4
- times 4 dw 2
- times 4 dw 4
- times 4 dw 3
- times 4 dw 4
- times 4 dw 3
- times 4 dw 0
- times 4 dw 4
- times 4 dw 2
- times 4 dw 4
- times 4 dw 4
- times 4 dw 3
- times 4 dw 4
- times 4 dw 3
-
cextern pw_3
cextern pw_4
cextern pw_8
@@ -92,285 +59,6 @@ SECTION .text
jne .next4rows
%endmacro
-%macro chroma_mc8_mmx_func 2-3
-%ifidn %2, rv40
-%if PIC
-%define rnd_1d_rv40 r8
-%define rnd_2d_rv40 r8
-%define extra_regs 2
-%else ; no-PIC
-%define rnd_1d_rv40 rnd_rv40_1d_tbl
-%define rnd_2d_rv40 rnd_rv40_2d_tbl
-%define extra_regs 1
-%endif ; PIC
-%else
-%define extra_regs 0
-%endif ; rv40
-; void ff_put/avg_h264_chroma_mc8_*(uint8_t *dst /* align 8 */,
-; const uint8_t *src /* align 1 */,
-; ptrdiff_t stride, int h, int mx, int my)
-cglobal %1_%2_chroma_mc8%3, 6, 7 + extra_regs, 0
- mov r6d, r5d
- or r6d, r4d
- jne .at_least_one_non_zero
- ; mx == 0 AND my == 0 - no filter needed
- mv0_pixels_mc8
- RET
-
-.at_least_one_non_zero:
-%ifidn %2, rv40
-%if ARCH_X86_64
- mov r7, r5
- and r7, 6 ; &~1 for mx/my=[0,7]
- lea r7, [r7*4+r4]
- sar r7d, 1
-%define rnd_bias r7
-%define dest_reg r0
-%else ; x86-32
- mov r0, r5
- and r0, 6 ; &~1 for mx/my=[0,7]
- lea r0, [r0*4+r4]
- sar r0d, 1
-%define rnd_bias r0
-%define dest_reg r5
-%endif
-%else ; vc1, h264
-%define rnd_bias 0
-%define dest_reg r0
-%endif
-
- test r5d, r5d
- mov r6, 1
- je .my_is_zero
- test r4d, r4d
- mov r6, r2 ; dxy = x ? 1 : stride
- jne .both_non_zero
-.my_is_zero:
- ; mx == 0 XOR my == 0 - 1 dimensional filter only
- or r4d, r5d ; x + y
-
-%ifidn %2, rv40
-%if PIC
- lea r8, [rnd_rv40_1d_tbl]
-%endif
-%if ARCH_X86_64 == 0
- mov r5, r0m
-%endif
-%endif
-
- movd m5, r4d
- movq m4, [pw_8]
- movq m6, [rnd_1d_%2+rnd_bias*8] ; mm6 = rnd >> 3
- punpcklwd m5, m5
- punpckldq m5, m5 ; mm5 = B = x
- pxor m7, m7
- psubw m4, m5 ; mm4 = A = 8-x
-
-.next1drow:
- movq m0, [r1 ] ; mm0 = src[0..7]
- movq m2, [r1+r6] ; mm1 = src[1..8]
-
- movq m1, m0
- movq m3, m2
- punpcklbw m0, m7
- punpckhbw m1, m7
- punpcklbw m2, m7
- punpckhbw m3, m7
- pmullw m0, m4 ; [mm0,mm1] = A * src[0..7]
- pmullw m1, m4
- pmullw m2, m5 ; [mm2,mm3] = B * src[1..8]
- pmullw m3, m5
-
- paddw m0, m6
- paddw m1, m6
- paddw m0, m2
- paddw m1, m3
- psrlw m0, 3
- psrlw m1, 3
- packuswb m0, m1
- CHROMAMC_AVG m0, [dest_reg]
- movq [dest_reg], m0 ; dst[0..7] = (A * src[0..7] + B * src[1..8] + (rnd >> 3)) >> 3
-
- add dest_reg, r2
- add r1, r2
- dec r3d
- jne .next1drow
- RET
-
-.both_non_zero: ; general case, bilinear
- movd m4, r4d ; x
- movd m6, r5d ; y
-%ifidn %2, rv40
-%if PIC
- lea r8, [rnd_rv40_2d_tbl]
-%endif
-%if ARCH_X86_64 == 0
- mov r5, r0m
-%endif
-%endif
- mov r6, rsp ; backup stack pointer
- and rsp, ~(mmsize-1) ; align stack
- sub rsp, 16 ; AA and DD
-
- punpcklwd m4, m4
- punpcklwd m6, m6
- punpckldq m4, m4 ; mm4 = x words
- punpckldq m6, m6 ; mm6 = y words
- movq m5, m4
- pmullw m4, m6 ; mm4 = x * y
- psllw m5, 3
- psllw m6, 3
- movq m7, m5
- paddw m7, m6
- movq [rsp+8], m4 ; DD = x * y
- psubw m5, m4 ; mm5 = B = 8x - xy
- psubw m6, m4 ; mm6 = C = 8y - xy
- paddw m4, [pw_64]
- psubw m4, m7 ; mm4 = A = xy - (8x+8y) + 64
- pxor m7, m7
- movq [rsp ], m4
-
- movq m0, [r1 ] ; mm0 = src[0..7]
- movq m1, [r1+1] ; mm1 = src[1..8]
-.next2drow:
- add r1, r2
-
- movq m2, m0
- movq m3, m1
- punpckhbw m0, m7
- punpcklbw m1, m7
- punpcklbw m2, m7
- punpckhbw m3, m7
- pmullw m0, [rsp]
- pmullw m2, [rsp]
- pmullw m1, m5
- pmullw m3, m5
- paddw m2, m1 ; mm2 = A * src[0..3] + B * src[1..4]
- paddw m3, m0 ; mm3 = A * src[4..7] + B * src[5..8]
-
- movq m0, [r1]
- movq m1, m0
- punpcklbw m0, m7
- punpckhbw m1, m7
- pmullw m0, m6
- pmullw m1, m6
- paddw m2, m0
- paddw m3, m1 ; [mm2,mm3] += C * src[0..7]
-
- movq m1, [r1+1]
- movq m0, m1
- movq m4, m1
- punpcklbw m0, m7
- punpckhbw m4, m7
- pmullw m0, [rsp+8]
- pmullw m4, [rsp+8]
- paddw m2, m0
- paddw m3, m4 ; [mm2,mm3] += D * src[1..8]
- movq m0, [r1]
-
- paddw m2, [rnd_2d_%2+rnd_bias*8]
- paddw m3, [rnd_2d_%2+rnd_bias*8]
- psrlw m2, 6
- psrlw m3, 6
- packuswb m2, m3
- CHROMAMC_AVG m2, [dest_reg]
- movq [dest_reg], m2 ; dst[0..7] = ([mm2,mm3] + rnd) >> 6
-
- add dest_reg, r2
- dec r3d
- jne .next2drow
- mov rsp, r6 ; restore stack pointer
- RET
-%endmacro
-
-%macro chroma_mc4_mmx_func 2
-%define extra_regs 0
-%ifidn %2, rv40
-%if PIC
-%define extra_regs 1
-%endif ; PIC
-%endif ; rv40
-cglobal %1_%2_chroma_mc4, 6, 6 + extra_regs, 0
- pxor m7, m7
- movd m2, r4d ; x
- movd m3, r5d ; y
- movq m4, [pw_8]
- movq m5, [pw_8]
- punpcklwd m2, m2
- punpcklwd m3, m3
- punpcklwd m2, m2
- punpcklwd m3, m3
- psubw m4, m2
- psubw m5, m3
-
-%ifidn %2, rv40
-%if PIC
- lea r6, [rnd_rv40_2d_tbl]
-%define rnd_2d_rv40 r6
-%else
-%define rnd_2d_rv40 rnd_rv40_2d_tbl
-%endif
- and r5, 6 ; &~1 for mx/my=[0,7]
- lea r5, [r5*4+r4]
- sar r5d, 1
-%define rnd_bias r5
-%else ; vc1, h264
-%define rnd_bias 0
-%endif
-
- movd m0, [r1 ]
- movd m6, [r1+1]
- add r1, r2
- punpcklbw m0, m7
- punpcklbw m6, m7
- pmullw m0, m4
- pmullw m6, m2
- paddw m6, m0
-
-.next2rows:
- movd m0, [r1 ]
- movd m1, [r1+1]
- add r1, r2
- punpcklbw m0, m7
- punpcklbw m1, m7
- pmullw m0, m4
- pmullw m1, m2
- paddw m1, m0
- movq m0, m1
-
- pmullw m6, m5
- pmullw m1, m3
- paddw m6, [rnd_2d_%2+rnd_bias*8]
- paddw m1, m6
- psrlw m1, 6
- packuswb m1, m1
- CHROMAMC_AVG4 m1, m6, [r0]
- movd [r0], m1
- add r0, r2
-
- movd m6, [r1 ]
- movd m1, [r1+1]
- add r1, r2
- punpcklbw m6, m7
- punpcklbw m1, m7
- pmullw m6, m4
- pmullw m1, m2
- paddw m1, m6
- movq m6, m1
- pmullw m0, m5
- pmullw m1, m3
- paddw m0, [rnd_2d_%2+rnd_bias*8]
- paddw m1, m0
- psrlw m1, 6
- packuswb m1, m1
- CHROMAMC_AVG4 m1, m0, [r0]
- movd [r0], m1
- add r0, r2
- sub r3d, 2
- jnz .next2rows
- RET
-%endmacro
-
%macro chroma_mc2_mmx_func 2
cglobal %1_%2_chroma_mc2, 6, 7, 0
mov r6d, r4d
@@ -428,25 +116,14 @@ cglobal %1_%2_chroma_mc2, 6, 7, 0
PAVGB %1, %2
%endmacro
-INIT_MMX mmx
-%define CHROMAMC_AVG NOTHING
-%define CHROMAMC_AVG4 NOTHING
-chroma_mc8_mmx_func put, h264, _rnd
-chroma_mc8_mmx_func put, vc1, _nornd
-chroma_mc8_mmx_func put, rv40
-chroma_mc4_mmx_func put, h264
-chroma_mc4_mmx_func put, rv40
INIT_MMX mmxext
+%define CHROMAMC_AVG NOTHING
+%define CHROMAMC_AVG4 NOTHING
chroma_mc2_mmx_func put, h264
%define CHROMAMC_AVG DIRECT_AVG
%define CHROMAMC_AVG4 COPY_AVG
-chroma_mc8_mmx_func avg, h264, _rnd
-chroma_mc8_mmx_func avg, vc1, _nornd
-chroma_mc8_mmx_func avg, rv40
-chroma_mc4_mmx_func avg, h264
-chroma_mc4_mmx_func avg, rv40
chroma_mc2_mmx_func avg, h264
%macro chroma_mc8_ssse3_func 2-3
diff --git a/libavcodec/x86/h264chroma_init.c b/libavcodec/x86/h264chroma_init.c
index 34934b6ad0..6eb52746ad 100644
--- a/libavcodec/x86/h264chroma_init.c
+++ b/libavcodec/x86/h264chroma_init.c
@@ -24,16 +24,6 @@
#include "libavutil/x86/cpu.h"
#include "libavcodec/h264chroma.h"
-void ff_put_h264_chroma_mc8_rnd_mmx (uint8_t *dst, const uint8_t *src,
- ptrdiff_t stride, int h, int x, int y);
-void ff_avg_h264_chroma_mc8_rnd_mmxext(uint8_t *dst, const uint8_t *src,
- ptrdiff_t stride, int h, int x, int y);
-
-void ff_put_h264_chroma_mc4_mmx (uint8_t *dst, const uint8_t *src,
- ptrdiff_t stride, int h, int x, int y);
-void ff_avg_h264_chroma_mc4_mmxext (uint8_t *dst, const uint8_t *src,
- ptrdiff_t stride, int h, int x, int y);
-
void ff_put_h264_chroma_mc2_mmxext (uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_avg_h264_chroma_mc2_mmxext (uint8_t *dst, const uint8_t *src,
@@ -68,14 +58,7 @@ av_cold void ff_h264chroma_init_x86(H264ChromaContext *c, int bit_depth)
int high_bit_depth = bit_depth > 8;
int cpu_flags = av_get_cpu_flags();
- if (EXTERNAL_MMX(cpu_flags) && !high_bit_depth) {
- c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_rnd_mmx;
- c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_mmx;
- }
-
if (EXTERNAL_MMXEXT(cpu_flags) && !high_bit_depth) {
- c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_rnd_mmxext;
- c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_mmxext;
c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_mmxext;
c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_mmxext;
}
diff --git a/libavcodec/x86/rv40dsp_init.c b/libavcodec/x86/rv40dsp_init.c
index ce2c955cb1..a07acae6bc 100644
--- a/libavcodec/x86/rv40dsp_init.c
+++ b/libavcodec/x86/rv40dsp_init.c
@@ -40,16 +40,6 @@ static void op##_rv40_qpel##size##_mc33_##insn(uint8_t *dst, const uint8_t *src,
}
#if HAVE_X86ASM
-void ff_put_rv40_chroma_mc8_mmx (uint8_t *dst, const uint8_t *src,
- ptrdiff_t stride, int h, int x, int y);
-void ff_avg_rv40_chroma_mc8_mmxext(uint8_t *dst, const uint8_t *src,
- ptrdiff_t stride, int h, int x, int y);
-
-void ff_put_rv40_chroma_mc4_mmx (uint8_t *dst, const uint8_t *src,
- ptrdiff_t stride, int h, int x, int y);
-void ff_avg_rv40_chroma_mc4_mmxext(uint8_t *dst, const uint8_t *src,
- ptrdiff_t stride, int h, int x, int y);
-
#define DECLARE_WEIGHT(opt) \
void ff_rv40_weight_func_rnd_16_##opt(uint8_t *dst, uint8_t *src1, uint8_t *src2, \
int w1, int w2, ptrdiff_t stride); \
@@ -191,14 +181,6 @@ av_cold void ff_rv40dsp_init_x86(RV34DSPContext *c)
av_unused int cpu_flags = av_get_cpu_flags();
#if HAVE_X86ASM
- if (EXTERNAL_MMX(cpu_flags)) {
- c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_mmx;
- c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_mmx;
- }
- if (EXTERNAL_MMXEXT(cpu_flags)) {
- c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_mmxext;
- c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_mmxext;
- }
if (EXTERNAL_SSE2(cpu_flags)) {
c->put_pixels_tab[0][15] = put_rv40_qpel16_mc33_sse2;
c->avg_pixels_tab[0][15] = avg_rv40_qpel16_mc33_sse2;
diff --git a/libavcodec/x86/vc1dsp_init.c b/libavcodec/x86/vc1dsp_init.c
index e7874d2a5a..5cebc1f6f2 100644
--- a/libavcodec/x86/vc1dsp_init.c
+++ b/libavcodec/x86/vc1dsp_init.c
@@ -80,10 +80,6 @@ DECLARE_FUNCTION(avg_, 16, _sse2)
#endif /* HAVE_X86ASM */
-void ff_put_vc1_chroma_mc8_nornd_mmx (uint8_t *dst, const uint8_t *src,
- ptrdiff_t stride, int h, int x, int y);
-void ff_avg_vc1_chroma_mc8_nornd_mmxext(uint8_t *dst, const uint8_t *src,
- ptrdiff_t stride, int h, int x, int y);
void ff_put_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_avg_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, const uint8_t *src,
@@ -122,13 +118,8 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
#if HAVE_X86ASM
- if (EXTERNAL_MMX(cpu_flags)) {
- dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_nornd_mmx;
-
- }
if (EXTERNAL_MMXEXT(cpu_flags)) {
ASSIGN_LF4(mmxext);
- dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_nornd_mmxext;
dsp->avg_vc1_mspel_pixels_tab[1][0] = avg_vc1_mspel_mc00_8_mmxext;
commit cb054ee89bcb9e4a035b86a42b6b3e5e6b78fec5
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Sat Nov 1 10:37:25 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 13:34:00 2025 +0100
avcodec/x86/h264_chromamc: Add SSSE3 RV40 chroma motion compensation functions
The only difference between it and the H.264/VC-1 versions is the
bias constant which depends on the shift parameters for RV40.
This value ends up in a register and therefore one can reuse
the H.264 code by setting the registers for RV40 and then jumping
into the relevant H.264 function, making the four new functions
cheap (just 256 bytes in total). This approach uses one jump more
for the no-filter case and one jump less in the one-dimensional
case than an approach using separate functions.
avg_chroma_mc4_c: 167.5 ( 1.00x)
avg_chroma_mc4_mmxext: 48.1 ( 3.48x)
avg_chroma_mc4_ssse3: 31.1 ( 5.39x)
avg_chroma_mc8_c: 325.5 ( 1.00x)
avg_chroma_mc8_mmxext: 103.2 ( 3.15x)
avg_chroma_mc8_ssse3: 33.5 ( 9.71x)
put_chroma_mc4_c: 137.4 ( 1.00x)
put_chroma_mc4_mmx: 44.5 ( 3.09x)
put_chroma_mc4_ssse3: 28.4 ( 4.83x)
put_chroma_mc8_c: 271.4 ( 1.00x)
put_chroma_mc8_mmx: 99.9 ( 2.72x)
put_chroma_mc8_ssse3: 30.6 ( 8.86x)
Reviewed-by: Lynne <dev(a)lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c
index 970faec5de..dd73737bd6 100644
--- a/libavcodec/rv40dsp.c
+++ b/libavcodec/rv40dsp.c
@@ -24,6 +24,7 @@
* RV40 decoder motion compensation functions
*/
+#include "libavutil/attributes_internal.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "h264qpel.h"
@@ -283,7 +284,7 @@ static void avg_rv40_qpel8_mc33_c(uint8_t *dst, const uint8_t *src, ptrdiff_t st
avg_pixels8_xy2_8_c(dst, src, stride, 8);
}
-static const int rv40_bias[4][4] = {
+attribute_visibility_hidden const int ff_rv40_bias[4][4] = {
{ 0, 16, 32, 16 },
{ 32, 28, 32, 28 },
{ 0, 32, 16, 32 },
@@ -300,7 +301,7 @@ static void OPNAME ## rv40_chroma_mc4_c(uint8_t *dst /*align 8*/,\
const int C = (8-x) * ( y);\
const int D = ( x) * ( y);\
int i;\
- int bias = rv40_bias[y>>1][x>>1];\
+ int bias = ff_rv40_bias[y>>1][x>>1];\
\
av_assert2(x<8 && y<8 && x>=0 && y>=0);\
\
@@ -336,7 +337,7 @@ static void OPNAME ## rv40_chroma_mc8_c(uint8_t *dst/*align 8*/,\
const int C = (8-x) * ( y);\
const int D = ( x) * ( y);\
int i;\
- int bias = rv40_bias[y>>1][x>>1];\
+ int bias = ff_rv40_bias[y>>1][x>>1];\
\
av_assert2(x<8 && y<8 && x>=0 && y>=0);\
\
diff --git a/libavcodec/x86/h264_chromamc.asm b/libavcodec/x86/h264_chromamc.asm
index ec6288d48e..8cdc0fe5a1 100644
--- a/libavcodec/x86/h264_chromamc.asm
+++ b/libavcodec/x86/h264_chromamc.asm
@@ -20,6 +20,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
+%include "config_components.asm"
%include "libavutil/x86/x86util.asm"
SECTION_RODATA
@@ -64,6 +65,8 @@ pw_28: times 8 dw 28
cextern pw_32
cextern pw_64
+cextern rv40_bias
+
SECTION .text
%macro mv0_pixels_mc8 0
@@ -447,11 +450,12 @@ chroma_mc4_mmx_func avg, rv40
chroma_mc2_mmx_func avg, h264
%macro chroma_mc8_ssse3_func 2-3
-cglobal %1_%2_chroma_mc8%3, 6, 7, 8
+cglobal %1_%2_chroma_mc8%3, 6, 7+UNIX64, 8
mov r6d, r5d
or r6d, r4d
jne .at_least_one_non_zero
; mx == 0 AND my == 0 - no filter needed
+..@%1_%2_chroma_mc8_no_filter_ %+ cpuname:
mv0_pixels_mc8
RET
@@ -462,6 +466,8 @@ cglobal %1_%2_chroma_mc8%3, 6, 7, 8
je .mx_is_zero
; general case, bilinear
+ movdqa m5, [rnd_2d_%2]
+..@%1_%2_chroma_mc8_both_nonzero_ %+ cpuname:
mov r6d, r4d
shl r4d, 8
sub r4, r6
@@ -473,7 +479,6 @@ cglobal %1_%2_chroma_mc8%3, 6, 7, 8
movd m7, r6d
movd m6, r4d
- movdqa m5, [rnd_2d_%2]
movq m0, [r1 ]
movq m1, [r1+1]
pshuflw m7, m7, 0
@@ -517,12 +522,13 @@ cglobal %1_%2_chroma_mc8%3, 6, 7, 8
RET
.my_is_zero:
+ movdqa m6, [rnd_1d_%2]
+..@%1_%2_chroma_mc8_my_zero_ %+ cpuname:
mov r5d, r4d
shl r4d, 8
add r4, 8
sub r4, r5 ; 255*x+8 = x<<8 | (8-x)
movd m7, r4d
- movdqa m6, [rnd_1d_%2]
pshuflw m7, m7, 0
movlhps m7, m7
@@ -554,12 +560,13 @@ cglobal %1_%2_chroma_mc8%3, 6, 7, 8
RET
.mx_is_zero:
+ movdqa m6, [rnd_1d_%2]
+..@%1_%2_chroma_mc8_mx_zero_ %+ cpuname:
mov r4d, r5d
shl r5d, 8
add r5, 8
sub r5, r4 ; 255*y+8 = y<<8 | (8-y)
movd m7, r5d
- movdqa m6, [rnd_1d_%2]
pshuflw m7, m7, 0
movlhps m7, m7
@@ -592,7 +599,9 @@ cglobal %1_%2_chroma_mc8%3, 6, 7, 8
%endmacro
%macro chroma_mc4_ssse3_func 2
-cglobal %1_%2_chroma_mc4, 6, 7, 0
+cglobal %1_%2_chroma_mc4, 6, 7+UNIX64, 0
+ movq m5, [pw_32]
+..@%1_%2_chroma_mc4_after_init_ %+ cpuname:
mov r6, r4
shl r4d, 8
sub r4d, r6d
@@ -604,7 +613,6 @@ cglobal %1_%2_chroma_mc4, 6, 7, 0
movd m7, r6d
movd m6, r4d
- movq m5, [pw_32]
movd m0, [r1 ]
pshufw m7, m7, 0
punpcklbw m0, [r1+1]
@@ -641,16 +649,79 @@ cglobal %1_%2_chroma_mc4, 6, 7, 0
RET
%endmacro
+%macro rv40_get_bias 1 ; dst reg
+%if !PIC || UNIX64
+ ; on UNIX64 we have enough volatile registers
+%if PIC && UNIX64
+ lea r7, [rv40_bias]
+%endif
+ mov r6d, r5d
+ and r6d, 6 ; &~1 for mx/my=[0,7]
+ lea r6d, [r6d*4+r4d]
+ sar r6d, 1
+%if PIC && UNIX64
+ movd %1, [r7+4*r6]
+%else
+ movd %1, [rv40_bias+4*r6]
+%endif
+%else ; PIC && !UNIX64, de facto WIN64
+ lea r6, [rv40_bias]
+%ifidn r5d, r5m ; always false for currently supported calling conventions
+ push r5
+%endif
+ and r5d, 6 ; &~1 for mx/my=[0,7]
+ lea r5d, [r5d*4+r4d]
+ sar r5d, 1
+ movd %1, [r6+4*r5]
+%ifidn r5d, r5m
+ pop r5
+%else
+ mov r5d, r5m
+%endif
+%endif
+ SPLATW %1, %1
+%endmacro
+
+%macro rv40_chroma_mc8_func 1 ; put vs avg
+%if CONFIG_RV40_DECODER
+ cglobal rv40_%1_chroma_mc8, 6, 7+UNIX64, 8
+ mov r6d, r5d
+ or r6d, r4d
+ jz ..@%1_h264_chroma_mc8_no_filter_ %+ cpuname
+ rv40_get_bias m5
+ ; the bilinear code expects bias in m5, the one-dimensional code in m6
+ mova m6, m5
+ psraw m6, 3
+ test r5d, r5d
+ je ..@%1_h264_chroma_mc8_my_zero_ %+ cpuname
+ test r4d, r4d
+ je ..@%1_h264_chroma_mc8_mx_zero_ %+ cpuname
+ jmp ..@%1_h264_chroma_mc8_both_nonzero_ %+ cpuname
+%endif
+%endmacro
+
+%macro rv40_chroma_mc4_func 1 ; put vs avg
+%if CONFIG_RV40_DECODER
+ cglobal rv40_%1_chroma_mc4, 6, 7+UNIX64, 0
+ rv40_get_bias m5
+ jmp ..@%1_h264_chroma_mc4_after_init_ %+ cpuname
+%endif
+%endmacro
+
%define CHROMAMC_AVG NOTHING
INIT_XMM ssse3
chroma_mc8_ssse3_func put, h264, _rnd
chroma_mc8_ssse3_func put, vc1, _nornd
+rv40_chroma_mc8_func put
INIT_MMX ssse3
chroma_mc4_ssse3_func put, h264
+rv40_chroma_mc4_func put
%define CHROMAMC_AVG DIRECT_AVG
INIT_XMM ssse3
chroma_mc8_ssse3_func avg, h264, _rnd
chroma_mc8_ssse3_func avg, vc1, _nornd
+rv40_chroma_mc8_func avg
INIT_MMX ssse3
chroma_mc4_ssse3_func avg, h264
+rv40_chroma_mc4_func avg
diff --git a/libavcodec/x86/rv40dsp_init.c b/libavcodec/x86/rv40dsp_init.c
index 780358abc2..ce2c955cb1 100644
--- a/libavcodec/x86/rv40dsp_init.c
+++ b/libavcodec/x86/rv40dsp_init.c
@@ -178,6 +178,12 @@ DEFINE_FN(avg, 8, ssse3)
DEFINE_FN(avg, 16, sse2)
DEFINE_FN(avg, 16, ssse3)
+
+#define CHROMA_MC_FUNC(OP, SIZE, XMM) \
+void ff_rv40_ ## OP ## _chroma_mc ## SIZE ## _ ## XMM(uint8_t *dst, const uint8_t *src, \
+ ptrdiff_t stride, int h, int x, int y);\
+ c->OP ## _chroma_pixels_tab[SIZE == 4] = ff_rv40_ ## OP ## _chroma_mc ## SIZE ## _ ## XMM
+
#endif /* HAVE_X86ASM */
av_cold void ff_rv40dsp_init_x86(RV34DSPContext *c)
@@ -204,6 +210,10 @@ av_cold void ff_rv40dsp_init_x86(RV34DSPContext *c)
QPEL_MC_SET(avg_, _sse2)
}
if (EXTERNAL_SSSE3(cpu_flags)) {
+ CHROMA_MC_FUNC(put, 8, ssse3);
+ CHROMA_MC_FUNC(put, 4, ssse3);
+ CHROMA_MC_FUNC(avg, 8, ssse3);
+ CHROMA_MC_FUNC(avg, 4, ssse3);
c->put_pixels_tab[0][15] = put_rv40_qpel16_mc33_ssse3;
c->put_pixels_tab[1][15] = put_rv40_qpel8_mc33_ssse3;
c->avg_pixels_tab[0][15] = avg_rv40_qpel16_mc33_ssse3;
commit c607aae2b95b05bdc7066e3572737cb00a596e9f
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Sat Nov 1 11:27:22 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 13:33:56 2025 +0100
configure: Add config_components.asm
This is in preparation for the next commit.
Reviewed-by: Lynne <dev(a)lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/configure b/configure
index 3b132d07c9..17f72b735e 100755
--- a/configure
+++ b/configure
@@ -8524,8 +8524,10 @@ echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
cp_if_changed $TMPH config.h
touch ffbuild/.config
-# Copy config.asm before printing ALL_COMPONENTS; that's not needed in assembly.
-enabled x86asm && cp_if_changed $TMPASM config.asm
+# Copy config.asm and reopen a new TMPASM for config_components.asm
+enabled x86asm && cp_if_changed $TMPASM config.asm && cat > $TMPASM <<EOF
+; Automatically generated by configure - do not modify!
+EOF
# Reopen a new TMPH for config_components.h.
cat > $TMPH <<EOF
@@ -8540,6 +8542,7 @@ echo "#endif /* FFMPEG_CONFIG_COMPONENTS_H */" >> $TMPH
echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak
cp_if_changed $TMPH config_components.h
+enabled x86asm && cp_if_changed $TMPASM config_components.asm
cat > $TMPH <<EOF
/* Generated by ffmpeg configure */
commit c6efe1abda600f15a87480d5bcc52a6df93983b8
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Thu Oct 30 15:40:02 2025 +0100
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Sat Nov 1 13:31:57 2025 +0100
avcodec/h264chroma: Move mc1 function to mpegvideo_dec.c
It is only used by mpegvideo decoders (for lowres). It is also only used
for bitdepth == 8, so don't build the bitdepth == 16 function at all any
more.
Reviewed-by: Lynne <dev(a)lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/h264chroma.c b/libavcodec/h264chroma.c
index 1eeab7bc40..5000c89aa7 100644
--- a/libavcodec/h264chroma.c
+++ b/libavcodec/h264chroma.c
@@ -32,11 +32,9 @@
c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_ ## depth ## _c; \
c->put_h264_chroma_pixels_tab[1] = put_h264_chroma_mc4_ ## depth ## _c; \
c->put_h264_chroma_pixels_tab[2] = put_h264_chroma_mc2_ ## depth ## _c; \
- c->put_h264_chroma_pixels_tab[3] = put_h264_chroma_mc1_ ## depth ## _c; \
c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_ ## depth ## _c; \
c->avg_h264_chroma_pixels_tab[1] = avg_h264_chroma_mc4_ ## depth ## _c; \
c->avg_h264_chroma_pixels_tab[2] = avg_h264_chroma_mc2_ ## depth ## _c; \
- c->avg_h264_chroma_pixels_tab[3] = avg_h264_chroma_mc1_ ## depth ## _c; \
av_cold void ff_h264chroma_init(H264ChromaContext *c, int bit_depth)
{
diff --git a/libavcodec/h264chroma_template.c b/libavcodec/h264chroma_template.c
index b9d24f5a0c..b58be192cd 100644
--- a/libavcodec/h264chroma_template.c
+++ b/libavcodec/h264chroma_template.c
@@ -26,40 +26,6 @@
#include "bit_depth_template.c"
#define H264_CHROMA_MC(OPNAME, OP)\
-static void FUNCC(OPNAME ## h264_chroma_mc1)(uint8_t *_dst /*align 8*/, const uint8_t *_src /*align 1*/, ptrdiff_t stride, int h, int x, int y){\
- pixel *dst = (pixel*)_dst;\
- const pixel *src = (const pixel*)_src;\
- const int A=(8-x)*(8-y);\
- const int B=( x)*(8-y);\
- const int C=(8-x)*( y);\
- const int D=( x)*( y);\
- int i;\
- stride >>= sizeof(pixel)-1;\
- \
- av_assert2(x<8 && y<8 && x>=0 && y>=0);\
-\
- if(D){\
- for(i=0; i<h; i++){\
- OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
- dst+= stride;\
- src+= stride;\
- }\
- } else if (B + C) {\
- const int E= B+C;\
- const int step= C ? stride : 1;\
- for(i=0; i<h; i++){\
- OP(dst[0], (A*src[0] + E*src[step+0]));\
- dst+= stride;\
- src+= stride;\
- }\
- } else {\
- for(i=0; i<h; i++){\
- OP(dst[0], (A*src[0]));\
- dst+= stride;\
- src+= stride;\
- }\
- }\
-}\
static void FUNCC(OPNAME ## h264_chroma_mc2)(uint8_t *_dst /*align 8*/, const uint8_t *_src /*align 1*/, ptrdiff_t stride, int h, int x, int y)\
{\
pixel *dst = (pixel*)_dst;\
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 85e24c667e..ad27180efd 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -44,6 +44,45 @@
#include "threadprogress.h"
#include "wmv2dec.h"
+#define H264_CHROMA_MC(OPNAME, OP)\
+static void OPNAME ## h264_chroma_mc1(uint8_t *dst /*align 8*/, const uint8_t *src /*align 1*/, ptrdiff_t stride, int h, int x, int y)\
+{\
+ const int A = (8-x) * (8-y);\
+ const int B = ( x) * (8-y);\
+ const int C = (8-x) * ( y);\
+ const int D = ( x) * ( y);\
+ \
+ av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);\
+\
+ if (D) {\
+ for (int i = 0; i < h; ++i) {\
+ OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
+ dst += stride;\
+ src += stride;\
+ }\
+ } else if (B + C) {\
+ const int E = B + C;\
+ const int step = C ? stride : 1;\
+ for (int i = 0; i < h; ++i) {\
+ OP(dst[0], (A*src[0] + E*src[step+0]));\
+ dst += stride;\
+ src += stride;\
+ }\
+ } else {\
+ for (int i = 0; i < h; ++i) {\
+ OP(dst[0], (A*src[0]));\
+ dst += stride;\
+ src += stride;\
+ }\
+ }\
+}\
+
+#define op_avg(a, b) a = (((a)+(((b) + 32)>>6)+1)>>1)
+#define op_put(a, b) a = (((b) + 32)>>6)
+
+H264_CHROMA_MC(put_, op_put)
+H264_CHROMA_MC(avg_, op_avg)
+
av_cold int ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
{
enum ThreadingStatus thread_status;
@@ -62,6 +101,8 @@ av_cold int ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
ff_mpv_idct_init(s);
ff_h264chroma_init(&s->h264chroma, 8); //for lowres
+ s->h264chroma.avg_h264_chroma_pixels_tab[3] = avg_h264_chroma_mc1;
+ s->h264chroma.put_h264_chroma_pixels_tab[3] = put_h264_chroma_mc1;
if (s->picture_pool) // VC-1 can call this multiple times
return 0;
diff --git a/tests/checkasm/h264chroma.c b/tests/checkasm/h264chroma.c
index 9579fceab7..52aa220152 100644
--- a/tests/checkasm/h264chroma.c
+++ b/tests/checkasm/h264chroma.c
@@ -51,7 +51,7 @@ static void check_chroma_mc(void)
for (int bit_depth = 8; bit_depth <= 10; bit_depth++) {
ff_h264chroma_init(&h, bit_depth);
randomize_buffers(bit_depth);
- for (int size = 0; size < 4; size++) {
+ for (int size = 0; size < 3; size++) {
#define CHECK_CHROMA_MC(name) \
do { \
-----------------------------------------------------------------------
Summary of changes:
configure | 7 +-
libavcodec/h264chroma.c | 2 -
libavcodec/h264chroma_template.c | 34 ----
libavcodec/mpegvideo_dec.c | 41 ++++
libavcodec/rv40dsp.c | 7 +-
libavcodec/x86/h264_chromamc.asm | 410 ++++++++-------------------------------
libavcodec/x86/h264chroma_init.c | 17 --
libavcodec/x86/rv40dsp_init.c | 28 +--
libavcodec/x86/vc1dsp_init.c | 9 -
tests/checkasm/h264chroma.c | 2 +-
10 files changed, 140 insertions(+), 417 deletions(-)
hooks/post-receive
--
1
0