---
This one bugs me since intrax8 decoding process requires no error resilience
whatsoever, and it's only there to make things work with mpegvideo.

I'd really really like to remove error resilience altogether, but that
would require adding two er function calls to the dependent decoders.
Would that be ok?

Vittorio

 libavcodec/intrax8.c |  5 +++--
 libavcodec/intrax8.h | 11 ++++++-----
 libavcodec/vc1dec.c  |  2 +-
 libavcodec/wmv2dec.c |  2 +-
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 2613bf7..b306aa3 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -725,7 +725,7 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame 
*frame)
 
 av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
                                    IntraX8Context *w, IDCTDSPContext *idsp,
-                                   int16_t (*block)[64],
+                                   ERContext *er, int16_t (*block)[64],
                                    int block_last_index[12],
                                    int mb_width, int mb_height,
                                    MpegEncContext *const s)
@@ -736,6 +736,7 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
 
     w->avctx = avctx;
     w->idsp = *idsp;
+    w->er = *er;
     w->mb_x = 0;
     w->mb_y = 0;
     w->mb_width  = mb_width;
@@ -841,7 +842,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, 
Picture *pict,
     }
 
 error:
-    ff_er_add_slice(&s->er, 0, 0,
+    ff_er_add_slice(&w->er, 0, 0,
                     (w->mb_x >> 1) - 1, (w->mb_y >> 1) - 1,
                     ER_MB_END);
     return 0;
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index 6e7549c..d4d9c71 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -21,6 +21,7 @@
 
 #include "blockdsp.h"
 #include "get_bits.h"
+#include "error_resilience.h"
 #include "mpegvideo.h"
 #include "idctdsp.h"
 #include "intrax8dsp.h"
@@ -45,6 +46,7 @@ typedef struct IntraX8Context {
     IntraX8DSPContext dsp;
     IDCTDSPContext idsp;
     BlockDSPContext bdsp;
+    ERContext er;
     int quant;
     int dquant;
     int qsum;
@@ -80,6 +82,7 @@ typedef struct IntraX8Context {
  * @param avctx pointer to AVCodecContext
  * @param w pointer to IntraX8Context
  * @param idsp pointer to IDCTDSPContext
+ * @param er pointer to ERContext
  * @param block pointer to the array of blocks
  * @param block_last_index pointer to the array of indexes
  * @param mb_width macroblock width
@@ -89,7 +92,7 @@ typedef struct IntraX8Context {
  */
 int ff_intrax8_common_init(AVCodecContext *avctx,
                            IntraX8Context *w, IDCTDSPContext *idsp,
-                           int16_t (*block)[64],
+                           ERContext *er, int16_t (*block)[64],
                            int block_last_index[12],
                            int mb_width, int mb_height,
                            MpegEncContext *const s);
@@ -102,10 +105,8 @@ void ff_intrax8_common_end(IntraX8Context *w);
 
 /**
  * Decode single IntraX8 frame.
- * The parent codec must call ff_mpv_frame_start(), ff_er_frame_start()
- * before calling this function.
- * The parent codec must call ff_er_frame_end(), ff_mpv_frame_end() after
- * calling this function.
+ * The parent codec must call ff_mpv_frame_start() before calling this 
function.
+ * The parent codec must call ff_mpv_frame_end() after calling this function.
  * This function does not use ff_mpv_decode_mb().
  * @param w pointer to IntraX8Context
  * @param pict the output Picture containing an AVFrame
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 023e387..ec65d58 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -360,7 +360,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 //            return -1;
     }
 
-    ret = ff_intrax8_common_init(s->avctx, &v->x8, &s->idsp,
+    ret = ff_intrax8_common_init(s->avctx, &v->x8, &s->idsp, &s->er,
                                  s->block, s->block_last_index,
                                  s->mb_width, s->mb_height,
                                  s);
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 9edfdd3..0a04b04 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -469,7 +469,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
 
     ff_wmv2_common_init(w);
 
-    return ff_intrax8_common_init(avctx, &w->x8, &w->s.idsp,
+    return ff_intrax8_common_init(avctx, &w->x8, &w->s.idsp, &w->s.er,
                                   w->s.block, w->s.block_last_index,
                                   w->s.mb_width, w->s.mb_height, &w->s);
 }
-- 
2.7.0

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to