[FFmpeg-cvslog] avutil/parseutils: use quadhd for Quad HD

2022-01-12 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Tue Jan 11 
10:03:50 2022 +0800| [8b9ef5a516dcb6327bdc15943c981ed743a09ab1] | committer: 
Limin Wang

avutil/parseutils: use quadhd for Quad HD

qHD is 960x540 (q stands for quarter) and QHD is 2560x1440 (Q is quad).
use quadhd for QHD for abbreviation.

Fix ticket#9591

Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b9ef5a516dcb6327bdc15943c981ed743a09ab1
---

 libavutil/parseutils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index 19bbdde611..94e88e0a79 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -112,7 +112,7 @@ static const VideoSizeAbbr video_size_abbrs[] = {
 { "hd480", 852, 480 },
 { "hd720",1280, 720 },
 { "hd1080",   1920,1080 },
-{ "qhd",  2560,1440 },
+{ "quadhd",   2560,1440 },
 { "2k",   2048,1080 }, /* Digital Cinema System Specification */
 { "2kdci",2048,1080 },
 { "2kflat",   1998,1080 },

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avutil/parseutils: use quadhd for Quad HD

2022-01-12 Thread Limin Wang
ffmpeg | branch: release/5.0 | Limin Wang  | Tue Jan 11 
10:03:50 2022 +0800| [99d6ab7154612b5a989a219fe9d8d1af7f32333e] | committer: 
Limin Wang

avutil/parseutils: use quadhd for Quad HD

qHD is 960x540 (q stands for quarter) and QHD is 2560x1440 (Q is quad).
use quadhd for QHD for abbreviation.

Fix ticket#9591

Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99d6ab7154612b5a989a219fe9d8d1af7f32333e
---

 libavutil/parseutils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index 19bbdde611..94e88e0a79 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -112,7 +112,7 @@ static const VideoSizeAbbr video_size_abbrs[] = {
 { "hd480", 852, 480 },
 { "hd720",1280, 720 },
 { "hd1080",   1920,1080 },
-{ "qhd",  2560,1440 },
+{ "quadhd",   2560,1440 },
 { "2k",   2048,1080 }, /* Digital Cinema System Specification */
 { "2kdci",2048,1080 },
 { "2kflat",   1998,1080 },

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/h264_slice, mpeg4videodec: Don't use %s to write single char

2022-01-12 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Jan  9 11:58:10 2022 +0100| [75a3268beea691c73c8bb202a2d4a6d61a97234a] | 
committer: Andreas Rheinhardt

avcodec/h264_slice, mpeg4videodec: Don't use %s to write single char

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=75a3268beea691c73c8bb202a2d4a6d61a97234a
---

 libavcodec/h264_slice.c| 4 ++--
 libavcodec/mpeg4videodec.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index c21004df97..f9c300bc2b 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -2168,9 +2168,9 @@ static int h264_slice_init(H264Context *h, 
H264SliceContext *sl,
 
 if (h->avctx->debug & FF_DEBUG_PICT_INFO) {
 av_log(h->avctx, AV_LOG_DEBUG,
-   "slice:%d %s mb:%d %c%s%s frame:%d poc:%d/%d ref:%d/%d qp:%d 
loop:%d:%d:%d weight:%d%s %s\n",
+   "slice:%d %c mb:%d %c%s%s frame:%d poc:%d/%d ref:%d/%d qp:%d 
loop:%d:%d:%d weight:%d%s %s\n",
sl->slice_num,
-   (h->picture_structure == PICT_FRAME ? "F" : 
h->picture_structure == PICT_TOP_FIELD ? "T" : "B"),
+   (h->picture_structure == PICT_FRAME ? 'F' : 
h->picture_structure == PICT_TOP_FIELD ? 'T' : 'B'),
sl->mb_y * h->mb_width + sl->mb_x,
av_get_picture_type_char(sl->slice_type),
sl->slice_type_fixed ? " fix" : "",
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 37088b7a6b..515a09d8a1 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3076,11 +3076,11 @@ static int decode_vop_header(Mpeg4DecContext *ctx, 
GetBitContext *gb,
 
 if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
 av_log(s->avctx, AV_LOG_DEBUG,
-   "qp:%d fc:%d,%d %s size:%d pro:%d alt:%d top:%d %spel 
part:%d resync:%d w:%d a:%d rnd:%d vot:%d%s dc:%d ce:%d/%d/%d time:%"PRId64" 
tincr:%d\n",
+   "qp:%d fc:%d,%d %c size:%d pro:%d alt:%d top:%d %cpel 
part:%d resync:%d w:%d a:%d rnd:%d vot:%d%s dc:%d ce:%d/%d/%d time:%"PRId64" 
tincr:%d\n",
s->qscale, s->f_code, s->b_code,
-   s->pict_type == AV_PICTURE_TYPE_I ? "I" : (s->pict_type == 
AV_PICTURE_TYPE_P ? "P" : (s->pict_type == AV_PICTURE_TYPE_B ? "B" : "S")),
+   s->pict_type == AV_PICTURE_TYPE_I ? 'I' : (s->pict_type == 
AV_PICTURE_TYPE_P ? 'P' : (s->pict_type == AV_PICTURE_TYPE_B ? 'B' : 'S')),
gb->size_in_bits,s->progressive_sequence, s->alternate_scan,
-   s->top_field_first, s->quarter_sample ? "q" : "h",
+   s->top_field_first, s->quarter_sample ? 'q' : 'h',
s->data_partitioning, ctx->resync_marker,
ctx->num_sprite_warping_points, s->sprite_warping_accuracy,
1 - s->no_rounding, s->vo_type,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/mpeg4video: Split off data in a header of its own

2022-01-12 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Jan  9 11:18:09 2022 +0100| [c21433c9539a72c17a48b155ca4581b55e326836] | 
committer: Andreas Rheinhardt

avcodec/mpeg4video: Split off data in a header of its own

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c21433c9539a72c17a48b155ca4581b55e326836
---

 libavcodec/ituh263enc.c |  1 -
 libavcodec/mpeg4data.h  |  3 +--
 libavcodec/mpeg4video.h | 35 --
 libavcodec/mpeg4videodata.h | 61 +
 libavcodec/mpeg4videodec.c  |  3 +++
 libavcodec/mpeg4videoenc.c  |  1 +
 libavcodec/mpegvideo_enc.c  |  1 +
 libavcodec/msmpeg4.c|  2 +-
 libavcodec/msmpeg4data.c|  2 +-
 9 files changed, 69 insertions(+), 40 deletions(-)

diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index d944c4879f..5a779e 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -39,7 +39,6 @@
 #include "mathops.h"
 #include "mpegutils.h"
 #include "flv.h"
-#include "mpeg4video.h"
 #include "internal.h"
 
 /**
diff --git a/libavcodec/mpeg4data.h b/libavcodec/mpeg4data.h
index 30179d9801..c5a2b14721 100644
--- a/libavcodec/mpeg4data.h
+++ b/libavcodec/mpeg4data.h
@@ -28,8 +28,7 @@
 #ifndef AVCODEC_MPEG4DATA_H
 #define AVCODEC_MPEG4DATA_H
 
-#include 
-#include "mpegvideo.h"
+#include "mpeg4videodata.h"
 
 /* dc encoding for MPEG-4 */
 const uint8_t ff_mpeg4_DCtab_lum[13][2] =
diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h
index cec8b30c32..87d9c9996e 100644
--- a/libavcodec/mpeg4video.h
+++ b/libavcodec/mpeg4video.h
@@ -27,7 +27,6 @@
 
 #include "get_bits.h"
 #include "mpegvideo.h"
-#include "rl.h"
 
 // shapes
 #define RECT_SHAPE   0
@@ -118,40 +117,6 @@ typedef struct Mpeg4DecContext {
 int rgb;
 } Mpeg4DecContext;
 
-static const uint8_t mpeg4_block_count[4] = {0, 6, 8, 12};
-
-/* dc encoding for MPEG-4 */
-extern const uint8_t ff_mpeg4_DCtab_lum[13][2];
-extern const uint8_t ff_mpeg4_DCtab_chrom[13][2];
-
-extern const uint16_t ff_mpeg4_intra_vlc[103][2];
-extern const int8_t ff_mpeg4_intra_level[102];
-extern const int8_t ff_mpeg4_intra_run[102];
-
-extern RLTable ff_mpeg4_rl_intra;
-void ff_mpeg4_init_rl_intra(void);
-
-/* Note this is identical to the intra rvlc except that it is reordered. */
-extern RLTable ff_rvlc_rl_inter;
-extern RLTable ff_rvlc_rl_intra;
-
-extern const uint8_t ff_sprite_trajectory_lens[15];
-extern const uint8_t ff_mb_type_b_tab[4][2];
-
-/* these matrixes will be permuted for the idct */
-extern const int16_t ff_mpeg4_default_intra_matrix[64];
-extern const int16_t ff_mpeg4_default_non_intra_matrix[64];
-
-extern const uint8_t ff_mpeg4_y_dc_scale_table[32];
-extern const uint8_t ff_mpeg4_c_dc_scale_table[32];
-extern const uint16_t ff_mpeg4_resync_prefix[8];
-
-extern const uint8_t ff_mpeg4_dc_threshold[8];
-
-extern const uint8_t ff_mpeg4_studio_dc_luma[19][2];
-extern const uint8_t ff_mpeg4_studio_dc_chroma[19][2];
-extern const uint8_t ff_mpeg4_studio_intra[12][24][2];
-
 void ff_mpeg4_encode_mb(MpegEncContext *s,
 int16_t block[6][64],
 int motion_x, int motion_y);
diff --git a/libavcodec/mpeg4videodata.h b/libavcodec/mpeg4videodata.h
new file mode 100644
index 00..b20096067a
--- /dev/null
+++ b/libavcodec/mpeg4videodata.h
@@ -0,0 +1,61 @@
+/*
+ * MPEG-4 encoder/decoder data.
+ * Copyright (c) 2000,2001 Fabrice Bellard
+ * Copyright (c) 2002-2010 Michael Niedermayer 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_MPEG4VIDEODATA_H
+#define AVCODEC_MPEG4VIDEODATA_H
+
+#include 
+#include "rl.h"
+
+/* dc encoding for MPEG-4 */
+extern const uint8_t ff_mpeg4_DCtab_lum[13][2];
+extern const uint8_t ff_mpeg4_DCtab_chrom[13][2];
+
+extern const uint16_t ff_mpeg4_intra_vlc[103][2];
+extern const int8_t ff_mpeg4_intra_level[102];
+extern const int8_t ff_mpeg4_intra_run[102];
+
+extern RLTable ff_mpeg4_rl_intra;
+void ff_mpeg4_init_rl_intra(void);
+
+/* Note this is identical to the intra rvlc except that it is reordered. */
+extern RLTable ff_rvlc_rl_inter;
+extern RLTable ff_rvlc_rl_intra;
+
+extern const uint8_t ff_sprite_trajectory_lens[15];
+extern const uint8_t ff_mb_type_b_tab[4]

[FFmpeg-cvslog] avcodec/mpegvideo, svq3: Remove unused next_p_frame_damaged

2022-01-12 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Jan 10 11:04:28 2022 +0100| [42d30c9019a6b67c56b05f1828fa04c0439a4fd0] | 
committer: Andreas Rheinhardt

avcodec/mpegvideo, svq3: Remove unused next_p_frame_damaged

Always zero since 4d2858deac5213eaddfdc06f98379b6325d7b953.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=42d30c9019a6b67c56b05f1828fa04c0439a4fd0
---

 libavcodec/h263dec.c   | 7 ---
 libavcodec/mpegvideo.h | 1 -
 libavcodec/mpegvideo_dec.c | 1 -
 libavcodec/svq3.c  | 8 
 libavcodec/vc1dec.c| 7 ---
 5 files changed, 24 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 11e80cb9e9..9cc2665cac 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -603,13 +603,6 @@ retry:
 avctx->skip_frame >= AVDISCARD_ALL)
 return get_consumed_bytes(s, buf_size);
 
-if (s->next_p_frame_damaged) {
-if (s->pict_type == AV_PICTURE_TYPE_B)
-return get_consumed_bytes(s, buf_size);
-else
-s->next_p_frame_damaged = 0;
-}
-
 if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) {
 s->me.qpel_put = s->qdsp.put_qpel_pixels_tab;
 s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 1c14f5b0f0..448fe2cedc 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -342,7 +342,6 @@ typedef struct MpegEncContext {
 int resync_mb_y; ///< y position of last resync marker
 GetBitContext last_resync_gb;///< used to search for the next resync 
marker
 int mb_num_left; ///< number of MBs left in this video 
packet (for partitioned Slices only)
-int next_p_frame_damaged;///< set if the next p frame is damaged, 
to avoid showing trashed B-frames
 
 #if FF_API_FLAG_TRUNCATED
 ParseContext parse_context;
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 8b625d2835..1e238bd1e1 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -132,7 +132,6 @@ do {\
 s->next_picture_ptr= REBASE_PICTURE(s1->next_picture_ptr,s, s1);
 
 // Error/bug resilience
-s->next_p_frame_damaged = s1->next_p_frame_damaged;
 s->workaround_bugs  = s1->workaround_bugs;
 s->padding_bug_score= s1->padding_bug_score;
 
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index e329578af0..6f3ade8ace 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -98,7 +98,6 @@ typedef struct SVQ3Context {
 int has_watermark;
 uint32_t watermark_key;
 int adaptive_quant;
-int next_p_frame_damaged;
 int h_edge_pos;
 int v_edge_pos;
 int last_frame_output;
@@ -1470,13 +1469,6 @@ static int svq3_decode_frame(AVCodecContext *avctx, void 
*data,
 avctx->skip_frame >= AVDISCARD_ALL)
 return 0;
 
-if (s->next_p_frame_damaged) {
-if (s->pict_type == AV_PICTURE_TYPE_B)
-return 0;
-else
-s->next_p_frame_damaged = 0;
-}
-
 if (s->pict_type == AV_PICTURE_TYPE_B) {
 s->frame_num_offset = s->slice_num - s->prev_frame_num;
 
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 267d72d15b..7ed5133cfa 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -872,13 +872,6 @@ static int vc1_decode_frame(AVCodecContext *avctx, void 
*data,
 goto end;
 }
 
-if (s->next_p_frame_damaged) {
-if (s->pict_type == AV_PICTURE_TYPE_B)
-goto end;
-else
-s->next_p_frame_damaged = 0;
-}
-
 if ((ret = ff_mpv_frame_start(s, avctx)) < 0) {
 goto err;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/svq3: Remove dead topright_samples_available variable, code

2022-01-12 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Jan 10 13:21:08 2022 +0100| [67cccd442f73d8eea54660b552fe954c642f060c] | 
committer: Andreas Rheinhardt

avcodec/svq3: Remove dead topright_samples_available variable, code

Topright samples are always available.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67cccd442f73d8eea54660b552fe954c642f060c
---

 libavcodec/svq3.c | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 6f3ade8ace..a3f434ff8d 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -128,7 +128,6 @@ typedef struct SVQ3Context {
 int8_t (*intra4x4_pred_mode);
 
 unsigned int top_samples_available;
-unsigned int topright_samples_available;
 unsigned int left_samples_available;
 
 uint8_t *edge_emu_buffer;
@@ -638,15 +637,10 @@ static av_always_inline void 
hl_decode_mb_predict_luma(SVQ3Context *s,
 const int dir  = s->intra4x4_pred_mode_cache[scan8[i]];
 
 uint8_t *topright;
-int nnz, tr;
+int nnz;
 if (dir == DIAG_DOWN_LEFT_PRED || dir == VERT_LEFT_PRED) {
-const int topright_avail = (s->topright_samples_available << 
i) & 0x8000;
 av_assert2(s->mb_y || linesize <= block_offset[i]);
-if (!topright_avail) {
-tr   = ptr[3 - linesize] * 0x01010101u;
-topright = (uint8_t *)&tr;
-} else
-topright = ptr + 4 - linesize;
+topright = ptr + 4 - linesize;
 } else
 topright = NULL;
 
@@ -721,7 +715,6 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int 
mb_type)
 
 s->top_samples_available  = (s->mb_y == 0) ? 0x33FF : 0x;
 s->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0x;
-s->topright_samples_available = 0x;
 
 if (mb_type == 0) {   /* SKIP */
 if (s->pict_type == AV_PICTURE_TYPE_P ||

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/h264_slice: Inline H264 codec id

2022-01-12 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Jan 10 15:19:56 2022 +0100| [d0bf242d02db7d0249b69fc955ba8402b2c9cc13] | 
committer: Andreas Rheinhardt

avcodec/h264_slice: Inline H264 codec id

This code is only reached by the H.264 decoder.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d0bf242d02db7d0249b69fc955ba8402b2c9cc13
---

 libavcodec/h264_slice.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index f9c300bc2b..4833282191 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -998,7 +998,7 @@ static int h264_slice_header_init(H264Context *h)
 sps->chroma_format_idc);
 ff_h264chroma_init(&h->h264chroma, sps->bit_depth_chroma);
 ff_h264qpel_init(&h->h264qpel, sps->bit_depth_luma);
-ff_h264_pred_init(&h->hpc, h->avctx->codec_id, sps->bit_depth_luma,
+ff_h264_pred_init(&h->hpc, AV_CODEC_ID_H264, sps->bit_depth_luma,
   sps->chroma_format_idc);
 ff_videodsp_init(&h->vdsp, sps->bit_depth_luma);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/mpegvideo: Don't set unrestricted_mv for decoders

2022-01-12 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Jan 10 20:13:43 2022 +0100| [b263415ab7dcb0f7077fed2af4aa507b4be3e2f9] | 
committer: Andreas Rheinhardt

avcodec/mpegvideo: Don't set unrestricted_mv for decoders

It is write-only for them.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b263415ab7dcb0f7077fed2af4aa507b4be3e2f9
---

 libavcodec/flvdec.c   | 1 -
 libavcodec/h263dec.c  | 2 --
 libavcodec/intelh263dec.c | 1 -
 libavcodec/ituh263dec.c   | 2 --
 libavcodec/rv10.c | 2 --
 5 files changed, 8 deletions(-)

diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
index 6258c1c0a7..2ddcf021fd 100644
--- a/libavcodec/flvdec.c
+++ b/libavcodec/flvdec.c
@@ -90,7 +90,6 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
 
 s->h263_plus = 0;
 
-s->unrestricted_mv   = 1;
 s->h263_long_vectors = 0;
 
 /* PEI */
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 9cc2665cac..ac48acf47a 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -83,13 +83,11 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
 s->quant_precision = 5;
 s->decode_mb   = ff_h263_decode_mb;
 s->low_delay   = 1;
-s->unrestricted_mv = 1;
 
 /* select sub codec */
 switch (avctx->codec->id) {
 case AV_CODEC_ID_H263:
 case AV_CODEC_ID_H263P:
-s->unrestricted_mv = 0;
 avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
 break;
 case AV_CODEC_ID_MPEG4:
diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c
index 7c794dc5e3..58c1b63c0a 100644
--- a/libavcodec/intelh263dec.c
+++ b/libavcodec/intelh263dec.c
@@ -66,7 +66,6 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
 return -1;  /* SAC: off */
 }
 s->obmc= get_bits1(&s->gb);
-s->unrestricted_mv = s->obmc || s->h263_long_vectors;
 s->pb_frame = get_bits1(&s->gb);
 
 if (format < 6) {
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 17af5d7f89..5329e62a5e 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -1150,7 +1150,6 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
 return -1; /* SAC: off */
 }
 s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */
-s->unrestricted_mv = s->h263_long_vectors || s->obmc;
 
 s->pb_frame = get_bits1(&s->gb);
 s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
@@ -1180,7 +1179,6 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
 s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */
 s->h263_aic = get_bits1(&s->gb); /* Advanced Intra Coding (AIC) */
 s->loop_filter= get_bits1(&s->gb);
-s->unrestricted_mv = s->umvplus || s->obmc || s->loop_filter;
 if(s->avctx->lowres)
 s->loop_filter = 0;
 
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index d8261c34c7..0dc2c87335 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -149,7 +149,6 @@ static int rv10_decode_picture_header(MpegEncContext *s)
 }
 skip_bits(&s->gb, 3);   /* ignored */
 s->f_code  = 1;
-s->unrestricted_mv = 1;
 
 return mb_count;
 }
@@ -298,7 +297,6 @@ static int rv20_decode_picture_header(RVDecContext *rv, int 
whole_size)
 skip_bits(&s->gb, 5);
 
 s->f_code  = 1;
-s->unrestricted_mv = 1;
 s->h263_aic= s->pict_type == AV_PICTURE_TYPE_I;
 s->modified_quant  = 1;
 if (!s->avctx->lowres)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/h264pred: Don't compile > 8 bit versions of VP7/8 functions

2022-01-12 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Jan 10 15:58:07 2022 +0100| [0a6e000d75b5f721002b4e0bb7b87700472e30b2] | 
committer: Andreas Rheinhardt

avcodec/h264pred: Don't compile > 8 bit versions of VP7/8 functions

VP7 and VP8 are eight bit only.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a6e000d75b5f721002b4e0bb7b87700472e30b2
---

 libavcodec/h264pred.c  | 36 ++--
 libavcodec/h264pred_template.c | 34 ++
 2 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c
index bd0d4a3d06..731cf48ea6 100644
--- a/libavcodec/h264pred.c
+++ b/libavcodec/h264pred.c
@@ -53,6 +53,30 @@
 #include "h264pred_template.c"
 #undef BIT_DEPTH
 
+static void pred4x4_127_dc_c(uint8_t *src, const uint8_t *topright,
+ ptrdiff_t _stride)
+{
+int stride = _stride;
+const uint32_t a = 0x7F7F7F7FU;
+
+AV_WN32A(src + 0 * stride, a);
+AV_WN32A(src + 1 * stride, a);
+AV_WN32A(src + 2 * stride, a);
+AV_WN32A(src + 3 * stride, a);
+}
+
+static void pred4x4_129_dc_c(uint8_t *src, const uint8_t *topright,
+ ptrdiff_t _stride)
+{
+int stride = _stride;
+const uint32_t a = 0x81818181U;
+
+AV_WN32A(src + 0 * stride, a);
+AV_WN32A(src + 1 * stride, a);
+AV_WN32A(src + 2 * stride, a);
+AV_WN32A(src + 3 * stride, a);
+}
+
 static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright,
ptrdiff_t stride)
 {
@@ -447,8 +471,8 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int 
codec_id,
 h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc, 
depth);\
 } else {\
 h->pred4x4[TM_VP8_PRED ]= FUNCD(pred4x4_tm_vp8);\
-h->pred4x4[DC_127_PRED ]= FUNCC(pred4x4_127_dc, 
depth);\
-h->pred4x4[DC_129_PRED ]= FUNCC(pred4x4_129_dc, 
depth);\
+h->pred4x4[DC_127_PRED ]= FUNCD(pred4x4_127_dc);\
+h->pred4x4[DC_129_PRED ]= FUNCD(pred4x4_129_dc);\
 h->pred4x4[VERT_VP8_PRED   ]= FUNCC(pred4x4_vertical  , 
depth);\
 h->pred4x4[HOR_VP8_PRED]= FUNCC(pred4x4_horizontal, 
depth);\
 }\
@@ -524,8 +548,8 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int 
codec_id,
 h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\
 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\
 if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {\
-h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc  , 
depth);\
-h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc  , 
depth);\
+h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc, 8);\
+h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc, 8);\
 }\
 }\
 if (chroma_format_idc <= 1) {\
@@ -547,8 +571,8 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int 
codec_id,
 case AV_CODEC_ID_VP7:\
 case AV_CODEC_ID_VP8:\
h->pred16x16[PLANE_PRED8x8  ]= FUNCD(pred16x16_tm_vp8);\
-   h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc   , 
depth);\
-   h->pred16x16[DC_129_PRED8x8]= FUNCC(pred16x16_129_dc   , 
depth);\
+   h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc, 8);\
+   h->pred16x16[DC_129_PRED8x8]= FUNCC(pred16x16_129_dc, 8);\
break;\
 default:\
h->pred16x16[PLANE_PRED8x8  ]= FUNCC(pred16x16_plane   , 
depth);\
diff --git a/libavcodec/h264pred_template.c b/libavcodec/h264pred_template.c
index 2b30fff70f..b5bc942a5e 100644
--- a/libavcodec/h264pred_template.c
+++ b/libavcodec/h264pred_template.c
@@ -111,32 +111,6 @@ static void FUNCC(pred4x4_128_dc)(uint8_t *_src, const 
uint8_t *topright,
 AV_WN4PA(src+3*stride, a);
 }
 
-static void FUNCC(pred4x4_127_dc)(uint8_t *_src, const uint8_t *topright,
-  ptrdiff_t _stride)
-{
-pixel *src = (pixel*)_src;
-int stride = _stride>>(sizeof(pixel)-1);
-const pixel4 a = PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))-1);
-
-AV_WN4PA(src+0*stride, a);
-AV_WN4PA(src+1*stride, a);
-AV_WN4PA(src+2*stride, a);
-AV_WN4PA(src+3*stride, a);
-}
-
-static void FUNCC(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright,
-  ptrdiff_t _stride)
-{
-pixel *src = (pixel*)_src;
-int stride = _stride>>(sizeof(pixel)-1);
-const pixel4 a = PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))+1);
-
-AV_WN4PA(src+0*stride, a);
-AV_WN4PA(src+1*stride, a);
-AV_WN4PA(src+2*stride, a);
-AV_WN4PA(src+3*stride, a);
-}
-
 
 #define LOAD_TOP_RIGHT_EDGE\
 const unsigned av_unused t4 = topright[0];\
