ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Thu Jun 13 20:18:16 2024 +0200| [7b539ca3e6bae701d88096ff8dc3db7f13b7318a] | 
committer: Andreas Rheinhardt

avcodec/mpeg_er: Simplify disabling IDCT

The error resilience code does not make up block coefficients
and therefore zeroes them in order to disable the IDCT.
But this can be done in a simpler manner, namely by setting
block_last_index to a negative value. Doing so also has
the advantage that the dct_unquantize functions are never even
called for those codecs that do not use ff_mpv_reconstruct_mb()
for ordinary decoding (namely RV-30/40 and the VC-1 family).

This approach would not work for intra macroblocks (there is always
at least one coefficient for them and therefore there is no check
for block_last_index for them), but this does not happen at all.
Add an assert for this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

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

 libavcodec/mpeg_er.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c
index fe7dcd7efb..3cbdeeebec 100644
--- a/libavcodec/mpeg_er.c
+++ b/libavcodec/mpeg_er.c
@@ -16,6 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/avassert.h"
 #include "libavutil/mem.h"
 #include "error_resilience.h"
 #include "mpegvideo.h"
@@ -67,6 +68,8 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int 
mv_dir, int mv_type,
 {
     MpegEncContext *s = opaque;
 
+    av_assert1(!mb_intra);
+
     s->mv_dir     = mv_dir;
     s->mv_type    = mv_type;
     s->mb_intra   = mb_intra;
@@ -76,9 +79,9 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int 
mv_dir, int mv_type,
     s->mcsel      = 0;
     memcpy(s->mv, mv, sizeof(*mv));
 
-    s->bdsp.clear_blocks(s->block[0]);
-    if (!s->chroma_y_shift)
-        s->bdsp.clear_blocks(s->block[6]);
+    // The following disables the IDCT.
+    for (size_t i = 0; i < FF_ARRAY_ELEMS(s->block_last_index); i++)
+        s->block_last_index[i] = -1;
 
     s->dest[0] = s->cur_pic.data[0] +
                  s->mb_y * 16 * s->linesize +

_______________________________________________
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".

Reply via email to