* [FFmpeg-devel] [PATCH 01/30] avcodec/mpegvideo_enc: Don't set qscale_table value
@ 2025-02-25 22:40 Andreas Rheinhardt
0 siblings, 0 replies; only message in thread
From: Andreas Rheinhardt @ 2025-02-25 22:40 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1: Type: text/plain, Size: 378 bytes --]
Patches attached; the first few were already sent last year [1], but I
have refrained from pushing them because Michael seems to have trouble
testing them due to a conflict [2] that existed by the time he tried to
test it.
- Andreas
[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2024-July/330467.html
[2]: https://ffmpeg.org/pipermail/ffmpeg-devel/2024-September/333737.html
[-- Attachment #2: 0001-avcodec-mpegvideo_enc-Don-t-set-qscale_table-value-p.patch --]
[-- Type: text/x-patch, Size: 10059 bytes --]
From 341f4a0af1a42b673c6d02aa5da6ffe2f7186cbb Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sun, 30 Jun 2024 16:04:13 +0200
Subject: [PATCH 01/30] avcodec/mpegvideo_enc: Don't set qscale_table value
prematurely
When there are multiple candidates for macroblock type, the encoder
tries them all. In order to do so, it copies the keeps several sets
of states containing the variables that get modified when encoding
the macroblock and in the end uses the best of these.
Yet one variable was set, but not included in this state:
The current macroblock's qscale value in the current picture's
qscale_table. This may currently be set multiple times in
mpv_reconstruct_mb(), yet it is read when adaptive_quant is true.
Currently, the value read can be the value set by the last attempt
to write the current macroblock and not the initial value.
Fix this by only setting the qscale_table value in one place
outside of mpv_reconstruct_mb() (where it does not belong at all).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegvideo_enc.c | 8 ++-----
tests/ref/seek/vsynth_lena-mpeg4-adap | 28 ++++++++++++-------------
tests/ref/vsynth/vsynth1-mpeg4-adap | 8 +++----
tests/ref/vsynth/vsynth2-mpeg4-adap | 8 +++----
tests/ref/vsynth/vsynth3-mpeg4-adap | 8 +++----
tests/ref/vsynth/vsynth_lena-mpeg4-adap | 8 +++----
6 files changed, 32 insertions(+), 36 deletions(-)
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index bb82a03a41..c5c2e0b8e3 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1118,10 +1118,6 @@ static inline void add_dequant_dct(MpegEncContext *s,
*/
static void mpv_reconstruct_mb(MpegEncContext *s, int16_t block[12][64])
{
- const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
-
- s->cur_pic.qscale_table[mb_xy] = s->qscale;
-
if (s->avctx->debug & FF_DEBUG_DCT_COEFF) {
/* print DCT coefficients */
av_log(s->avctx, AV_LOG_DEBUG, "DCT coeffs of MB at %dx%d:\n", s->mb_x, s->mb_y);
@@ -3382,8 +3378,6 @@ static int encode_thread(AVCodecContext *c, void *arg){
}
}
- s->cur_pic.qscale_table[xy] = best_s.qscale;
-
copy_context_after_encode(s, &best_s);
pb_bits_count= put_bits_count(&s->pb);
@@ -3538,6 +3532,8 @@ static int encode_thread(AVCodecContext *c, void *arg){
mpv_reconstruct_mb(s, s->block);
}
+ s->cur_pic.qscale_table[xy] = s->qscale;
+
/* clean the MV table in IPS frames for direct mode in B-frames */
if(s->mb_intra /* && I,P,S_TYPE */){
s->p_mv_table[xy][0]=0;
diff --git a/tests/ref/seek/vsynth_lena-mpeg4-adap b/tests/ref/seek/vsynth_lena-mpeg4-adap
index fe841ef973..7777491651 100644
--- a/tests/ref/seek/vsynth_lena-mpeg4-adap
+++ b/tests/ref/seek/vsynth_lena-mpeg4-adap
@@ -2,45 +2,45 @@ ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 6855
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 6855
ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 161318 size: 19176
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 161352 size: 19191
ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 75056 size: 19178
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 75104 size: 19178
ret:-1 st: 0 flags:1 ts:-0.320000
ret:-1 st:-1 flags:0 ts: 2.576668
ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 118696 size: 20018
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 118586 size: 20060
ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 35800 size: 17261
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 35840 size: 17261
ret:-1 st: 0 flags:1 ts:-0.760000
ret:-1 st:-1 flags:0 ts: 2.153336
ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 75056 size: 19178
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 75104 size: 19178
ret: 0 st: 0 flags:0 ts:-0.040000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 6855
ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 161318 size: 19176
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 161352 size: 19191
ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 161318 size: 19176
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 161352 size: 19191
ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 35800 size: 17261
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 35840 size: 17261
ret: 0 st: 0 flags:0 ts:-0.480000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 6855
ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 161318 size: 19176
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 161352 size: 19191
ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 118696 size: 20018
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 118586 size: 20060
ret: 0 st:-1 flags:1 ts: 0.200839
ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 6855
ret: 0 st: 0 flags:0 ts:-0.920000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 6855
ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 161318 size: 19176
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 161352 size: 19191
ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 75056 size: 19178
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 75104 size: 19178
ret:-1 st:-1 flags:1 ts:-0.222493
ret:-1 st: 0 flags:0 ts: 2.680000
ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 118696 size: 20018
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 118586 size: 20060
ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 75056 size: 19178
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 75104 size: 19178
ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/tests/ref/vsynth/vsynth1-mpeg4-adap b/tests/ref/vsynth/vsynth1-mpeg4-adap
index 67705f0f43..d3ad12e921 100644
--- a/tests/ref/vsynth/vsynth1-mpeg4-adap
+++ b/tests/ref/vsynth/vsynth1-mpeg4-adap
@@ -1,4 +1,4 @@
-0f1cbbdc3f9b91f2d9ac3d1fc2cf7d4e *tests/data/fate/vsynth1-mpeg4-adap.avi
-325518 tests/data/fate/vsynth1-mpeg4-adap.avi
-1e6c596f9f491fbf15920ef1bace7fb8 *tests/data/fate/vsynth1-mpeg4-adap.out.rawvideo
-stddev: 14.12 PSNR: 25.13 MAXDIFF: 184 bytes: 7603200/ 7603200
+3b4fe7ad106cb112364d062b20ad80a8 *tests/data/fate/vsynth1-mpeg4-adap.avi
+325594 tests/data/fate/vsynth1-mpeg4-adap.avi
+96c5a7759413ab24afaa926abb3c5fe0 *tests/data/fate/vsynth1-mpeg4-adap.out.rawvideo
+stddev: 14.11 PSNR: 25.13 MAXDIFF: 184 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth2-mpeg4-adap b/tests/ref/vsynth/vsynth2-mpeg4-adap
index e058cd1ce3..140b17649c 100644
--- a/tests/ref/vsynth/vsynth2-mpeg4-adap
+++ b/tests/ref/vsynth/vsynth2-mpeg4-adap
@@ -1,4 +1,4 @@
-9465ef120d560537d8fcfb5564782e01 *tests/data/fate/vsynth2-mpeg4-adap.avi
-203004 tests/data/fate/vsynth2-mpeg4-adap.avi
-d7851ab1ca9744f8e618a24193e5ef76 *tests/data/fate/vsynth2-mpeg4-adap.out.rawvideo
-stddev: 4.56 PSNR: 34.95 MAXDIFF: 84 bytes: 7603200/ 7603200
+21d205e0f42ce613481b202d52593225 *tests/data/fate/vsynth2-mpeg4-adap.avi
+202870 tests/data/fate/vsynth2-mpeg4-adap.avi
+1c45877fe27fb5fbfcdaff4a1da94de4 *tests/data/fate/vsynth2-mpeg4-adap.out.rawvideo
+stddev: 4.55 PSNR: 34.95 MAXDIFF: 84 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth3-mpeg4-adap b/tests/ref/vsynth/vsynth3-mpeg4-adap
index 6386f13466..70a25831d9 100644
--- a/tests/ref/vsynth/vsynth3-mpeg4-adap
+++ b/tests/ref/vsynth/vsynth3-mpeg4-adap
@@ -1,4 +1,4 @@
-6b2f641f2e68b11b992fd6ba1ed66a21 *tests/data/fate/vsynth3-mpeg4-adap.avi
-41012 tests/data/fate/vsynth3-mpeg4-adap.avi
-3483a2032cb02c3a37f5e43b128e59ed *tests/data/fate/vsynth3-mpeg4-adap.out.rawvideo
-stddev: 5.79 PSNR: 32.87 MAXDIFF: 49 bytes: 86700/ 86700
+10512ee1a666ed95643557e1cf699363 *tests/data/fate/vsynth3-mpeg4-adap.avi
+41100 tests/data/fate/vsynth3-mpeg4-adap.avi
+9ba2c3cab3f08d2a345b849d0b30e3e1 *tests/data/fate/vsynth3-mpeg4-adap.out.rawvideo
+stddev: 5.79 PSNR: 32.88 MAXDIFF: 49 bytes: 86700/ 86700
diff --git a/tests/ref/vsynth/vsynth_lena-mpeg4-adap b/tests/ref/vsynth/vsynth_lena-mpeg4-adap
index 91edafe9b0..912b9b2efa 100644
--- a/tests/ref/vsynth/vsynth_lena-mpeg4-adap
+++ b/tests/ref/vsynth/vsynth_lena-mpeg4-adap
@@ -1,4 +1,4 @@
-633da125f46391eef33bb031cd728f4b *tests/data/fate/vsynth_lena-mpeg4-adap.avi
-187598 tests/data/fate/vsynth_lena-mpeg4-adap.avi
-21312bfcb28c40299fb27a5b03477f8c *tests/data/fate/vsynth_lena-mpeg4-adap.out.rawvideo
-stddev: 3.63 PSNR: 36.92 MAXDIFF: 71 bytes: 7603200/ 7603200
+5af033cfe87bc2abf688b602e5a1a35c *tests/data/fate/vsynth_lena-mpeg4-adap.avi
+187652 tests/data/fate/vsynth_lena-mpeg4-adap.avi
+515efcfb456cf7b460f356fe0dc7c808 *tests/data/fate/vsynth_lena-mpeg4-adap.out.rawvideo
+stddev: 3.63 PSNR: 36.93 MAXDIFF: 71 bytes: 7603200/ 7603200
--
2.45.2
[-- Attachment #3: 0002-avcodec-mpegvideo_enc-Add-AV_CODEC_CAP_DR1.patch --]
[-- Type: text/x-patch, Size: 11659 bytes --]
From 26345cd5c085afa6224a9a8a20b6954e512b5db5 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sun, 30 Jun 2024 17:44:46 +0200
Subject: [PATCH 02/30] avcodec/mpegvideo_enc: Add AV_CODEC_CAP_DR1
The mpegvideo-based encoders do one uncommon thing with
the packet's data given by ff_alloc_packet(): They potentially
reallocate it. But this only affects the internal buffer
and is not user-facing at all, so one can nevertheless
use the AV_CODEC_CAP_DR1 for them.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/flvenc.c | 2 +-
libavcodec/h261enc.c | 2 +-
libavcodec/ituh263enc.c | 5 +++--
libavcodec/mjpegenc.c | 5 +++--
libavcodec/mpeg12enc.c | 6 ++++--
libavcodec/mpeg4videoenc.c | 3 ++-
libavcodec/msmpeg4enc.c | 6 +++---
libavcodec/rv10enc.c | 2 +-
libavcodec/rv20enc.c | 2 +-
libavcodec/speedhqenc.c | 2 +-
libavcodec/wmv2enc.c | 2 +-
11 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/libavcodec/flvenc.c b/libavcodec/flvenc.c
index 40eec07b3e..cbe3b7f056 100644
--- a/libavcodec/flvenc.c
+++ b/libavcodec/flvenc.c
@@ -98,6 +98,7 @@ const FFCodec ff_flv_encoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_FLV1,
.p.priv_class = &ff_mpv_enc_class,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_mpv_encode_init,
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
@@ -106,5 +107,4 @@ const FFCodec ff_flv_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE},
.color_ranges = AVCOL_RANGE_MPEG,
- .p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
};
diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c
index c694862462..dabab9d80a 100644
--- a/libavcodec/h261enc.c
+++ b/libavcodec/h261enc.c
@@ -383,6 +383,7 @@ const FFCodec ff_h261_encoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_H261,
.p.priv_class = &ff_mpv_enc_class,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.priv_data_size = sizeof(H261EncContext),
.init = ff_mpv_encode_init,
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
@@ -391,5 +392,4 @@ const FFCodec ff_h261_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
.color_ranges = AVCOL_RANGE_MPEG,
- .p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
};
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index 8c41e45ab2..1ef4a8f88e 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -922,7 +922,7 @@ const FFCodec ff_h263_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE},
.color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &h263_class,
- .p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_mpv_encode_init,
@@ -954,7 +954,8 @@ const FFCodec ff_h263p_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &h263p_class,
- .p.capabilities = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS |
+ AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_mpv_encode_init,
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 40da602a6d..c2e8b93a34 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -669,7 +669,8 @@ FFCodec ff_mjpeg_encoder = {
.init = ff_mpv_encode_init,
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
.close = mjpeg_encode_close,
- .p.capabilities = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS |
+ .p.capabilities = AV_CODEC_CAP_DR1 |
+ AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_ICC_PROFILES,
.p.pix_fmts = (const enum AVPixelFormat[]) {
@@ -696,6 +697,7 @@ const FFCodec ff_amv_encoder = {
CODEC_LONG_NAME("AMV Video"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_AMV,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.priv_data_size = sizeof(MJPEGEncContext),
.init = ff_mpv_encode_init,
FF_CODEC_ENCODE_CB(amv_encode_picture),
@@ -706,6 +708,5 @@ const FFCodec ff_amv_encoder = {
},
.color_ranges = AVCOL_RANGE_JPEG,
.p.priv_class = &amv_class,
- .p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
};
#endif
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 720ac287fc..52264ac6a0 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -1244,7 +1244,8 @@ const FFCodec ff_mpeg1video_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
.color_ranges = AVCOL_RANGE_MPEG,
- .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
+ AV_CODEC_CAP_SLICE_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.priv_class = &mpeg1_class,
@@ -1264,7 +1265,8 @@ const FFCodec ff_mpeg2video_encoder = {
AV_PIX_FMT_YUV422P,
AV_PIX_FMT_NONE },
.color_ranges = AVCOL_RANGE_MPEG,
- .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
+ AV_CODEC_CAP_SLICE_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.priv_class = &mpeg2_class,
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index 98254c2c63..bc5375002a 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -1394,7 +1394,8 @@ const FFCodec ff_mpeg4_encoder = {
.close = ff_mpv_encode_end,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.color_ranges = AVCOL_RANGE_MPEG,
- .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
+ AV_CODEC_CAP_SLICE_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.priv_class = &mpeg4enc_class,
diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c
index 5ce4e6e30c..26b896bee3 100644
--- a/libavcodec/msmpeg4enc.c
+++ b/libavcodec/msmpeg4enc.c
@@ -683,7 +683,7 @@ const FFCodec ff_msmpeg4v2_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &ff_mpv_enc_class,
- .p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(MSMPEG4EncContext),
.init = ff_mpv_encode_init,
@@ -699,7 +699,7 @@ const FFCodec ff_msmpeg4v3_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &ff_mpv_enc_class,
- .p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(MSMPEG4EncContext),
.init = ff_mpv_encode_init,
@@ -715,7 +715,7 @@ const FFCodec ff_wmv1_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &ff_mpv_enc_class,
- .p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(MSMPEG4EncContext),
.init = ff_mpv_encode_init,
diff --git a/libavcodec/rv10enc.c b/libavcodec/rv10enc.c
index 2104ee0a24..73327a6e35 100644
--- a/libavcodec/rv10enc.c
+++ b/libavcodec/rv10enc.c
@@ -71,7 +71,7 @@ const FFCodec ff_rv10_encoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_RV10,
.p.priv_class = &ff_mpv_enc_class,
- .p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_mpv_encode_init,
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
diff --git a/libavcodec/rv20enc.c b/libavcodec/rv20enc.c
index d0e24f2f26..7d7cbeaf93 100644
--- a/libavcodec/rv20enc.c
+++ b/libavcodec/rv20enc.c
@@ -68,7 +68,7 @@ const FFCodec ff_rv20_encoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_RV20,
.p.priv_class = &ff_mpv_enc_class,
- .p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_mpv_encode_init,
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c
index 81a5151b75..ac40fd6e75 100644
--- a/libavcodec/speedhqenc.c
+++ b/libavcodec/speedhqenc.c
@@ -294,7 +294,7 @@ const FFCodec ff_speedhq_encoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_SPEEDHQ,
.p.priv_class = &ff_mpv_enc_class,
- .p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.priv_data_size = sizeof(SpeedHQEncContext),
.init = ff_mpv_encode_init,
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c
index fded6f0e76..13bd2d48b9 100644
--- a/libavcodec/wmv2enc.c
+++ b/libavcodec/wmv2enc.c
@@ -243,7 +243,7 @@ const FFCodec ff_wmv2_encoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_WMV2,
.p.priv_class = &ff_mpv_enc_class,
- .p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.priv_data_size = sizeof(WMV2EncContext),
.init = wmv2_encode_init,
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
--
2.45.2
[-- Attachment #4: 0003-avcodec-motion_est-Avoid-branches-for-put-_no_rnd-se.patch --]
[-- Type: text/x-patch, Size: 3718 bytes --]
From 973cf23fdb130d141ef16c1f29bca2e53d461294 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sun, 30 Jun 2024 11:31:04 +0200
Subject: [PATCH 03/30] avcodec/motion_est: Avoid branches for put(_no_rnd)
selection
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/motion_est.c | 25 +++++--------------------
1 file changed, 5 insertions(+), 20 deletions(-)
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index e4f17fb2d8..46c4ca2dd9 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -661,18 +661,12 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)
const uint8_t *ref = c->ref[block][0] + (mx4>>2) + (my4>>2)*stride;
dxy = ((my4 & 3) << 2) | (mx4 & 3);
- if(s->no_rounding)
- s->qdsp.put_no_rnd_qpel_pixels_tab[1][dxy](dest_y, ref, stride);
- else
- s->qdsp.put_qpel_pixels_tab[1][dxy](dest_y, ref, stride);
+ c->qpel_put[1][dxy](dest_y, ref, stride);
}else{
const uint8_t *ref = c->ref[block][0] + (mx4>>1) + (my4>>1)*stride;
dxy = ((my4 & 1) << 1) | (mx4 & 1);
- if(s->no_rounding)
- s->hdsp.put_no_rnd_pixels_tab[1][dxy](dest_y , ref , stride, h);
- else
- s->hdsp.put_pixels_tab [1][dxy](dest_y , ref , stride, h);
+ c->hpel_put[1][dxy](dest_y, ref, stride, h);
}
dmin_sum+= (mv_penalty[mx4-pred_x4] + mv_penalty[my4-pred_y4])*c->mb_penalty_factor;
}else
@@ -713,13 +707,8 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)
offset= (s->mb_x*8 + (mx>>1)) + (s->mb_y*8 + (my>>1))*s->uvlinesize;
- if(s->no_rounding){
- s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_pic.data[1] + offset, s->uvlinesize, 8);
- s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_pic.data[2] + offset, s->uvlinesize, 8);
- }else{
- s->hdsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_pic.data[1] + offset, s->uvlinesize, 8);
- s->hdsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_pic.data[2] + offset, s->uvlinesize, 8);
- }
+ c->hpel_put[1][dxy](c->scratchpad , s->last_pic.data[1] + offset, s->uvlinesize, 8);
+ c->hpel_put[1][dxy](c->scratchpad + 8, s->last_pic.data[2] + offset, s->uvlinesize, 8);
dmin_sum += c->mb_cmp[1](s, s->new_pic->data[1] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad, s->uvlinesize, 8);
dmin_sum += c->mb_cmp[1](s, s->new_pic->data[2] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad + 8, s->uvlinesize, 8);
@@ -825,11 +814,7 @@ static int interlaced_search(MpegEncContext *s, int ref_index,
const uint8_t *ref = c->ref[field_select+ref_index][0] + (mx_i>>1) + (my_i>>1)*stride;
dxy = ((my_i & 1) << 1) | (mx_i & 1);
- if(s->no_rounding){
- s->hdsp.put_no_rnd_pixels_tab[size][dxy](c->scratchpad, ref , stride, h);
- }else{
- s->hdsp.put_pixels_tab [size][dxy](c->scratchpad, ref , stride, h);
- }
+ c->hpel_put[size][dxy](c->scratchpad, ref, stride, h);
dmin = c->mb_cmp[size](s, c->src[block][0], c->scratchpad, stride, h);
dmin+= (mv_penalty[mx_i-c->pred_x] + mv_penalty[my_i-c->pred_y] + 1)*c->mb_penalty_factor;
}else
--
2.45.2
[-- Attachment #5: 0004-avcodec-mpegvideo_dec-Use-picture-dimensions-in-ff_p.patch --]
[-- Type: text/x-patch, Size: 1125 bytes --]
From 4ce9fd947ea919044ca1f7dfb4bfa8186ea4c20e Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 1 Jul 2024 01:31:12 +0200
Subject: [PATCH 04/30] avcodec/mpegvideo_dec: Use picture-dimensions in
ff_print_debug_info()
It will allow to avoid the special case for VC-1 field pictures.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegvideo_dec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 44f1ba1592..53e02ad91c 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -404,7 +404,7 @@ void ff_print_debug_info(const MpegEncContext *s, const MPVPicture *p, AVFrame *
{
ff_print_debug_info2(s->avctx, pict, p->mb_type,
p->qscale_table, p->motion_val,
- s->mb_width, s->mb_height, s->mb_stride, s->quarter_sample);
+ p->mb_width, p->mb_height, p->mb_stride, s->quarter_sample);
}
int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f,
--
2.45.2
[-- Attachment #6: 0005-avcodec-vc1dec-Reenable-debug-info-output-for-field-.patch --]
[-- Type: text/x-patch, Size: 1420 bytes --]
From 899f0a716aebe252be098ddcc85ce18623deba31 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 1 Jul 2024 01:43:58 +0200
Subject: [PATCH 05/30] avcodec/vc1dec: Reenable debug-info output for field
pictures
Effectively reverts c59b5e3d1e0121ea23b5b326529f5bdca44cf982.
This is possible now that ff_print_debug_info2() uses
the MPVPicture dimensions.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/vc1dec.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 2c314e7b55..f079a8745b 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1366,14 +1366,12 @@ image:
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
if ((ret = av_frame_ref(pict, s->cur_pic.ptr->f)) < 0)
goto err;
- if (!v->field_mode)
- ff_print_debug_info(s, s->cur_pic.ptr, pict);
+ ff_print_debug_info(s, s->cur_pic.ptr, pict);
*got_frame = 1;
} else if (s->last_pic.ptr) {
if ((ret = av_frame_ref(pict, s->last_pic.ptr->f)) < 0)
goto err;
- if (!v->field_mode)
- ff_print_debug_info(s, s->last_pic.ptr, pict);
+ ff_print_debug_info(s, s->last_pic.ptr, pict);
*got_frame = 1;
}
}
--
2.45.2
[-- Attachment #7: 0006-tests-fate-vcodec-Test-alternate_scan.patch --]
[-- Type: text/x-patch, Size: 4048 bytes --]
From f85914b29ed52b3f3d6d851bb0975265221aa2ba Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Tue, 2 Jul 2024 00:45:50 +0200
Subject: [PATCH 06/30] tests/fate/vcodec: Test alternate_scan
Encoding was untested before this.
Notice that the filesize degradation is partially due to
mpegvideo no longer using progressive_sequence and
progressive_frame.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
tests/fate/vcodec.mak | 2 +-
tests/ref/vsynth/vsynth1-mpeg2 | 4 ++--
tests/ref/vsynth/vsynth2-mpeg2 | 4 ++--
tests/ref/vsynth/vsynth3-mpeg2 | 8 ++++----
tests/ref/vsynth/vsynth_lena-mpeg2 | 4 ++--
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak
index a12eb43f22..a91c0ec3e3 100644
--- a/tests/fate/vcodec.mak
+++ b/tests/fate/vcodec.mak
@@ -263,7 +263,7 @@ FATE_VCODEC-$(call ENCDEC, MPEG2VIDEO, MPEG2VIDEO MPEGVIDEO) += $(FATE_MPEG2)
$(FATE_MPEG2:%=fate-vsynth\%-%): FMT = mpeg2video
$(FATE_MPEG2:%=fate-vsynth\%-%): CODEC = mpeg2video
-fate-vsynth%-mpeg2: ENCOPTS = -qscale 10
+fate-vsynth%-mpeg2: ENCOPTS = -qscale 10 -alternate_scan 1
fate-vsynth%-mpeg2-422: ENCOPTS = -b:v 1000k \
-bf 2 \
-trellis 1 \
diff --git a/tests/ref/vsynth/vsynth1-mpeg2 b/tests/ref/vsynth/vsynth1-mpeg2
index 0f06f380cf..658bf30f98 100644
--- a/tests/ref/vsynth/vsynth1-mpeg2
+++ b/tests/ref/vsynth/vsynth1-mpeg2
@@ -1,4 +1,4 @@
-89d9481c12d2342e256b322d317e81c4 *tests/data/fate/vsynth1-mpeg2.mpeg2video
-728400 tests/data/fate/vsynth1-mpeg2.mpeg2video
+7568d0abb159228f138463c6713f9281 *tests/data/fate/vsynth1-mpeg2.mpeg2video
+739643 tests/data/fate/vsynth1-mpeg2.mpeg2video
66c2a14725ba0a6f1535b9a62768977b *tests/data/fate/vsynth1-mpeg2.out.rawvideo
stddev: 7.65 PSNR: 30.45 MAXDIFF: 84 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth2-mpeg2 b/tests/ref/vsynth/vsynth2-mpeg2
index 869948adeb..7a73b9968c 100644
--- a/tests/ref/vsynth/vsynth2-mpeg2
+++ b/tests/ref/vsynth/vsynth2-mpeg2
@@ -1,4 +1,4 @@
-38afa638d9ac0b9c7ccebb8073412920 *tests/data/fate/vsynth2-mpeg2.mpeg2video
-268153 tests/data/fate/vsynth2-mpeg2.mpeg2video
+1f29c2bdddcc13e2e659d7dfc0e6ba0e *tests/data/fate/vsynth2-mpeg2.mpeg2video
+280927 tests/data/fate/vsynth2-mpeg2.mpeg2video
bbddc9948fadfcc79487b391417ba8ed *tests/data/fate/vsynth2-mpeg2.out.rawvideo
stddev: 5.55 PSNR: 33.23 MAXDIFF: 77 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth3-mpeg2 b/tests/ref/vsynth/vsynth3-mpeg2
index d2e5b9fffc..f64bb9ccb3 100644
--- a/tests/ref/vsynth/vsynth3-mpeg2
+++ b/tests/ref/vsynth/vsynth3-mpeg2
@@ -1,4 +1,4 @@
-d95da92e3e77e32e3766ed9a95241f98 *tests/data/fate/vsynth3-mpeg2.mpeg2video
-29567 tests/data/fate/vsynth3-mpeg2.mpeg2video
-1df6a406c3959c6de7651b4e4fd98a36 *tests/data/fate/vsynth3-mpeg2.out.rawvideo
-stddev: 9.12 PSNR: 28.93 MAXDIFF: 63 bytes: 86700/ 86700
+c28c9a900c9975af2ad4ab7e5ac40a71 *tests/data/fate/vsynth3-mpeg2.mpeg2video
+36239 tests/data/fate/vsynth3-mpeg2.mpeg2video
+c1ece16d7ab1564032dda15553f856f9 *tests/data/fate/vsynth3-mpeg2.out.rawvideo
+stddev: 9.05 PSNR: 28.99 MAXDIFF: 66 bytes: 86700/ 86700
diff --git a/tests/ref/vsynth/vsynth_lena-mpeg2 b/tests/ref/vsynth/vsynth_lena-mpeg2
index 699a47b652..d0e29f2f33 100644
--- a/tests/ref/vsynth/vsynth_lena-mpeg2
+++ b/tests/ref/vsynth/vsynth_lena-mpeg2
@@ -1,4 +1,4 @@
-6071414a26d41ae9c4cc5477d8ca19eb *tests/data/fate/vsynth_lena-mpeg2.mpeg2video
-198673 tests/data/fate/vsynth_lena-mpeg2.mpeg2video
+2883a9fd2680e34629b6eef87f7cac1b *tests/data/fate/vsynth_lena-mpeg2.mpeg2video
+213032 tests/data/fate/vsynth_lena-mpeg2.mpeg2video
9efe4846a75d9b7387d1e3bb1e5db29a *tests/data/fate/vsynth_lena-mpeg2.out.rawvideo
stddev: 4.96 PSNR: 34.20 MAXDIFF: 59 bytes: 7603200/ 7603200
--
2.45.2
[-- Attachment #8: 0007-tests-fate-vcodec-Test-using-mpeg2-quantizers-for-MP.patch --]
[-- Type: text/x-patch, Size: 9080 bytes --]
From 0b77b3add30533034972e5c94daff819aebcef0d Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Tue, 2 Jul 2024 19:26:20 +0200
Subject: [PATCH 07/30] tests/fate/vcodec: Test using mpeg2-quantizers for
MPEG-4
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
tests/fate/vcodec.mak | 2 +-
tests/ref/seek/vsynth_lena-mpeg4-rc | 40 +++++++++++++--------------
tests/ref/vsynth/vsynth1-mpeg4-rc | 8 +++---
tests/ref/vsynth/vsynth2-mpeg4-rc | 8 +++---
tests/ref/vsynth/vsynth3-mpeg4-rc | 8 +++---
tests/ref/vsynth/vsynth_lena-mpeg4-rc | 8 +++---
6 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak
index a91c0ec3e3..f009cc68c8 100644
--- a/tests/fate/vcodec.mak
+++ b/tests/fate/vcodec.mak
@@ -330,7 +330,7 @@ fate-vsynth%-mpeg4-qprd: ENCOPTS = -b 450k -bf 2 -trellis 1 \
-flags +mv4 -mpv_flags +qp_rd+mv0 \
-cmp 2 -subcmp 2 -mbd rd
-fate-vsynth%-mpeg4-rc: ENCOPTS = -b 400k -bf 2
+fate-vsynth%-mpeg4-rc: ENCOPTS = -b 400k -bf 2 -mpeg_quant 1
fate-vsynth%-mpeg4-thread: ENCOPTS = -b 500k -flags +mv4+aic \
-data_partitioning 1 -trellis 1 \
diff --git a/tests/ref/seek/vsynth_lena-mpeg4-rc b/tests/ref/seek/vsynth_lena-mpeg4-rc
index e1994af948..a10a3ca07c 100644
--- a/tests/ref/seek/vsynth_lena-mpeg4-rc
+++ b/tests/ref/seek/vsynth_lena-mpeg4-rc
@@ -1,46 +1,46 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 15766
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 15471
ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 15766
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 15471
ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207954 size: 13826
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 200880 size: 15568
ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 153788 size: 13377
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 140756 size: 15473
ret:-1 st: 0 flags:1 ts:-0.320000
ret:-1 st:-1 flags:0 ts: 2.576668
ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180950 size: 13326
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 171606 size: 15125
ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 94578 size: 32807
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 84442 size: 30467
ret:-1 st: 0 flags:1 ts:-0.760000
ret:-1 st:-1 flags:0 ts: 2.153336
ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 153788 size: 13377
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 140756 size: 15473
ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 15766
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 15471
ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207954 size: 13826
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 200880 size: 15568
ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207954 size: 13826
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 200880 size: 15568
ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 94578 size: 32807
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 84442 size: 30467
ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 15766
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 15471
ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207954 size: 13826
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 200880 size: 15568
ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180950 size: 13326
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 171606 size: 15125
ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 15766
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 15471
ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 15766
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5652 size: 15471
ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207954 size: 13826
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 200880 size: 15568
ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 153788 size: 13377
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 140756 size: 15473
ret:-1 st:-1 flags:1 ts:-0.222493
ret:-1 st: 0 flags:0 ts: 2.680000
ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180950 size: 13326
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 171606 size: 15125
ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 153788 size: 13377
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 140756 size: 15473
ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/tests/ref/vsynth/vsynth1-mpeg4-rc b/tests/ref/vsynth/vsynth1-mpeg4-rc
index 5b1d7ff1e3..6ffe5a6154 100644
--- a/tests/ref/vsynth/vsynth1-mpeg4-rc
+++ b/tests/ref/vsynth/vsynth1-mpeg4-rc
@@ -1,4 +1,4 @@
-91c127f2acc04f51e0e62bcf0752e064 *tests/data/fate/vsynth1-mpeg4-rc.avi
-830498 tests/data/fate/vsynth1-mpeg4-rc.avi
-9dcd9d022ae14fe1e4a53aa4865464c6 *tests/data/fate/vsynth1-mpeg4-rc.out.rawvideo
-stddev: 10.24 PSNR: 27.92 MAXDIFF: 196 bytes: 7603200/ 7603200
+b245cb5212495d4a6148761cbf825a19 *tests/data/fate/vsynth1-mpeg4-rc.avi
+709952 tests/data/fate/vsynth1-mpeg4-rc.avi
+1a1c88d902d0a0a885150b0501d92fea *tests/data/fate/vsynth1-mpeg4-rc.out.rawvideo
+stddev: 10.86 PSNR: 27.41 MAXDIFF: 180 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth2-mpeg4-rc b/tests/ref/vsynth/vsynth2-mpeg4-rc
index ec7d7ba031..04af8ec633 100644
--- a/tests/ref/vsynth/vsynth2-mpeg4-rc
+++ b/tests/ref/vsynth/vsynth2-mpeg4-rc
@@ -1,4 +1,4 @@
-0cf3a444622becc5d56e9034b226cfe2 *tests/data/fate/vsynth2-mpeg4-rc.avi
-254738 tests/data/fate/vsynth2-mpeg4-rc.avi
-53ef615a87c8ae49c379242385315f61 *tests/data/fate/vsynth2-mpeg4-rc.out.rawvideo
-stddev: 5.57 PSNR: 33.20 MAXDIFF: 116 bytes: 7603200/ 7603200
+e860da1c3a49ecd038b03cbfdd56a122 *tests/data/fate/vsynth2-mpeg4-rc.avi
+242930 tests/data/fate/vsynth2-mpeg4-rc.avi
+b73f3a93ae66bdc6b5e6222c3eb82a43 *tests/data/fate/vsynth2-mpeg4-rc.out.rawvideo
+stddev: 5.37 PSNR: 33.52 MAXDIFF: 118 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth3-mpeg4-rc b/tests/ref/vsynth/vsynth3-mpeg4-rc
index fae06773d4..5c7a9a8ebd 100644
--- a/tests/ref/vsynth/vsynth3-mpeg4-rc
+++ b/tests/ref/vsynth/vsynth3-mpeg4-rc
@@ -1,4 +1,4 @@
-5b51e8f91fecd621cd3aa5d687659fbc *tests/data/fate/vsynth3-mpeg4-rc.avi
-81092 tests/data/fate/vsynth3-mpeg4-rc.avi
-07ba5baf141a24561f7dba43645a3400 *tests/data/fate/vsynth3-mpeg4-rc.out.rawvideo
-stddev: 2.62 PSNR: 39.74 MAXDIFF: 23 bytes: 86700/ 86700
+aea5b225d5f861c0cf48d21c58d78ec8 *tests/data/fate/vsynth3-mpeg4-rc.avi
+71278 tests/data/fate/vsynth3-mpeg4-rc.avi
+0c0726ce29ce31bf5184832ef352cf20 *tests/data/fate/vsynth3-mpeg4-rc.out.rawvideo
+stddev: 3.07 PSNR: 38.37 MAXDIFF: 23 bytes: 86700/ 86700
diff --git a/tests/ref/vsynth/vsynth_lena-mpeg4-rc b/tests/ref/vsynth/vsynth_lena-mpeg4-rc
index a21ddc87e3..236a0c38d3 100644
--- a/tests/ref/vsynth/vsynth_lena-mpeg4-rc
+++ b/tests/ref/vsynth/vsynth_lena-mpeg4-rc
@@ -1,4 +1,4 @@
-3ae5a2590bdd0e80a95bf374b06c553f *tests/data/fate/vsynth_lena-mpeg4-rc.avi
-226314 tests/data/fate/vsynth_lena-mpeg4-rc.avi
-27c8771df4154f2be317465a3d3cbd56 *tests/data/fate/vsynth_lena-mpeg4-rc.out.rawvideo
-stddev: 4.23 PSNR: 35.60 MAXDIFF: 85 bytes: 7603200/ 7603200
+38a0ac3b7148feb92faf7cb7c2b5efcb *tests/data/fate/vsynth_lena-mpeg4-rc.avi
+221168 tests/data/fate/vsynth_lena-mpeg4-rc.avi
+3af47cc4a9cc11e9a2e7035b26fa967d *tests/data/fate/vsynth_lena-mpeg4-rc.out.rawvideo
+stddev: 4.03 PSNR: 36.02 MAXDIFF: 71 bytes: 7603200/ 7603200
--
2.45.2
[-- Attachment #9: 0008-tests-fate-vcodec-Test-H.261-loop-filter.patch --]
[-- Type: text/x-patch, Size: 7556 bytes --]
From d7f39b55e6ffb9dc136bf2b1248888bc434cdd7c Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 6 Jul 2024 23:50:47 +0200
Subject: [PATCH 08/30] tests/fate/vcodec: Test H.261 loop-filter
Increases coverage.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
tests/fate/vcodec.mak | 2 +-
tests/ref/seek/vsynth_lena-h261 | 28 ++++++++++++++--------------
tests/ref/vsynth/vsynth1-h261 | 8 ++++----
tests/ref/vsynth/vsynth2-h261 | 8 ++++----
tests/ref/vsynth/vsynth_lena-h261 | 8 ++++----
5 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak
index f009cc68c8..8a9083d4ed 100644
--- a/tests/fate/vcodec.mak
+++ b/tests/fate/vcodec.mak
@@ -204,7 +204,7 @@ fate-vsynth%-flv: ENCOPTS = -qscale 10
fate-vsynth%-flv: FMT = flv
FATE_VCODEC-$(call ENCDEC, H261, AVI) += h261 h261-trellis
-fate-vsynth%-h261: ENCOPTS = -qscale 11
+fate-vsynth%-h261: ENCOPTS = -qscale 11 -flags +loop
fate-vsynth%-h261-trellis: ENCOPTS = -qscale 12 -trellis 1 -mbd rd
FATE_VCODEC-$(call ENCDEC, H263, AVI) += h263 h263-obmc h263p
diff --git a/tests/ref/seek/vsynth_lena-h261 b/tests/ref/seek/vsynth_lena-h261
index dabf6a3014..2560d6fda9 100644
--- a/tests/ref/seek/vsynth_lena-h261
+++ b/tests/ref/seek/vsynth_lena-h261
@@ -2,45 +2,45 @@ ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 9645
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 9645
ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126498 size: 11377
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 122896 size: 11377
ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 82056 size: 10322
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 79230 size: 10322
ret:-1 st: 0 flags:1 ts:-0.320000
ret:-1 st:-1 flags:0 ts: 2.576668
ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126498 size: 11377
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 122896 size: 11377
ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 44668 size: 9404
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 42130 size: 9404
ret:-1 st: 0 flags:1 ts:-0.760000
ret:-1 st:-1 flags:0 ts: 2.153336
ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 82056 size: 10322
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 79230 size: 10322
ret: 0 st: 0 flags:0 ts:-0.040000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 9645
ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175860 size: 11707
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 171314 size: 11707
ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175860 size: 11707
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 171314 size: 11707
ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 44668 size: 9404
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 42130 size: 9404
ret: 0 st: 0 flags:0 ts:-0.480000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 9645
ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175860 size: 11707
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 171314 size: 11707
ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126498 size: 11377
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 122896 size: 11377
ret: 0 st:-1 flags:1 ts: 0.200839
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 9645
ret: 0 st: 0 flags:0 ts:-0.920000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 9645
ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175860 size: 11707
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 171314 size: 11707
ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 82056 size: 10322
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 79230 size: 10322
ret:-1 st:-1 flags:1 ts:-0.222493
ret:-1 st: 0 flags:0 ts: 2.680000
ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126498 size: 11377
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 122896 size: 11377
ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 44668 size: 9404
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 42130 size: 9404
ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/tests/ref/vsynth/vsynth1-h261 b/tests/ref/vsynth/vsynth1-h261
index 65efd6011c..e6a4826672 100644
--- a/tests/ref/vsynth/vsynth1-h261
+++ b/tests/ref/vsynth/vsynth1-h261
@@ -1,4 +1,4 @@
-5a1114f9356235172ba9ad13f88108cf *tests/data/fate/vsynth1-h261.avi
-707550 tests/data/fate/vsynth1-h261.avi
-85fde92037c2ccecc02e2d6c21a169b0 *tests/data/fate/vsynth1-h261.out.rawvideo
-stddev: 9.11 PSNR: 28.93 MAXDIFF: 113 bytes: 7603200/ 7603200
+13fe599421ace0b923e4b5b3bc76532b *tests/data/fate/vsynth1-h261.avi
+818346 tests/data/fate/vsynth1-h261.avi
+d1677f37e2ee928bd5f9cb5b91d9fd18 *tests/data/fate/vsynth1-h261.out.rawvideo
+stddev: 9.38 PSNR: 28.69 MAXDIFF: 125 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth2-h261 b/tests/ref/vsynth/vsynth2-h261
index cc46cfc10c..5ecff0f5bb 100644
--- a/tests/ref/vsynth/vsynth2-h261
+++ b/tests/ref/vsynth/vsynth2-h261
@@ -1,4 +1,4 @@
-49ae672f343b45e9d18523634176b857 *tests/data/fate/vsynth2-h261.avi
-257938 tests/data/fate/vsynth2-h261.avi
-8962b6ea3153a828e5a4df68e1d5da44 *tests/data/fate/vsynth2-h261.out.rawvideo
-stddev: 7.21 PSNR: 30.97 MAXDIFF: 96 bytes: 7603200/ 7603200
+968de715b8d1d8a66b1f58aba12438d9 *tests/data/fate/vsynth2-h261.avi
+254032 tests/data/fate/vsynth2-h261.avi
+240abdcfd64899eab6e6d84ff7949a82 *tests/data/fate/vsynth2-h261.out.rawvideo
+stddev: 6.71 PSNR: 31.59 MAXDIFF: 106 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth_lena-h261 b/tests/ref/vsynth/vsynth_lena-h261
index 2522ad938f..9d302e51d0 100644
--- a/tests/ref/vsynth/vsynth_lena-h261
+++ b/tests/ref/vsynth/vsynth_lena-h261
@@ -1,4 +1,4 @@
-9a2104849cbcf03a612e5906ef4d264b *tests/data/fate/vsynth_lena-h261.avi
-191064 tests/data/fate/vsynth_lena-h261.avi
-08f65e9aeeeaf189548c2bb417d5114f *tests/data/fate/vsynth_lena-h261.out.rawvideo
-stddev: 6.37 PSNR: 32.03 MAXDIFF: 77 bytes: 7603200/ 7603200
+8df0b15d97c0a17d2969d99f59b1f5e1 *tests/data/fate/vsynth_lena-h261.avi
+186570 tests/data/fate/vsynth_lena-h261.avi
+289b6e4eb9af602b87309552335d43ee *tests/data/fate/vsynth_lena-h261.out.rawvideo
+stddev: 5.92 PSNR: 32.68 MAXDIFF: 80 bytes: 7603200/ 7603200
--
2.45.2
[-- Attachment #10: 0009-avcodec-h261dec-Remove-dead-check.patch --]
[-- Type: text/x-patch, Size: 1039 bytes --]
From 69a29bc1ba29e959d32045752fd553b4d2607a54 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 1 Jul 2024 12:30:29 +0200
Subject: [PATCH 09/30] avcodec/h261dec: Remove dead check
H.261 does not have non-reference frames.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/h261dec.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index cabca33c8d..50ac53167d 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -587,8 +587,7 @@ static int h261_decode_frame(AVCodecContext *avctx, AVFrame *pict,
return ret;
}
- if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) ||
- (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) ||
+ if ((avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) ||
avctx->skip_frame >= AVDISCARD_ALL)
return buf_size;
--
2.45.2
[-- Attachment #11: 0010-avcodec-h261dec-Inline-constant.patch --]
[-- Type: text/x-patch, Size: 877 bytes --]
From 061ce61a283f447d50b43ee33f2d492e7e15fa42 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sun, 7 Jul 2024 00:10:37 +0200
Subject: [PATCH 10/30] avcodec/h261dec: Inline constant
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/h261dec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 50ac53167d..116f1d43b2 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -262,7 +262,7 @@ static int h261_decode_block(H261DecContext *h, int16_t *block, int n, int coded
* being coded as 1111 1111. */
if (level == 255)
level = 128;
- block[0] = level * s->y_dc_scale;
+ block[0] = level * 8;
i = 1;
} else if (coded) {
// Run Level Code
--
2.45.2
[-- Attachment #12: 0011-avcodec-mpeg12dec-Remove-write-only-assignments.patch --]
[-- Type: text/x-patch, Size: 1620 bytes --]
From 529f2d2e584aa819d17e13bb27f538df1ca6c3e1 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 8 Jul 2024 14:55:45 +0200
Subject: [PATCH 11/30] avcodec/mpeg12dec: Remove write-only assignments
This decoder unquantizes while parsing blocks
and does not use dct_unquantize_mpeg1_intra
(which uses *_dc_scale) at all.
repeat_field was unused since
e0a3d744a0d5a9a25fb85c9bba17e3b07d3ba29b.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpeg12dec.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 262e213a61..48b35ed794 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -72,7 +72,6 @@ enum Mpeg2ClosedCaptionsFormat {
typedef struct Mpeg1Context {
MpegEncContext mpeg_enc_ctx;
- int repeat_field; /* true if we must repeat the field */
AVPanScan pan_scan; /* some temporary storage for the panscan */
enum AVStereo3DType stereo3d_type;
int has_stereo3d;
@@ -781,7 +780,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
ff_mpeg12_init_vlcs();
s2->chroma_format = 1;
- s->repeat_field = 0;
avctx->color_range = AVCOL_RANGE_MPEG;
return 0;
}
@@ -1050,8 +1048,6 @@ static int mpeg1_decode_picture(AVCodecContext *avctx, const uint8_t *buf,
av_log(avctx, AV_LOG_DEBUG,
"vbv_delay %d, ref %d type:%d\n", vbv_delay, ref, s->pict_type);
- s->y_dc_scale = 8;
- s->c_dc_scale = 8;
return 0;
}
--
2.45.2
[-- Attachment #13: 0012-avcodec-msmpeg4dec-Don-t-process-unnecessarily-many-.patch --]
[-- Type: text/x-patch, Size: 1838 bytes --]
From f4b1f8408fd37bdddcf66bf6ff4526f293a1c007 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 1 Jul 2024 19:18:06 +0200
Subject: [PATCH 12/30] avcodec/msmpeg4dec: Don't process unnecessarily many
coefficients
This code has been added in f5957f3fe2b8dfda13a9750acc3e3a03cd5d39c9
when support for WMV1 has been added. It was needed for decoding
inter macroblocks, as WMV1 uses a different scantable and
the ScanTable and ScanTable.raster_end was not yet introduced
(the H263 unquantize function instead used a hardcoded version
of ff_zigzag_direct's raster_end). In other words,
there is no reason to continue to do so for WMV1 inter blocks.
(Apart from that: WMV1 inter blocks don't use
dct_unquantize_h263_inter any more, as unquantizing happens
when parsing the block via specialized RL VLC tables.)
It is also not needed for WMV1/2 intra blocks (for non-ac_pred
it uses the correct ScanTable used by the h263 unquantize
intra function; for ac_pred, the number is overridden)
as well as for WMV2 inter-blocks (raster_end is not really
used in this case; the ordinary ScanTable is used in case
abt_type is zero, otherwise there are two different ScanTables
and block_last_index is overridden in wmv2dec.c).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/msmpeg4dec.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c
index 12bef4f506..da65ea797f 100644
--- a/libavcodec/msmpeg4dec.c
+++ b/libavcodec/msmpeg4dec.c
@@ -806,7 +806,6 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block,
i = 63; /* XXX: not optimal */
}
}
- if (s->msmpeg4_version >= MSMP4_WMV1 && i > 0) i=63; //FIXME/XXX optimize
s->block_last_index[n] = i;
return 0;
--
2.45.2
[-- Attachment #14: 0013-avcodec-msmpeg4dec-Avoid-branch.patch --]
[-- Type: text/x-patch, Size: 893 bytes --]
From 9b152c1de3a111cf1fa94b141fcf598ac209b490 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 1 Jul 2024 19:52:34 +0200
Subject: [PATCH 13/30] avcodec/msmpeg4dec: Avoid branch
A non-LTO-compiler can't optimize this away.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/msmpeg4dec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c
index da65ea797f..7ba6f4b1e6 100644
--- a/libavcodec/msmpeg4dec.c
+++ b/libavcodec/msmpeg4dec.c
@@ -799,8 +799,8 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block,
}
CLOSE_READER(re, &s->gb);
}
- not_coded:
if (s->mb_intra) {
+ not_coded:
ff_mpeg4_pred_ac(s, block, n, dc_pred_dir);
if (s->ac_pred) {
i = 63; /* XXX: not optimal */
--
2.45.2
[-- Attachment #15: 0014-avcodec-msmpeg4dec-Remove-redundant-check.patch --]
[-- Type: text/x-patch, Size: 1056 bytes --]
From 947018f43040b45d361c87e38b30943b962d030f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Tue, 25 Feb 2025 21:51:20 +0100
Subject: [PATCH 14/30] avcodec/msmpeg4dec: Remove redundant check
Since d50635cd247e17fe16c63219b9ae80d45a8185b1 the
dct_unquantize_h263_intra functions have set the number of
coefficients to 63 in case of ac_pred, so ff_msmpeg4_decode_block()
doesn't have to bump it on its own.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/msmpeg4dec.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c
index 7ba6f4b1e6..d42219f464 100644
--- a/libavcodec/msmpeg4dec.c
+++ b/libavcodec/msmpeg4dec.c
@@ -802,9 +802,6 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block,
if (s->mb_intra) {
not_coded:
ff_mpeg4_pred_ac(s, block, n, dc_pred_dir);
- if (s->ac_pred) {
- i = 63; /* XXX: not optimal */
- }
}
s->block_last_index[n] = i;
--
2.45.2
[-- Attachment #16: 0015-avcodec-mips-mpegvideo_mmi-Don-t-check-alternate_sca.patch --]
[-- Type: text/x-patch, Size: 1088 bytes --]
From e9bc81d4a7ebbc9b55e42e58763c3ecc64123c0b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 1 Jul 2024 22:43:33 +0200
Subject: [PATCH 15/30] avcodec/mips/mpegvideo_mmi: Don't check alternate_scan
unnecessarily
Forgotten in 4f7aeffd8c3607aea6464a20eba4cc9106173c52.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mips/mpegvideo_mmi.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/libavcodec/mips/mpegvideo_mmi.c b/libavcodec/mips/mpegvideo_mmi.c
index 7af421db6b..87d4aafd8c 100644
--- a/libavcodec/mips/mpegvideo_mmi.c
+++ b/libavcodec/mips/mpegvideo_mmi.c
@@ -356,10 +356,7 @@ void ff_dct_unquantize_mpeg2_intra_mmi(MpegEncContext *s, int16_t *block,
assert(s->block_last_index[n]>=0);
- if (s->alternate_scan)
- nCoeffs = 63;
- else
- nCoeffs = s->intra_scantable.raster_end[s->block_last_index[n]];
+ nCoeffs = s->intra_scantable.raster_end[s->block_last_index[n]];
if (n < 4)
block0 = block[0] * s->y_dc_scale;
--
2.45.2
[-- Attachment #17: 0016-avcodec-mpegvideo_enc-Don-t-set-h263_aic-unnecessari.patch --]
[-- Type: text/x-patch, Size: 931 bytes --]
From 0fb66d154a3e42a954ca9fd7c89fddb8c6d4b3a2 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Tue, 9 Jul 2024 19:59:49 +0200
Subject: [PATCH 16/30] avcodec/mpegvideo_enc: Don't set h263_aic unnecessarily
It will be set on a per-frame basis for RV20 later anyway.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegvideo_enc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index c5c2e0b8e3..87e02fa534 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -788,7 +788,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
avctx->delay = 0;
s->low_delay = 1;
s->modified_quant = 1;
- s->h263_aic = 1;
s->h263_plus = 1;
s->loop_filter = 1;
s->unrestricted_mv = 0;
--
2.45.2
[-- Attachment #18: 0017-avcodec-rv34-Don-t-update-block_index-unnecessarily.patch --]
[-- Type: text/x-patch, Size: 976 bytes --]
From 5298bbf898d5379ccfe7b9112473f788cf529834 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 8 Jun 2024 03:11:48 +0200
Subject: [PATCH 17/30] avcodec/rv34: Don't update block_index unnecessarily
It is unused by RV30 and RV40.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/rv34.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index d94285431e..d8d307f969 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1463,7 +1463,9 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
ff_init_block_index(s);
while(!check_slice_end(r, s)) {
- ff_update_block_index(s, 8, 0, 1);
+ s->dest[0] += 16;
+ s->dest[1] += 8;
+ s->dest[2] += 8;
if(r->si.type)
res = rv34_decode_inter_macroblock(r, r->intra_types + s->mb_x * 4 + 4);
--
2.45.2
[-- Attachment #19: 0018-avcodec-mpegvideo_dec-Don-t-sync-max_b_frames.patch --]
[-- Type: text/x-patch, Size: 898 bytes --]
From 169ffdf5a107766fb63ff032d35eb1b736e7ab38 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 24 Feb 2025 16:37:19 +0100
Subject: [PATCH 18/30] avcodec/mpegvideo_dec: Don't sync max_b_frames
Only the VC-1 decoder (which does not use frame-threading)
and encoders use it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegvideo_dec.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 53e02ad91c..ebbbc1df8b 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -134,7 +134,6 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
(char *) &s1->last_time_base);
// B-frame info
- s->max_b_frames = s1->max_b_frames;
s->low_delay = s1->low_delay;
// DivX handling (doesn't work)
--
2.45.2
[-- Attachment #20: 0019-avcodec-mpegvideo_dec-Move-syncing-DivX-stuff-to-mpe.patch --]
[-- Type: text/x-patch, Size: 3172 bytes --]
From 2a7ac5f71ddd871125fa0fed06e74b3a4faa245b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 24 Feb 2025 17:47:22 +0100
Subject: [PATCH 19/30] avcodec/mpegvideo_dec: Move syncing DivX-stuff to
mpeg4videodec.c
It is only used by MPEG-4 (and is used in h263dec.c and can therefore
not just be moved to Mpeg4DecContext...).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpeg4videodec.c | 14 ++++++++++++++
libavcodec/mpegvideo_dec.c | 16 ----------------
2 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index debcafc4c0..14e4de9a45 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3699,6 +3699,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst,
s->enhancement_type = s1->enhancement_type;
s->scalability = s1->scalability;
s->intra_dc_threshold = s1->intra_dc_threshold;
+ s->m.divx_packed = s1->m.divx_packed;
s->divx_version = s1->divx_version;
s->divx_build = s1->divx_build;
s->xvid_build = s1->xvid_build;
@@ -3714,6 +3715,19 @@ static int mpeg4_update_thread_context(AVCodecContext *dst,
memcpy(s->sprite_shift, s1->sprite_shift, sizeof(s1->sprite_shift));
memcpy(s->sprite_traj, s1->sprite_traj, sizeof(s1->sprite_traj));
+ if (s1->m.bitstream_buffer) {
+ av_fast_padded_malloc(&s->m.bitstream_buffer,
+ &s->m.allocated_bitstream_buffer_size,
+ s1->m.bitstream_buffer_size);
+ if (!s->m.bitstream_buffer) {
+ s->m.bitstream_buffer_size = 0;
+ return AVERROR(ENOMEM);
+ }
+ s->m.bitstream_buffer_size = s1->m.bitstream_buffer_size;
+ memcpy(s->m.bitstream_buffer, s1->m.bitstream_buffer,
+ s1->m.bitstream_buffer_size);
+ }
+
if (!init && s1->xvid_build >= 0)
ff_xvid_idct_init(&s->m.idsp, dst);
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index ebbbc1df8b..8d4ba341d5 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -136,22 +136,6 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
// B-frame info
s->low_delay = s1->low_delay;
- // DivX handling (doesn't work)
- s->divx_packed = s1->divx_packed;
-
- if (s1->bitstream_buffer) {
- av_fast_padded_malloc(&s->bitstream_buffer,
- &s->allocated_bitstream_buffer_size,
- s1->bitstream_buffer_size);
- if (!s->bitstream_buffer) {
- s->bitstream_buffer_size = 0;
- return AVERROR(ENOMEM);
- }
- s->bitstream_buffer_size = s1->bitstream_buffer_size;
- memcpy(s->bitstream_buffer, s1->bitstream_buffer,
- s1->bitstream_buffer_size);
- }
-
// MPEG-2/interlacing info
memcpy(&s->progressive_sequence, &s1->progressive_sequence,
(char *) &s1->rtp_mode - (char *) &s1->progressive_sequence);
--
2.45.2
[-- Attachment #21: 0020-avcodec-vc1-Add-max_b_frames-field-to-VC1Context.patch --]
[-- Type: text/x-patch, Size: 4654 bytes --]
From cd304f719a27a5e142659e3bc076d8a67110867e Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 24 Feb 2025 19:05:32 +0100
Subject: [PATCH 20/30] avcodec/vc1: Add max_b_frames field to VC1Context
Don't reuse MpegEncContext.max_b_frames, which is supposed
to be encoder-only.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/dxva2_vc1.c | 2 +-
libavcodec/mss2.c | 2 +-
libavcodec/nvdec_vc1.c | 2 +-
libavcodec/vc1.c | 4 ++--
libavcodec/vc1.h | 1 +
libavcodec/vdpau_vc1.c | 2 +-
6 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
index bc9ad9648e..a7b440c0d9 100644
--- a/libavcodec/dxva2_vc1.c
+++ b/libavcodec/dxva2_vc1.c
@@ -117,7 +117,7 @@ void ff_dxva2_vc1_fill_picture_parameters(AVCodecContext *avctx,
(v->multires << 5) |
(v->resync_marker << 4) |
(v->rangered << 3) |
- (s->max_b_frames );
+ (v->max_b_frames );
pp->bPicExtrapolation = (!v->interlace || v->fcm == PROGRESSIVE) ? 1 : 2;
pp->bPicDeblocked = ((!pp->bPicBackwardPrediction && v->overlap) << 6) |
((v->profile != PROFILE_ADVANCED && v->rangeredfrm) << 5) |
diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index 1888053eb2..74a25b3e55 100644
--- a/libavcodec/mss2.c
+++ b/libavcodec/mss2.c
@@ -844,7 +844,7 @@ static av_cold int wmv9_init(AVCodecContext *avctx)
v->resync_marker = 0;
v->rangered = 0;
- v->s.max_b_frames = avctx->max_b_frames = 0;
+ v->max_b_frames = avctx->max_b_frames = 0;
v->quantizer_mode = 0;
v->finterpflag = 0;
diff --git a/libavcodec/nvdec_vc1.c b/libavcodec/nvdec_vc1.c
index 0668863cb4..fbfba1ecb4 100644
--- a/libavcodec/nvdec_vc1.c
+++ b/libavcodec/nvdec_vc1.c
@@ -84,7 +84,7 @@ static int nvdec_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u
.multires = v->multires,
.syncmarker = v->resync_marker,
.rangered = v->rangered,
- .maxbframes = s->max_b_frames,
+ .maxbframes = v->max_b_frames,
.panscan_flag = v->panscanflag,
.refdist_flag = v->refdist_flag,
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index d263c70be7..dec3e16ea2 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -343,7 +343,7 @@ int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitCo
"RANGERED should be set to 0 in Simple Profile\n");
}
- v->s.max_b_frames = avctx->max_b_frames = get_bits(gb, 3); //common
+ v->max_b_frames = avctx->max_b_frames = get_bits(gb, 3); //common
v->quantizer_mode = get_bits(gb, 2); //common
v->finterpflag = get_bits1(gb); //common
@@ -431,7 +431,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n");
return -1;
}
- v->s.max_b_frames = v->s.avctx->max_b_frames = 7;
+ v->max_b_frames = v->s.avctx->max_b_frames = 7;
if (get_bits1(gb)) { //Display Info - decoding is not affected by it
int w, h, ar = 0;
av_log(v->s.avctx, AV_LOG_DEBUG, "Display extended info:\n");
diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h
index 185236662f..df814405d0 100644
--- a/libavcodec/vc1.h
+++ b/libavcodec/vc1.h
@@ -222,6 +222,7 @@ typedef struct VC1Context{
int dquant; ///< How qscale varies with MBs, 2 bits (not in Simple)
int vstransform; ///< variable-size [48]x[48] transform type + info
int overlap; ///< overlapped transforms in use
+ int max_b_frames;
int quantizer_mode; ///< 2 bits, quantizer mode used for sequence, see QUANT_*
int finterpflag; ///< INTERPFRM present
//@}
diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c
index d02a454bb8..20208c6dbc 100644
--- a/libavcodec/vdpau_vc1.c
+++ b/libavcodec/vdpau_vc1.c
@@ -92,7 +92,7 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx,
info->multires = v->multires;
info->syncmarker = v->resync_marker;
info->rangered = v->rangered | (v->rangeredfrm << 1);
- info->maxbframes = v->s.max_b_frames;
+ info->maxbframes = v->max_b_frames;
info->deblockEnable = v->postprocflag & 1;
info->pquant = v->pq;
--
2.45.2
[-- Attachment #22: 0021-avcodec-mpeg4videoenc-Remove-dead-FF_BUG_MS-code.patch --]
[-- Type: text/x-patch, Size: 3578 bytes --]
From 2b9cdcebb2b35663d7cc01b91a1bb4a6bfe6a423 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 24 Feb 2025 19:09:32 +0100
Subject: [PATCH 21/30] avcodec/mpeg4videoenc: Remove dead FF_BUG_MS code
Added in 59fa3f96f48d12e189492ca3670991f91c316d4e,
yet avctx->workaround_bugs is never copied to
MpegEncContext.workaround_bugs, so this code is dead
(it seems that this was true even when it was added).
Furthermore, workaround_bugs is flagged as decoder-only,
so just remove the code.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpeg4videoenc.c | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index bc5375002a..0b31576dc5 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -968,13 +968,9 @@ static void mpeg4_encode_vol_header(MpegEncContext *s,
put_bits(&s->pb, 1, 0); /* random access vol */
put_bits(&s->pb, 8, vo_type); /* video obj type indication */
- if (s->workaround_bugs & FF_BUG_MS) {
- put_bits(&s->pb, 1, 0); /* is obj layer id= no */
- } else {
- put_bits(&s->pb, 1, 1); /* is obj layer id= yes */
- put_bits(&s->pb, 4, vo_ver_id); /* is obj layer ver id */
- put_bits(&s->pb, 3, 1); /* is obj layer priority */
- }
+ put_bits(&s->pb, 1, 1); /* is obj layer id= yes */
+ put_bits(&s->pb, 4, vo_ver_id); /* is obj layer ver id */
+ put_bits(&s->pb, 3, 1); /* is obj layer priority */
aspect_ratio_info = ff_h263_aspect_to_info(s->avctx->sample_aspect_ratio);
@@ -986,14 +982,10 @@ static void mpeg4_encode_vol_header(MpegEncContext *s,
put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.den);
}
- if (s->workaround_bugs & FF_BUG_MS) {
- put_bits(&s->pb, 1, 0); /* vol control parameters= no @@@ */
- } else {
- put_bits(&s->pb, 1, 1); /* vol control parameters= yes */
- put_bits(&s->pb, 2, 1); /* chroma format YUV 420/YV12 */
- put_bits(&s->pb, 1, s->low_delay);
- put_bits(&s->pb, 1, 0); /* vbv parameters= no */
- }
+ put_bits(&s->pb, 1, 1); /* vol control parameters= yes */
+ put_bits(&s->pb, 2, 1); /* chroma format YUV 420/YV12 */
+ put_bits(&s->pb, 1, s->low_delay);
+ put_bits(&s->pb, 1, 0); /* vbv parameters= no */
put_bits(&s->pb, 2, RECT_SHAPE); /* vol shape= rectangle */
put_bits(&s->pb, 1, 1); /* marker bit */
@@ -1059,8 +1051,7 @@ int ff_mpeg4_encode_picture_header(MpegEncContext *s)
if (s->avctx->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT || s->picture_number == 0) // HACK, the reference sw is buggy
mpeg4_encode_vol_header(s, 0, 0);
}
- if (!(s->workaround_bugs & FF_BUG_MS))
- mpeg4_encode_gop_header(s);
+ mpeg4_encode_gop_header(s);
}
s->partitioned_frame = s->data_partitioning && s->pict_type != AV_PICTURE_TYPE_B;
@@ -1300,8 +1291,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
return AVERROR(ENOMEM);
init_put_bits(&s->pb, s->avctx->extradata, 1024);
- if (!(s->workaround_bugs & FF_BUG_MS))
- mpeg4_encode_visual_object_header(s);
+ mpeg4_encode_visual_object_header(s);
mpeg4_encode_vol_header(s, 0, 0);
// ff_mpeg4_stuffing(&s->pb); ?
--
2.45.2
[-- Attachment #23: 0022-avcodec-h26-134-dec-Always-report-the-buffer-to-be-c.patch --]
[-- Type: text/x-patch, Size: 4859 bytes --]
From 5080802f42c4a3ba5fad87eb149c4e7192744634 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 24 Feb 2025 19:30:27 +0100
Subject: [PATCH 22/30] avcodec/h26[134]dec: Always report the buffer to be
completely consumed
It is pointless to try to report the true number because
decode_simple_internal() always treats the buffer as
completely consumed for video codecs anyway.
(Apart from that: The h263dec code would report to only
have consumed the header data in case decoding is aborted
due to skip_frame which makes no sense.)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/h261dec.c | 16 +---------------
libavcodec/h263dec.c | 31 ++++---------------------------
libavcodec/h264dec.c | 15 +--------------
3 files changed, 6 insertions(+), 56 deletions(-)
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 116f1d43b2..8a2c4d35b4 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -536,20 +536,6 @@ static int h261_decode_gob(H261DecContext *h)
return -1;
}
-/**
- * returns the number of bytes consumed for building the current frame
- */
-static int get_consumed_bytes(MpegEncContext *s, int buf_size)
-{
- int pos = get_bits_count(&s->gb) >> 3;
- if (pos == 0)
- pos = 1; // avoid infinite loops (i doubt that is needed but ...)
- if (pos + 10 > buf_size)
- pos = buf_size; // oops ;)
-
- return pos;
-}
-
static int h261_decode_frame(AVCodecContext *avctx, AVFrame *pict,
int *got_frame, AVPacket *avpkt)
{
@@ -615,7 +601,7 @@ static int h261_decode_frame(AVCodecContext *avctx, AVFrame *pict,
*got_frame = 1;
- return get_consumed_bytes(s, buf_size);
+ return buf_size;
}
const FFCodec ff_h261_decoder = {
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 452641e408..fa1146f025 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -170,29 +170,6 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
return 0;
}
-/**
- * Return the number of bytes consumed for building the current frame.
- */
-static int get_consumed_bytes(MpegEncContext *s, int buf_size)
-{
- int pos = (get_bits_count(&s->gb) + 7) >> 3;
-
- if (s->divx_packed || s->avctx->hwaccel) {
- /* We would have to scan through the whole buf to handle the weird
- * reordering ... */
- return buf_size;
- } else {
- // avoid infinite loops (maybe not needed...)
- if (pos == 0)
- pos = 1;
- // oops ;)
- if (pos + 10 > buf_size)
- pos = buf_size;
-
- return pos;
- }
-}
-
static int decode_slice(MpegEncContext *s)
{
const int part_mask = s->partitioned_frame
@@ -523,7 +500,7 @@ retry:
}
}
if (ret == FRAME_SKIPPED)
- return get_consumed_bytes(s, buf_size);
+ return buf_size;
/* skip if the header was thrashed */
if (ret < 0) {
@@ -587,13 +564,13 @@ retry:
/* skip B-frames if we don't have reference frames */
if (!s->last_pic.ptr &&
(s->pict_type == AV_PICTURE_TYPE_B || s->droppable))
- return get_consumed_bytes(s, buf_size);
+ return buf_size;
if ((avctx->skip_frame >= AVDISCARD_NONREF &&
s->pict_type == AV_PICTURE_TYPE_B) ||
(avctx->skip_frame >= AVDISCARD_NONKEY &&
s->pict_type != AV_PICTURE_TYPE_I) ||
avctx->skip_frame >= AVDISCARD_ALL)
- return get_consumed_bytes(s, buf_size);
+ return buf_size;
if ((ret = ff_mpv_frame_start(s, avctx)) < 0)
return ret;
@@ -702,7 +679,7 @@ frame_end:
if (slice_ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
return slice_ret;
else
- return get_consumed_bytes(s, buf_size);
+ return buf_size;
}
static const AVCodecHWConfigInternal *const h263_hw_config_list[] = {
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 45ebe2656d..fd401027d6 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -827,19 +827,6 @@ end:
return (ret < 0) ? ret : buf_size;
}
-/**
- * Return the number of bytes consumed for building the current frame.
- */
-static int get_consumed_bytes(int pos, int buf_size)
-{
- if (pos == 0)
- pos = 1; // avoid infinite loops (I doubt that is needed but...)
- if (pos + 10 > buf_size)
- pos = buf_size; // oops ;)
-
- return pos;
-}
-
static int h264_export_enc_params(AVFrame *f, const H264Picture *p)
{
AVVideoEncParams *par;
@@ -1100,7 +1087,7 @@ static int h264_decode_frame(AVCodecContext *avctx, AVFrame *pict,
ff_h264_unref_picture(&h->last_pic_for_ec);
- return get_consumed_bytes(buf_index, buf_size);
+ return buf_size;
}
#define OFFSET(x) offsetof(H264Context, x)
--
2.45.2
[-- Attachment #24: 0023-avcodec-mpeg12dec-Don-t-initialize-unused-parts-of-S.patch --]
[-- Type: text/x-patch, Size: 2242 bytes --]
From b7aafec6bb9c3a88ac197dec227a276e2228c942 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 24 Feb 2025 20:43:46 +0100
Subject: [PATCH 23/30] avcodec/mpeg12dec: Don't initialize unused parts of
ScanTable
The MPEG-1/2 decoders don't need ScanTable.raster_end
(as the coefficients are unquantized as they are parsed).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpeg12dec.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 48b35ed794..abef0a6155 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1228,10 +1228,10 @@ static int mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
s->chroma_420_type = get_bits1(&s->gb);
s->progressive_frame = get_bits1(&s->gb);
- // We only initialize intra_scantable, as both scantables always coincide
- // and all code therefore only uses the intra one.
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable,
- s->alternate_scan ? ff_alternate_vertical_scan : ff_zigzag_direct);
+ // We only initialize intra_scantable.permutated, as this is all we use.
+ ff_permute_scantable(s->intra_scantable.permutated,
+ s->alternate_scan ? ff_alternate_vertical_scan : ff_zigzag_direct,
+ s->idsp.idct_permutation);
/* composite display not parsed */
ff_dlog(s->avctx, "intra_dc_precision=%d\n", s->intra_dc_precision);
@@ -2803,8 +2803,9 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame,
m->intra_vlc_format = !!(s->flags & 0x20);
m->alternate_scan = !!(s->flags & 0x10);
- ff_init_scantable(m->idsp.idct_permutation, &m->intra_scantable,
- s->flags & 0x10 ? ff_alternate_vertical_scan : ff_zigzag_direct);
+ ff_permute_scantable(m->intra_scantable.permutated,
+ s->flags & 0x10 ? ff_alternate_vertical_scan : ff_zigzag_direct,
+ m->idsp.idct_permutation);
m->last_dc[0] = m->last_dc[1] = m->last_dc[2] = 1 << (7 + (s->flags & 3));
m->qscale = 1;
--
2.45.2
[-- Attachment #25: 0024-avcodec-h263dec-Don-t-call-ff_thread_finish_setup-un.patch --]
[-- Type: text/x-patch, Size: 1528 bytes --]
From 188488b3d79d52d57347ac01482e756e044aeef5 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 24 Feb 2025 22:16:36 +0100
Subject: [PATCH 24/30] avcodec/h263dec: Don't call ff_thread_finish_setup()
unnecessarily
All hwaccels for MPEG-4/H.263 are run serially even when frame-threading
is in use. Therefore there is no gain in calling
ff_thread_finish_setup() in this case right before outputting
the frame.
Removing this call also allows to revert commit
39a5c0ac0651113750d01f3ee6bcf3819de3d7ee.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/h263dec.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index fa1146f025..2d8c200589 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -575,7 +575,7 @@ retry:
if ((ret = ff_mpv_frame_start(s, avctx)) < 0)
return ret;
- if (!s->divx_packed && !avctx->hwaccel)
+ if (!s->divx_packed)
ff_thread_finish_setup(avctx);
if (avctx->hwaccel) {
@@ -647,9 +647,6 @@ frame_end:
if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4)
ff_mpeg4_frame_end(avctx, buf, buf_size);
- if (!s->divx_packed && avctx->hwaccel)
- ff_thread_finish_setup(avctx);
-
av_assert1(s->pict_type == s->cur_pic.ptr->f->pict_type);
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
if ((ret = av_frame_ref(pict, s->cur_pic.ptr->f)) < 0)
--
2.45.2
[-- Attachment #26: 0025-avcodec-mpegvideo-Move-bitstream_buffer-to-mpeg4vide.patch --]
[-- Type: text/x-patch, Size: 14150 bytes --]
From 82bc12ad189ca2e71732e387dd29598d70b16c83 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Tue, 25 Feb 2025 00:48:08 +0100
Subject: [PATCH 25/30] avcodec/mpegvideo: Move bitstream_buffer to
mpeg4videodec
This is possible by moving the code using it to open a GetBitContext
from h263dec.c to mpeg4videodec.c.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/h263dec.c | 25 ++-------
libavcodec/mpeg4video_parser.c | 4 +-
libavcodec/mpeg4videodec.c | 95 ++++++++++++++++++++++++++--------
libavcodec/mpeg4videodec.h | 8 ++-
libavcodec/mpegvideo.c | 5 --
libavcodec/mpegvideo.h | 3 --
libavcodec/mpegvideo_dec.c | 3 --
7 files changed, 85 insertions(+), 58 deletions(-)
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 2d8c200589..84895a93d4 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -446,26 +446,8 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
}
retry:
- if (s->divx_packed && s->bitstream_buffer_size) {
- int i;
- for(i=0; i < buf_size-3; i++) {
- if (buf[i]==0 && buf[i+1]==0 && buf[i+2]==1) {
- if (buf[i+3]==0xB0) {
- av_log(s->avctx, AV_LOG_WARNING, "Discarding excessive bitstream in packed xvid\n");
- s->bitstream_buffer_size = 0;
- }
- break;
- }
- }
- }
-
- if (s->bitstream_buffer_size && (s->divx_packed || buf_size <= MAX_NVOP_SIZE)) // divx 5.01+/xvid frame reorder
- ret = init_get_bits8(&s->gb, s->bitstream_buffer,
- s->bitstream_buffer_size);
- else
- ret = init_get_bits8(&s->gb, buf, buf_size);
-
- s->bitstream_buffer_size = 0;
+ // s->gb might be overridden in ff_mpeg4_decode_picture_header() below.
+ ret = init_get_bits8(&s->gb, buf, buf_size);
if (ret < 0)
return ret;
@@ -480,7 +462,7 @@ retry:
ret = ff_msmpeg4_decode_picture_header(s);
#endif
} else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
- ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb, 0, 0);
+ ret = ff_mpeg4_decode_picture_header(s);
s->skipped_last_frame = (ret == FRAME_SKIPPED);
} else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
ret = ff_intel_h263_decode_picture_header(s);
@@ -631,7 +613,6 @@ retry:
ff_msmpeg4_decode_ext_header(s, buf_size) < 0)
s->er.error_status_table[s->mb_num - 1] = ER_MB_ERROR;
- av_assert1(s->bitstream_buffer_size == 0);
frame_end:
if (!s->studio_profile)
ff_er_frame_end(&s->er, NULL);
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index b00b523bde..ef9ea923f6 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -92,13 +92,13 @@ static int mpeg4_decode_header(AVCodecParserContext *s1, AVCodecContext *avctx,
if (avctx->extradata_size && pc->first_picture) {
init_get_bits(gb, avctx->extradata, avctx->extradata_size * 8);
- ret = ff_mpeg4_decode_picture_header(dec_ctx, gb, 1, 1);
+ ret = ff_mpeg4_parse_picture_header(dec_ctx, gb, 1, 1);
if (ret < 0)
av_log(avctx, AV_LOG_WARNING, "Failed to parse extradata\n");
}
init_get_bits(gb, buf, 8 * buf_size);
- ret = ff_mpeg4_decode_picture_header(dec_ctx, gb, 0, 1);
+ ret = ff_mpeg4_parse_picture_header(dec_ctx, gb, 0, 1);
if (s->width && (!avctx->width || !avctx->height ||
!avctx->coded_width || !avctx->coded_height)) {
ret = ff_set_dimensions(avctx, s->width, s->height);
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 14e4de9a45..e2ae09125a 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -25,6 +25,7 @@
#include "config_components.h"
#include "libavutil/internal.h"
+#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/thread.h"
#include "codec_internal.h"
@@ -3463,8 +3464,8 @@ static int decode_studiovisualobject(Mpeg4DecContext *ctx, GetBitContext *gb)
* FRAME_SKIPPED if a not coded VOP is found
* 0 else
*/
-int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb,
- int header, int parse_only)
+int ff_mpeg4_parse_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb,
+ int header, int parse_only)
{
MpegEncContext *s = &ctx->m;
unsigned startcode, v;
@@ -3621,16 +3622,50 @@ end:
return decode_vop_header(ctx, gb, parse_only);
}
+int ff_mpeg4_decode_picture_header(MpegEncContext *s)
+{
+ Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s;
+
+ if (ctx->bitstream_buffer_size) {
+ int buf_size = get_bits_left(&s->gb) / 8U;
+ int bitstream_buffer_size = ctx->bitstream_buffer_size;
+ const uint8_t *buf = s->gb.buffer;
+
+ if (s->divx_packed) {
+ for (int i = 0; i < buf_size - 3; i++) {
+ if (buf[i] == 0 && buf[i+1] == 0 && buf[i+2] == 1) {
+ if (buf[i+3] == 0xB0) {
+ av_log(s->avctx, AV_LOG_WARNING, "Discarding excessive bitstream in packed xvid\n");
+ bitstream_buffer_size = 0;
+ }
+ break;
+ }
+ }
+ }
+ ctx->bitstream_buffer_size = 0;
+ if (bitstream_buffer_size && (s->divx_packed || buf_size <= MAX_NVOP_SIZE)) {// divx 5.01+/xvid frame reorder
+ int ret = init_get_bits8(&s->gb, ctx->bitstream_buffer,
+ bitstream_buffer_size);
+ if (ret < 0)
+ return ret;
+ }
+ }
+
+ return ff_mpeg4_parse_picture_header(ctx, &s->gb, 0, 0);
+}
+
int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
{
Mpeg4DecContext *ctx = avctx->priv_data;
MpegEncContext *s = &ctx->m;
+ av_assert1(ctx->bitstream_buffer_size == 0);
+
/* divx 5.01+ bitstream reorder stuff */
/* Since this clobbers the input buffer and hwaccel codecs still need the
* data during hwaccel->end_frame we should not do this any earlier */
if (s->divx_packed) {
- int current_pos = s->gb.buffer == s->bitstream_buffer ? 0 : (get_bits_count(&s->gb) >> 3);
+ int current_pos = s->gb.buffer == ctx->bitstream_buffer ? 0 : (get_bits_count(&s->gb) >> 3);
int startcode_found = 0;
if (buf_size - current_pos > 7) {
@@ -3654,16 +3689,16 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
"Consider using the mpeg4_unpack_bframes bitstream filter without encoding but stream copy to fix it.\n");
ctx->showed_packed_warning = 1;
}
- av_fast_padded_malloc(&s->bitstream_buffer,
- &s->allocated_bitstream_buffer_size,
+ av_fast_padded_malloc(&ctx->bitstream_buffer,
+ &ctx->allocated_bitstream_buffer_size,
buf_size - current_pos);
- if (!s->bitstream_buffer) {
- s->bitstream_buffer_size = 0;
+ if (!ctx->bitstream_buffer) {
+ ctx->bitstream_buffer_size = 0;
return AVERROR(ENOMEM);
}
- memcpy(s->bitstream_buffer, buf + current_pos,
+ memcpy(ctx->bitstream_buffer, buf + current_pos,
buf_size - current_pos);
- s->bitstream_buffer_size = buf_size - current_pos;
+ ctx->bitstream_buffer_size = buf_size - current_pos;
}
}
@@ -3715,17 +3750,17 @@ static int mpeg4_update_thread_context(AVCodecContext *dst,
memcpy(s->sprite_shift, s1->sprite_shift, sizeof(s1->sprite_shift));
memcpy(s->sprite_traj, s1->sprite_traj, sizeof(s1->sprite_traj));
- if (s1->m.bitstream_buffer) {
- av_fast_padded_malloc(&s->m.bitstream_buffer,
- &s->m.allocated_bitstream_buffer_size,
- s1->m.bitstream_buffer_size);
- if (!s->m.bitstream_buffer) {
- s->m.bitstream_buffer_size = 0;
+ if (s1->bitstream_buffer) {
+ av_fast_padded_malloc(&s->bitstream_buffer,
+ &s->allocated_bitstream_buffer_size,
+ s1->bitstream_buffer_size);
+ if (!s->bitstream_buffer) {
+ s->bitstream_buffer_size = 0;
return AVERROR(ENOMEM);
}
- s->m.bitstream_buffer_size = s1->m.bitstream_buffer_size;
- memcpy(s->m.bitstream_buffer, s1->m.bitstream_buffer,
- s1->m.bitstream_buffer_size);
+ s->bitstream_buffer_size = s1->bitstream_buffer_size;
+ memcpy(s->bitstream_buffer, s1->bitstream_buffer,
+ s1->bitstream_buffer_size);
}
if (!init && s1->xvid_build >= 0)
@@ -3825,12 +3860,30 @@ static av_cold int decode_init(AVCodecContext *avctx)
GetBitContext gb;
if (init_get_bits8(&gb, avctx->extradata, avctx->extradata_size) >= 0)
- ff_mpeg4_decode_picture_header(ctx, &gb, 1, 0);
+ ff_mpeg4_parse_picture_header(ctx, &gb, 1, 0);
}
return 0;
}
+static av_cold void mpeg4_flush(AVCodecContext *avctx)
+{
+ Mpeg4DecContext *const ctx = avctx->priv_data;
+
+ ctx->bitstream_buffer_size = 0;
+ ff_mpeg_flush(avctx);
+}
+
+static av_cold int mpeg4_close(AVCodecContext *avctx)
+{
+ Mpeg4DecContext *const ctx = avctx->priv_data;
+
+ ctx->bitstream_buffer_size = 0;
+ av_freep(&ctx->bitstream_buffer);
+
+ return ff_mpv_decode_close(avctx);
+}
+
#define OFFSET(x) offsetof(MpegEncContext, x)
#define FLAGS AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY
static const AVOption mpeg4_options[] = {
@@ -3854,12 +3907,12 @@ const FFCodec ff_mpeg4_decoder = {
.priv_data_size = sizeof(Mpeg4DecContext),
.init = decode_init,
FF_CODEC_DECODE_CB(ff_h263_decode_frame),
- .close = ff_mpv_decode_close,
+ .close = mpeg4_close,
.p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
AV_CODEC_CAP_DELAY | AV_CODEC_CAP_FRAME_THREADS,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP |
FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
- .flush = ff_mpeg_flush,
+ .flush = mpeg4_flush,
.p.max_lowres = 3,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_mpeg4_video_profiles),
UPDATE_THREAD_CONTEXT(mpeg4_update_thread_context),
diff --git a/libavcodec/mpeg4videodec.h b/libavcodec/mpeg4videodec.h
index 734237b16f..c4f6897c73 100644
--- a/libavcodec/mpeg4videodec.h
+++ b/libavcodec/mpeg4videodec.h
@@ -70,6 +70,9 @@ typedef struct Mpeg4DecContext {
int divx_build;
int xvid_build;
int lavc_build;
+ uint8_t *bitstream_buffer; //Divx 5.01 puts several frames in a single one, this is used to reorder them
+ int bitstream_buffer_size;
+ unsigned int allocated_bitstream_buffer_size;
int vo_type;
@@ -92,8 +95,9 @@ typedef struct Mpeg4DecContext {
int16_t dpcm_macroblock[3][256];
} Mpeg4DecContext;
-int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb,
- int header, int parse_only);
+int ff_mpeg4_decode_picture_header(MpegEncContext *s);
+int ff_mpeg4_parse_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb,
+ int header, int parse_only);
void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb,
uint8_t *dest_cr, int block_size, int uvlinesize,
int dct_linesize, int dct_offset);
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 804c8095b2..73c513acbd 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -660,8 +660,6 @@ static void clear_context(MpegEncContext *s)
memset(&s->sc, 0, sizeof(s->sc));
- s->bitstream_buffer = NULL;
- s->allocated_bitstream_buffer_size = 0;
s->p_field_mv_table_base = NULL;
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++)
@@ -777,9 +775,6 @@ void ff_mpv_common_end(MpegEncContext *s)
if (s->slice_context_count > 1)
s->slice_context_count = 1;
- av_freep(&s->bitstream_buffer);
- s->allocated_bitstream_buffer_size = 0;
-
ff_mpv_unref_picture(&s->last_pic);
ff_mpv_unref_picture(&s->cur_pic);
ff_mpv_unref_picture(&s->next_pic);
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index eb71198190..48fc1d418e 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -395,9 +395,6 @@ typedef struct MpegEncContext {
/* divx specific, used to workaround (many) bugs in divx5 */
int divx_packed;
- uint8_t *bitstream_buffer; //Divx 5.01 puts several frames in a single one, this is used to reorder them
- int bitstream_buffer_size;
- unsigned int allocated_bitstream_buffer_size;
/* RV10 specific */
int rv10_version; ///< RV10 version: 0 or 3
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 8d4ba341d5..532d8cf5c1 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -97,8 +97,6 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
s->context_reinit = 0;
s->avctx = dst;
s->private_ctx = private_ctx;
- s->bitstream_buffer = NULL;
- s->bitstream_buffer_size = s->allocated_bitstream_buffer_size = 0;
if (s1->context_initialized) {
if ((err = ff_mpv_common_init(s)) < 0)
@@ -439,7 +437,6 @@ void ff_mpeg_flush(AVCodecContext *avctx)
s->mb_x = s->mb_y = 0;
- s->bitstream_buffer_size = 0;
s->pp_time = 0;
}
--
2.45.2
[-- Attachment #27: 0026-avcodec-mpeg4videodec-Avoid-copying-packed-bitstream.patch --]
[-- Type: text/x-patch, Size: 7165 bytes --]
From 915b7f85499a2e9ba90075d44e064539bd499668 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Tue, 25 Feb 2025 16:21:07 +0100
Subject: [PATCH 26/30] avcodec/mpeg4videodec: Avoid copying packed bitstream
data
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/h263dec.c | 2 +-
libavcodec/mpeg4videodec.c | 57 ++++++++++++++------------------------
libavcodec/mpeg4videodec.h | 7 ++---
3 files changed, 25 insertions(+), 41 deletions(-)
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 84895a93d4..9ccdd914ce 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -626,7 +626,7 @@ frame_end:
ff_mpv_frame_end(s);
if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4)
- ff_mpeg4_frame_end(avctx, buf, buf_size);
+ ff_mpeg4_frame_end(avctx, avpkt);
av_assert1(s->pict_type == s->cur_pic.ptr->f->pict_type);
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index e2ae09125a..eace43b4cb 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -25,7 +25,6 @@
#include "config_components.h"
#include "libavutil/internal.h"
-#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/thread.h"
#include "codec_internal.h"
@@ -3626,9 +3625,9 @@ int ff_mpeg4_decode_picture_header(MpegEncContext *s)
{
Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s;
- if (ctx->bitstream_buffer_size) {
+ if (ctx->bitstream_buffer) {
int buf_size = get_bits_left(&s->gb) / 8U;
- int bitstream_buffer_size = ctx->bitstream_buffer_size;
+ int bitstream_buffer_size = ctx->bitstream_buffer->size;
const uint8_t *buf = s->gb.buffer;
if (s->divx_packed) {
@@ -3642,31 +3641,33 @@ int ff_mpeg4_decode_picture_header(MpegEncContext *s)
}
}
}
- ctx->bitstream_buffer_size = 0;
+ ctx->bitstream_buffer->size = 0;
if (bitstream_buffer_size && (s->divx_packed || buf_size <= MAX_NVOP_SIZE)) {// divx 5.01+/xvid frame reorder
- int ret = init_get_bits8(&s->gb, ctx->bitstream_buffer,
+ int ret = init_get_bits8(&s->gb, ctx->bitstream_buffer->data,
bitstream_buffer_size);
if (ret < 0)
return ret;
- }
+ } else
+ av_buffer_unref(&ctx->bitstream_buffer);
}
return ff_mpeg4_parse_picture_header(ctx, &s->gb, 0, 0);
}
-int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
+int ff_mpeg4_frame_end(AVCodecContext *avctx, const AVPacket *pkt)
{
Mpeg4DecContext *ctx = avctx->priv_data;
MpegEncContext *s = &ctx->m;
+ int ret;
- av_assert1(ctx->bitstream_buffer_size == 0);
+ av_assert1(!ctx->bitstream_buffer || !ctx->bitstream_buffer->size);
/* divx 5.01+ bitstream reorder stuff */
- /* Since this clobbers the input buffer and hwaccel codecs still need the
- * data during hwaccel->end_frame we should not do this any earlier */
if (s->divx_packed) {
- int current_pos = s->gb.buffer == ctx->bitstream_buffer ? 0 : (get_bits_count(&s->gb) >> 3);
+ int current_pos = ctx->bitstream_buffer && s->gb.buffer == ctx->bitstream_buffer->data ? 0 : (get_bits_count(&s->gb) >> 3);
int startcode_found = 0;
+ uint8_t *buf = pkt->data;
+ int buf_size = pkt->size;
if (buf_size - current_pos > 7) {
@@ -3689,16 +3690,12 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
"Consider using the mpeg4_unpack_bframes bitstream filter without encoding but stream copy to fix it.\n");
ctx->showed_packed_warning = 1;
}
- av_fast_padded_malloc(&ctx->bitstream_buffer,
- &ctx->allocated_bitstream_buffer_size,
- buf_size - current_pos);
- if (!ctx->bitstream_buffer) {
- ctx->bitstream_buffer_size = 0;
- return AVERROR(ENOMEM);
- }
- memcpy(ctx->bitstream_buffer, buf + current_pos,
- buf_size - current_pos);
- ctx->bitstream_buffer_size = buf_size - current_pos;
+ ret = av_buffer_replace(&ctx->bitstream_buffer, pkt->buf);
+ if (ret < 0)
+ return ret;
+
+ ctx->bitstream_buffer->data = buf + current_pos;
+ ctx->bitstream_buffer->size = buf_size - current_pos;
}
}
@@ -3750,18 +3747,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst,
memcpy(s->sprite_shift, s1->sprite_shift, sizeof(s1->sprite_shift));
memcpy(s->sprite_traj, s1->sprite_traj, sizeof(s1->sprite_traj));
- if (s1->bitstream_buffer) {
- av_fast_padded_malloc(&s->bitstream_buffer,
- &s->allocated_bitstream_buffer_size,
- s1->bitstream_buffer_size);
- if (!s->bitstream_buffer) {
- s->bitstream_buffer_size = 0;
- return AVERROR(ENOMEM);
- }
- s->bitstream_buffer_size = s1->bitstream_buffer_size;
- memcpy(s->bitstream_buffer, s1->bitstream_buffer,
- s1->bitstream_buffer_size);
- }
+ ret = av_buffer_replace(&s->bitstream_buffer, s1->bitstream_buffer);
if (!init && s1->xvid_build >= 0)
ff_xvid_idct_init(&s->m.idsp, dst);
@@ -3870,7 +3856,7 @@ static av_cold void mpeg4_flush(AVCodecContext *avctx)
{
Mpeg4DecContext *const ctx = avctx->priv_data;
- ctx->bitstream_buffer_size = 0;
+ av_buffer_unref(&ctx->bitstream_buffer);
ff_mpeg_flush(avctx);
}
@@ -3878,8 +3864,7 @@ static av_cold int mpeg4_close(AVCodecContext *avctx)
{
Mpeg4DecContext *const ctx = avctx->priv_data;
- ctx->bitstream_buffer_size = 0;
- av_freep(&ctx->bitstream_buffer);
+ av_buffer_unref(&ctx->bitstream_buffer);
return ff_mpv_decode_close(avctx);
}
diff --git a/libavcodec/mpeg4videodec.h b/libavcodec/mpeg4videodec.h
index c4f6897c73..bb14d24c88 100644
--- a/libavcodec/mpeg4videodec.h
+++ b/libavcodec/mpeg4videodec.h
@@ -70,9 +70,8 @@ typedef struct Mpeg4DecContext {
int divx_build;
int xvid_build;
int lavc_build;
- uint8_t *bitstream_buffer; //Divx 5.01 puts several frames in a single one, this is used to reorder them
- int bitstream_buffer_size;
- unsigned int allocated_bitstream_buffer_size;
+ /// Divx 5.01 puts several frames in a single one, this is used to reorder them
+ AVBufferRef *bitstream_buffer;
int vo_type;
@@ -110,7 +109,7 @@ int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx);
int ff_mpeg4_workaround_bugs(AVCodecContext *avctx);
void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n,
int dir);
-int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
+int ff_mpeg4_frame_end(AVCodecContext *avctx, const AVPacket *pkt);
#endif
--
2.45.2
[-- Attachment #28: 0027-avcodec-mpeg12dec-Really-disable-scratchpad-allocati.patch --]
[-- Type: text/x-patch, Size: 1454 bytes --]
From 8c642f070b1c7e9f8f2d57adc879829f80bd90c8 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Tue, 25 Feb 2025 16:40:56 +0100
Subject: [PATCH 27/30] avcodec/mpeg12dec: Really disable scratchpad
allocations
ba341be09533a077075c71fce5f9dc5b73504234 disabled them for
the main thread only, not the slice threads.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpeg12dec.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index abef0a6155..843640edbf 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1001,7 +1001,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
if ((ret = ff_mpv_common_init(s)) < 0)
return ret;
if (!s->avctx->lowres)
- ff_mpv_framesize_disable(&s->sc);
+ for (int i = 0; i < s->slice_context_count; i++)
+ ff_mpv_framesize_disable(&s->thread_context[i]->sc);
}
return 0;
}
@@ -1874,7 +1875,8 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
if ((ret = ff_mpv_common_init(s)) < 0)
return ret;
if (!s->avctx->lowres)
- ff_mpv_framesize_disable(&s->sc);
+ for (int i = 0; i < s->slice_context_count; i++)
+ ff_mpv_framesize_disable(&s->thread_context[i]->sc);
for (i = 0; i < 64; i++) {
int j = s->idsp.idct_permutation[i];
--
2.45.2
[-- Attachment #29: 0028-avcodec-mpegvideo_enc-Don-t-do-unnecessary-work-for-.patch --]
[-- Type: text/x-patch, Size: 2716 bytes --]
From 8875c0889693031f548cdba1e8575ac05e5e7b4c Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Tue, 25 Feb 2025 20:56:57 +0100
Subject: [PATCH 28/30] avcodec/mpegvideo_enc: Don't do unnecessary work for
AMV
Up until now, the initialization of AMV's matrices happened
after the initialization for MJPEG matrices, overwriting
the earlier data. This commit changes this.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegvideo_enc.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 87e02fa534..2bc853620b 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3838,6 +3838,7 @@ static int encode_picture(MpegEncContext *s, const AVPacket *pkt)
if (ret < 0)
return ret;
+ if (s->codec_id != AV_CODEC_ID_AMV) {
if (s->avctx->intra_matrix) {
chroma_matrix =
luma_matrix = s->avctx->intra_matrix;
@@ -3856,13 +3857,7 @@ static int encode_picture(MpegEncContext *s, const AVPacket *pkt)
s->c_dc_scale_table = ff_mpeg12_dc_scale_table[s->intra_dc_precision];
s->chroma_intra_matrix[0] =
s->intra_matrix[0] = ff_mpeg12_dc_scale_table[s->intra_dc_precision][8];
- ff_convert_matrix(s, s->q_intra_matrix, s->q_intra_matrix16,
- s->intra_matrix, s->intra_quant_bias, 8, 8, 1);
- ff_convert_matrix(s, s->q_chroma_intra_matrix, s->q_chroma_intra_matrix16,
- s->chroma_intra_matrix, s->intra_quant_bias, 8, 8, 1);
- s->qscale= 8;
-
- if (s->codec_id == AV_CODEC_ID_AMV) {
+ } else {
static const uint8_t y[32] = {13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13};
static const uint8_t c[32] = {14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14};
for (int i = 1; i < 64; i++) {
@@ -3875,12 +3870,12 @@ static int encode_picture(MpegEncContext *s, const AVPacket *pkt)
s->c_dc_scale_table = c;
s->intra_matrix[0] = 13;
s->chroma_intra_matrix[0] = 14;
+ }
ff_convert_matrix(s, s->q_intra_matrix, s->q_intra_matrix16,
s->intra_matrix, s->intra_quant_bias, 8, 8, 1);
ff_convert_matrix(s, s->q_chroma_intra_matrix, s->q_chroma_intra_matrix16,
s->chroma_intra_matrix, s->intra_quant_bias, 8, 8, 1);
s->qscale = 8;
- }
}
if (s->pict_type == AV_PICTURE_TYPE_I) {
--
2.45.2
[-- Attachment #30: 0029-avcodec-mpegvideo_enc-Reindent-after-the-previous-co.patch --]
[-- Type: text/x-patch, Size: 4253 bytes --]
From a1a2e84f041c417a422d030d8537a8871d5037d4 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Tue, 25 Feb 2025 21:11:33 +0100
Subject: [PATCH 29/30] avcodec/mpegvideo_enc: Reindent after the previous
commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegvideo_enc.c | 48 +++++++++++++++++++-------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 2bc853620b..2d82e22e05 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3831,32 +3831,32 @@ static int encode_picture(MpegEncContext *s, const AVPacket *pkt)
s->qscale= 3; //reduce clipping problems
if (s->out_format == FMT_MJPEG) {
- const uint16_t * luma_matrix = ff_mpeg1_default_intra_matrix;
- const uint16_t *chroma_matrix = ff_mpeg1_default_intra_matrix;
-
ret = ff_check_codec_matrices(s->avctx, FF_MATRIX_TYPE_INTRA | FF_MATRIX_TYPE_CHROMA_INTRA, (7 + s->qscale) / s->qscale, 65535);
if (ret < 0)
return ret;
if (s->codec_id != AV_CODEC_ID_AMV) {
- if (s->avctx->intra_matrix) {
- chroma_matrix =
- luma_matrix = s->avctx->intra_matrix;
- }
- if (s->avctx->chroma_intra_matrix)
- chroma_matrix = s->avctx->chroma_intra_matrix;
+ const uint16_t * luma_matrix = ff_mpeg1_default_intra_matrix;
+ const uint16_t *chroma_matrix = ff_mpeg1_default_intra_matrix;
- /* for mjpeg, we do include qscale in the matrix */
- for(i=1;i<64;i++){
- int j = s->idsp.idct_permutation[i];
+ if (s->avctx->intra_matrix) {
+ chroma_matrix =
+ luma_matrix = s->avctx->intra_matrix;
+ }
+ if (s->avctx->chroma_intra_matrix)
+ chroma_matrix = s->avctx->chroma_intra_matrix;
- s->chroma_intra_matrix[j] = av_clip_uint8((chroma_matrix[i] * s->qscale) >> 3);
- s-> intra_matrix[j] = av_clip_uint8(( luma_matrix[i] * s->qscale) >> 3);
- }
- s->y_dc_scale_table=
- s->c_dc_scale_table = ff_mpeg12_dc_scale_table[s->intra_dc_precision];
- s->chroma_intra_matrix[0] =
- s->intra_matrix[0] = ff_mpeg12_dc_scale_table[s->intra_dc_precision][8];
+ /* for mjpeg, we do include qscale in the matrix */
+ for (int i = 1; i < 64; i++) {
+ int j = s->idsp.idct_permutation[i];
+
+ s->chroma_intra_matrix[j] = av_clip_uint8((chroma_matrix[i] * s->qscale) >> 3);
+ s-> intra_matrix[j] = av_clip_uint8(( luma_matrix[i] * s->qscale) >> 3);
+ }
+ s->y_dc_scale_table =
+ s->c_dc_scale_table = ff_mpeg12_dc_scale_table[s->intra_dc_precision];
+ s->chroma_intra_matrix[0] =
+ s->intra_matrix[0] = ff_mpeg12_dc_scale_table[s->intra_dc_precision][8];
} else {
static const uint8_t y[32] = {13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13};
static const uint8_t c[32] = {14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14};
@@ -3871,11 +3871,11 @@ static int encode_picture(MpegEncContext *s, const AVPacket *pkt)
s->intra_matrix[0] = 13;
s->chroma_intra_matrix[0] = 14;
}
- ff_convert_matrix(s, s->q_intra_matrix, s->q_intra_matrix16,
- s->intra_matrix, s->intra_quant_bias, 8, 8, 1);
- ff_convert_matrix(s, s->q_chroma_intra_matrix, s->q_chroma_intra_matrix16,
- s->chroma_intra_matrix, s->intra_quant_bias, 8, 8, 1);
- s->qscale = 8;
+ ff_convert_matrix(s, s->q_intra_matrix, s->q_intra_matrix16,
+ s->intra_matrix, s->intra_quant_bias, 8, 8, 1);
+ ff_convert_matrix(s, s->q_chroma_intra_matrix, s->q_chroma_intra_matrix16,
+ s->chroma_intra_matrix, s->intra_quant_bias, 8, 8, 1);
+ s->qscale = 8;
}
if (s->pict_type == AV_PICTURE_TYPE_I) {
--
2.45.2
[-- Attachment #31: 0030-avcodec-vc1dec-Don-t-initialize-inter_scantable.patch --]
[-- Type: text/x-patch, Size: 954 bytes --]
From d75718d08a8747685493061002b6a890a6987e93 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Tue, 25 Feb 2025 22:56:21 +0100
Subject: [PATCH 30/30] avcodec/vc1dec: Don't initialize inter_scantable
It is unused.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/vc1dec.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index f079a8745b..cfd97c4ca6 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -474,8 +474,6 @@ av_cold int ff_vc1_decode_init(AVCodecContext *avctx)
s->y_dc_scale_table = ff_wmv3_dc_scale_table;
s->c_dc_scale_table = ff_wmv3_dc_scale_table;
- ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable,
- ff_wmv1_scantable[0]);
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable,
ff_wmv1_scantable[1]);
--
2.45.2
[-- Attachment #32: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-02-25 22:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-25 22:40 [FFmpeg-devel] [PATCH 01/30] avcodec/mpegvideo_enc: Don't set qscale_table value Andreas Rheinhardt
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git