@@ -427,9 +401,11 @@ static void FUNCC(pred16x16_##n##_dc)(uint8_t *_src, 
ptrdiff_t stride)\
 PREDICT_16x16

[FFmpeg-cvslog] avcodec/h264pred: Remove dead > 8 pixels checks for 8bit codecs

2022-01-12 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Jan 10 17:24:44 2022 +0100| [c32f6b7f8abcfd9f671f80e423e92ee0408eaa08] | 
committer: Andreas Rheinhardt

avcodec/h264pred: Remove dead > 8 pixels checks for 8bit codecs

RV40, SVQ3 and VP7/VP8 are eight-bit only, so it makes no sense
to check for them in the codepath initializing > eight bit contexts.
Move the codec-specific code to a switch located after the eight-bit
init code where this is easily possible; and add checks to the macro
to enable the compiler to remove the remaining checks when initializing
bitdepths > 8 at compile-time.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c32f6b7f8abcfd9f671f80e423e92ee0408eaa08
---

 libavcodec/h264pred.c | 101 ++
 1 file changed, 37 insertions(+), 64 deletions(-)

diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c
index 731cf48ea6..2d115f7b43 100644
--- a/libavcodec/h264pred.c
+++ b/libavcodec/h264pred.c
@@ -445,56 +445,19 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int 
codec_id,
 #define FUNCD(a) a ## _c
 
 #define H264_PRED(depth) \
-if(codec_id != AV_CODEC_ID_RV40){\
-if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {\
-h->pred4x4[VERT_PRED   ]= FUNCD(pred4x4_vertical_vp8);\
-h->pred4x4[HOR_PRED]= FUNCD(pred4x4_horizontal_vp8);\
-} else {\
 h->pred4x4[VERT_PRED   ]= FUNCC(pred4x4_vertical  , 
depth);\
 h->pred4x4[HOR_PRED]= FUNCC(pred4x4_horizontal, 
depth);\
-}\
 h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc, 
depth);\
-if(codec_id == AV_CODEC_ID_SVQ3)\
-h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_svq3);\
-else\
 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred4x4_down_left , 
depth);\
 h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right, 
depth);\
 h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right, 
depth);\
 h->pred4x4[HOR_DOWN_PRED   ]= FUNCC(pred4x4_horizontal_down   , 
depth);\
-if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {\
-h->pred4x4[VERT_LEFT_PRED  ]= FUNCD(pred4x4_vertical_left_vp8);\
-} else\
 h->pred4x4[VERT_LEFT_PRED  ]= FUNCC(pred4x4_vertical_left , 
depth);\
 h->pred4x4[HOR_UP_PRED ]= FUNCC(pred4x4_horizontal_up , 
depth);\
-if (codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) {\
 h->pred4x4[LEFT_DC_PRED]= FUNCC(pred4x4_left_dc   , 
depth);\
 h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc, 
depth);\
-} else {\
-h->pred4x4[TM_VP8_PRED ]= FUNCD(pred4x4_tm_vp8);\
-h->pred4x4[DC_127_PRED ]= FUNCD(pred4x4_127_dc);\
-h->pred4x4[DC_129_PRED ]= FUNCD(pred4x4_129_dc);\
-h->pred4x4[VERT_VP8_PRED   ]= FUNCC(pred4x4_vertical  , 
depth);\
-h->pred4x4[HOR_VP8_PRED]= FUNCC(pred4x4_horizontal, 
depth);\
-}\
-if (codec_id != AV_CODEC_ID_VP8)\
+if (depth > 8 || codec_id != AV_CODEC_ID_VP8)\
 h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc, 
depth);\
-}else{\
-h->pred4x4[VERT_PRED   ]= FUNCC(pred4x4_vertical  , 
depth);\
-h->pred4x4[HOR_PRED]= FUNCC(pred4x4_horizontal, 
depth);\
-h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc, 
depth);\
-h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_rv40);\
-h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right, 
depth);\
-h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right, 
depth);\
-h->pred4x4[HOR_DOWN_PRED   ]= FUNCC(pred4x4_horizontal_down   , 
depth);\
-h->pred4x4[VERT_LEFT_PRED  ]= FUNCD(pred4x4_vertical_left_rv40);\
-h->pred4x4[HOR_UP_PRED ]= FUNCD(pred4x4_horizontal_up_rv40);\
-h->pred4x4[LEFT_DC_PRED]= FUNCC(pred4x4_left_dc   , 
depth);\
-h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc, 
depth);\
-h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc, 
depth);\
-h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= 
FUNCD(pred4x4_down_left_rv40_nodown);\
-h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= 
FUNCD(pred4x4_horizontal_up_rv40_nodown);\
-h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= 
FUNCD(pred4x4_vertical_left_rv40_nodown);\
-}\
 \
 h->pred8x8l[VERT_PRED   ]= FUNCC(pred8x8l_vertical, 
depth);\
 h->pred8x8l[HOR_PRED]= FUNCC(pred8x8l_horizontal  , 
depth);\
@@ -516,16 +479,14 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int 
codec_id,
 h->pred8x8[VERT_PRED

[FFmpeg-cvslog] avcodec/mpeg4videodec: Avoid multiple consecutive av_log()

2022-01-12 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Jan 10 21:30:26 2022 +0100| [fbeb8eab44cd0ab97c42ca6f23fd067c527ef829] | 
committer: Andreas Rheinhardt

avcodec/mpeg4videodec: Avoid multiple consecutive av_log()

These messages belong together, yet they can be torn apart
if some other call to av_log() happens between them.

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fbeb8eab44cd0ab97c42ca6f23fd067c527ef829
---

 libavcodec/mpeg4videodec.c | 59 +++---
 1 file changed, 30 insertions(+), 29 deletions(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 515a09d8a1..737689b35b 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3276,62 +3276,63 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext 
*ctx, GetBitContext *gb,
 continue;  // no startcode
 
 if (s->avctx->debug & FF_DEBUG_STARTCODE) {
-av_log(s->avctx, AV_LOG_DEBUG, "startcode: %3X ", startcode);
+const char *name;
 if (startcode <= 0x11F)
-av_log(s->avctx, AV_LOG_DEBUG, "Video Object Start");
+name = "Video Object Start";
 else if (startcode <= 0x12F)
-av_log(s->avctx, AV_LOG_DEBUG, "Video Object Layer Start");
+name = "Video Object Layer Start";
 else if (startcode <= 0x13F)
-av_log(s->avctx, AV_LOG_DEBUG, "Reserved");
+name = "Reserved";
 else if (startcode <= 0x15F)
-av_log(s->avctx, AV_LOG_DEBUG, "FGS bp start");
+name = "FGS bp start";
 else if (startcode <= 0x1AF)
-av_log(s->avctx, AV_LOG_DEBUG, "Reserved");
+name = "Reserved";
 else if (startcode == 0x1B0)
-av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Seq Start");
+name = "Visual Object Seq Start";
 else if (startcode == 0x1B1)
-av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Seq End");
+name = "Visual Object Seq End";
 else if (startcode == 0x1B2)
-av_log(s->avctx, AV_LOG_DEBUG, "User Data");
+name = "User Data";
 else if (startcode == 0x1B3)
-av_log(s->avctx, AV_LOG_DEBUG, "Group of VOP start");
+name = "Group of VOP start";
 else if (startcode == 0x1B4)
-av_log(s->avctx, AV_LOG_DEBUG, "Video Session Error");
+name = "Video Session Error";
 else if (startcode == 0x1B5)
-av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Start");
+name = "Visual Object Start";
 else if (startcode == 0x1B6)
-av_log(s->avctx, AV_LOG_DEBUG, "Video Object Plane start");
+name = "Video Object Plane start";
 else if (startcode == 0x1B7)
-av_log(s->avctx, AV_LOG_DEBUG, "slice start");
+name = "slice start";
 else if (startcode == 0x1B8)
-av_log(s->avctx, AV_LOG_DEBUG, "extension start");
+name = "extension start";
 else if (startcode == 0x1B9)
-av_log(s->avctx, AV_LOG_DEBUG, "fgs start");
+name = "fgs start";
 else if (startcode == 0x1BA)
-av_log(s->avctx, AV_LOG_DEBUG, "FBA Object start");
+name = "FBA Object start";
 else if (startcode == 0x1BB)
-av_log(s->avctx, AV_LOG_DEBUG, "FBA Object Plane start");
+name = "FBA Object Plane start";
 else if (startcode == 0x1BC)
-av_log(s->avctx, AV_LOG_DEBUG, "Mesh Object start");
+name = "Mesh Object start";
 else if (startcode == 0x1BD)
-av_log(s->avctx, AV_LOG_DEBUG, "Mesh Object Plane start");
+name = "Mesh Object Plane start";
 else if (startcode == 0x1BE)
-av_log(s->avctx, AV_LOG_DEBUG, "Still Texture Object start");
+name = "Still Texture Object start";
 else if (startcode == 0x1BF)
-av_log(s->avctx, AV_LOG_DEBUG, "Texture Spatial Layer start");
+name = "Texture Spatial Layer start";
 else if (startcode == 0x1C0)
-av_log(s->avctx, AV_LOG_DEBUG, "Texture SNR Layer start");
+name = "Texture SNR Layer start";
 else if (startcode == 0x1C1)
-av_log(s->avctx, AV_LOG_DEBUG, "Texture Tile start");
+name = "Texture Tile start";
 else if (startcode == 0x1C2)
-av_log(s->avctx, AV_LOG_DEBUG, "Texture Shape Layer start");
+name = "Texture Shape Layer start";
 else if (startcode == 0x1C3)
-av_log(s->a

[FFmpeg-cvslog] avcodec/h264pred: Reindentation

2022-01-12 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Jan 10 18:39:29 2022 +0100| [3988016fa3ec298206b9a5347683764f06ac31c6] | 
committer: Andreas Rheinhardt

avcodec/h264pred: Reindentation

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3988016fa3ec298206b9a5347683764f06ac31c6
---

 libavcodec/h264pred.c | 35 ---
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c
index 2d115f7b43..d83ca37a69 100644
--- a/libavcodec/h264pred.c
+++ b/libavcodec/h264pred.c
@@ -445,19 +445,19 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int 
codec_id,
 #define FUNCD(a) a ## _c
 
 #define H264_PRED(depth) \
-h->pred4x4[VERT_PRED   ]= FUNCC(pred4x4_vertical  , 
depth);\
-h->pred4x4[HOR_PRED]= FUNCC(pred4x4_horizontal, 
depth);\
-h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc, 
depth);\
-h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred4x4_down_left , 
depth);\
-h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right, 
depth);\
-h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right, 
depth);\
-h->pred4x4[HOR_DOWN_PRED   ]= FUNCC(pred4x4_horizontal_down   , 
depth);\
-h->pred4x4[VERT_LEFT_PRED  ]= FUNCC(pred4x4_vertical_left , 
depth);\
-h->pred4x4[HOR_UP_PRED ]= FUNCC(pred4x4_horizontal_up , 
depth);\
-h->pred4x4[LEFT_DC_PRED]= FUNCC(pred4x4_left_dc   , 
depth);\
-h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc, 
depth);\
+h->pred4x4[VERT_PRED   ] = FUNCC(pred4x4_vertical,depth);\
+h->pred4x4[HOR_PRED] = FUNCC(pred4x4_horizontal,  depth);\
+h->pred4x4[DC_PRED ] = FUNCC(pred4x4_dc,  depth);\
+h->pred4x4[DIAG_DOWN_LEFT_PRED ] = FUNCC(pred4x4_down_left,   depth);\
+h->pred4x4[DIAG_DOWN_RIGHT_PRED] = FUNCC(pred4x4_down_right,  depth);\
+h->pred4x4[VERT_RIGHT_PRED ] = FUNCC(pred4x4_vertical_right,  depth);\
+h->pred4x4[HOR_DOWN_PRED   ] = FUNCC(pred4x4_horizontal_down, depth);\
+h->pred4x4[VERT_LEFT_PRED  ] = FUNCC(pred4x4_vertical_left,   depth);\
+h->pred4x4[HOR_UP_PRED ] = FUNCC(pred4x4_horizontal_up,   depth);\
+h->pred4x4[LEFT_DC_PRED] = FUNCC(pred4x4_left_dc, depth);\
+h->pred4x4[TOP_DC_PRED ] = FUNCC(pred4x4_top_dc,  depth);\
 if (depth > 8 || codec_id != AV_CODEC_ID_VP8)\
-h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc, 
depth);\
+h->pred4x4[DC_128_PRED ] = FUNCC(pred4x4_128_dc,  depth);\
 \
 h->pred8x8l[VERT_PRED   ]= FUNCC(pred8x8l_vertical, 
depth);\
 h->pred8x8l[HOR_PRED]= FUNCC(pred8x8l_horizontal  , 
depth);\
@@ -475,15 +475,12 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int 
codec_id,
 if (chroma_format_idc <= 1) {\
 h->pred8x8[VERT_PRED8x8   ]= FUNCC(pred8x8_vertical   , 
depth);\
 h->pred8x8[HOR_PRED8x8]= FUNCC(pred8x8_horizontal , 
depth);\
+h->pred8x8[PLANE_PRED8x8] = FUNCC(pred8x8_plane,   depth);\
 } else {\
 h->pred8x8[VERT_PRED8x8   ]= FUNCC(pred8x16_vertical  , 
depth);\
 h->pred8x8[HOR_PRED8x8]= FUNCC(pred8x16_horizontal, 
depth);\
+h->pred8x8[PLANE_PRED8x8] = FUNCC(pred8x16_plane,  depth);\
 }\
-if (chroma_format_idc <= 1) {\
-h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x8_plane, 
depth);\
-} else {\
-h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x16_plane   , 
depth);\
-}\
 if (depth > 8 || (codec_id != AV_CODEC_ID_RV40 && \
   codec_id != AV_CODEC_ID_VP7  && \
   codec_id != AV_CODEC_ID_VP8)) { \
@@ -531,8 +528,8 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int 
codec_id,
 h->pred8x8l_filter_add [VERT_PRED   ]= FUNCC(pred8x8l_vertical_filter_add  
 , depth);\
 h->pred8x8l_filter_add [ HOR_PRED   ]= 
FUNCC(pred8x8l_horizontal_filter_add , depth);\
 if (chroma_format_idc <= 1) {\
-h->pred8x8_add  [VERT_PRED8x8]= FUNCC(pred8x8_vertical_add, 
depth);\
-h->pred8x8_add  [ HOR_PRED8x8]= FUNCC(pred8x8_horizontal_add  , 
depth);\
+h->pred8x8_add[VERT_PRED8x8] = FUNCC(pred8x8_vertical_add,depth);\
+h->pred8x8_add[ HOR_PRED8x8] = FUNCC(pred8x8_horizontal_add,  depth);\
 } else {\
 h->pred8x8_add  [VERT_PRED8x8]= FUNCC(pred8x16_vertical_add
, depth);\
 h->pred8x8_add  [ HOR_PRED8x8]= FUNCC(pred8x16_horizontal_add  
, depth);\

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https:/

[FFmpeg-cvslog] avcodec/mpegpicture: Decrease size of encoding_error array

2022-01-12 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Jan 10 23:23:43 2022 +0100| [c936c319bd54f097cc1d75b1ee1c407d53215d71] | 
committer: Andreas Rheinhardt

avcodec/mpegpicture: Decrease size of encoding_error array

The current size is AV_NUM_DATA_POINTERS (i.e. eight).
This number is chosen in order to minimize the amount of allocations
for AVFrame.extended_(data|buf) for audio; it is meaningless
for video for which four is sufficient. So decrease this array
in order to minimize what is copied in ff_mpeg_ref_picture()
and at the places that copy a whole MpegEncContext.

Also do the same for snowenc.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c936c319bd54f097cc1d75b1ee1c407d53215d71
---

 libavcodec/mpegpicture.h   | 3 ++-
 libavcodec/mpegvideo_enc.c | 2 +-
 libavcodec/snow.h  | 4 +++-
 libavcodec/snowenc.c   | 2 +-
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h
index 4bcd666797..a354c2a83c 100644
--- a/libavcodec/mpegpicture.h
+++ b/libavcodec/mpegpicture.h
@@ -29,6 +29,7 @@
 #include "motion_est.h"
 #include "thread.h"
 
+#define MPEGVIDEO_MAX_PLANES 4
 #define MAX_PICTURE_COUNT 36
 #define EDGE_WIDTH 16
 
@@ -88,7 +89,7 @@ typedef struct Picture {
 int reference;
 int shared;
 
-uint64_t encoding_error[AV_NUM_DATA_POINTERS];
+uint64_t encoding_error[MPEGVIDEO_MAX_PLANES];
 } Picture;
 
 /**
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index afad9c8be1..35f0f79d4e 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1792,7 +1792,7 @@ vbv_retry:
 }
 ff_side_data_set_encoder_stats(pkt, s->current_picture.f->quality,
s->current_picture_ptr->encoding_error,
-   (avctx->flags&AV_CODEC_FLAG_PSNR) ? 4 : 
0,
+   (avctx->flags&AV_CODEC_FLAG_PSNR) ? 
MPEGVIDEO_MAX_PLANES : 0,
s->pict_type);
 
 if (avctx->flags & AV_CODEC_FLAG_PASS1)
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index 8795491cf3..f5beca66e9 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -35,6 +35,8 @@
 #include "mpegvideo.h"
 #include "h264qpel.h"
 
+#define SNOW_MAX_PLANES 4
+
 #define FF_ME_ITER 3
 
 #define MID_STATE 128
@@ -188,7 +190,7 @@ typedef struct SnowContext{
 AVMotionVector *avmv;
 unsigned avmv_size;
 int avmv_index;
-uint64_t encoding_error[AV_NUM_DATA_POINTERS];
+uint64_t encoding_error[SNOW_MAX_PLANES];
 
 int pred;
 }SnowContext;
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 96b0d320bc..df31eb8132 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -1858,7 +1858,7 @@ redo_frame:
 
 ff_side_data_set_encoder_stats(pkt, s->current_picture->quality,
s->encoding_error,
-   (s->avctx->flags&AV_CODEC_FLAG_PSNR) ? 4 : 
0,
+   (s->avctx->flags&AV_CODEC_FLAG_PSNR) ? 
SNOW_MAX_PLANES : 0,
s->current_picture->pict_type);
 
 pkt->size = ff_rac_terminate(c, 0);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".