[FFmpeg-cvslog] avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

2015-08-20 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer michae...@gmx.at | Thu Jul 
 9 22:16:15 2015 +0200| [c58b0d981ea7537507c79c29f5d4337d616da377] | committer: 
Michael Niedermayer

avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

This ensures that no stale pointers leak through on any path

Fixes: signal_sigsegv_c3097a_991_xtrem_e2_m64q15_a32sxx.3gp

Found-by: Samuel Groß, Mateusz j00ru Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit b160fc290cf49b516c5b6ee0730fd9da7fc623b1)

Signed-off-by: Michael Niedermayer michae...@gmx.at

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

 libavcodec/mpegvideo.c |   82 +---
 1 file changed, 78 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index f043bbd..bea62d9 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1285,6 +1285,82 @@ fail:
 return AVERROR(ENOMEM);
 }
 
+static void clear_context(MpegEncContext *s)
+{
+int i, j, k;
+
+memset(s-next_picture, 0, sizeof(s-next_picture));
+memset(s-last_picture, 0, sizeof(s-last_picture));
+memset(s-current_picture, 0, sizeof(s-current_picture));
+memset(s-new_picture, 0, sizeof(s-new_picture));
+
+memset(s-thread_context, 0, sizeof(s-thread_context));
+
+s-me.map = NULL;
+s-me.score_map = NULL;
+s-dct_error_sum = NULL;
+s-block = NULL;
+s-blocks = NULL;
+memset(s-pblocks, 0, sizeof(s-pblocks));
+s-ac_val_base = NULL;
+s-ac_val[0] =
+s-ac_val[1] =
+s-ac_val[2] =NULL;
+s-edge_emu_buffer = NULL;
+s-me.scratchpad = NULL;
+s-me.temp =
+s-rd_scratchpad =
+s-b_scratchpad =
+s-obmc_scratchpad = NULL;
+
+s-parse_context.buffer = NULL;
+s-parse_context.buffer_size = 0;
+s-bitstream_buffer = NULL;
+s-allocated_bitstream_buffer_size = 0;
+s-picture  = NULL;
+s-mb_type  = NULL;
+s-p_mv_table_base  = NULL;
+s-b_forw_mv_table_base = NULL;
+s-b_back_mv_table_base = NULL;
+s-b_bidir_forw_mv_table_base = NULL;
+s-b_bidir_back_mv_table_base = NULL;
+s-b_direct_mv_table_base = NULL;
+s-p_mv_table= NULL;
+s-b_forw_mv_table   = NULL;
+s-b_back_mv_table   = NULL;
+s-b_bidir_forw_mv_table = NULL;
+s-b_bidir_back_mv_table = NULL;
+s-b_direct_mv_table = NULL;
+for (i = 0; i  2; i++) {
+for (j = 0; j  2; j++) {
+for (k = 0; k  2; k++) {
+s-b_field_mv_table_base[i][j][k] = NULL;
+s-b_field_mv_table[i][j][k] = NULL;
+}
+s-b_field_select_table[i][j] = NULL;
+s-p_field_mv_table_base[i][j] = NULL;
+s-p_field_mv_table[i][j] = NULL;
+}
+s-p_field_select_table[i] = NULL;
+}
+
+s-dc_val_base = NULL;
+s-coded_block_base = NULL;
+s-mbintra_table = NULL;
+s-cbp_table = NULL;
+s-pred_dir_table = NULL;
+
+s-mbskip_table = NULL;
+
+s-er.error_status_table = NULL;
+s-er.er_temp_buffer = NULL;
+s-mb_index2xy = NULL;
+s-lambda_table = NULL;
+
+s-cplx_tab = NULL;
+s-bits_tab = NULL;
+}
+
 /**
  * init common structure for both encoder and decoder.
  * this assumes that some variables like width/height are already set
@@ -1296,6 +1372,8 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
  s-avctx-active_thread_type  FF_THREAD_SLICE) ?
 s-avctx-thread_count : 1;
 
+clear_context(s);
+
 if (s-encoding  s-avctx-slices)
 nb_slices = s-avctx-slices;
 
@@ -1343,10 +1421,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
 if (!s-picture[i].f)
 goto fail;
 }
-memset(s-next_picture, 0, sizeof(s-next_picture));
-memset(s-last_picture, 0, sizeof(s-last_picture));
-memset(s-current_picture, 0, sizeof(s-current_picture));
-memset(s-new_picture, 0, sizeof(s-new_picture));
 s-next_picture.f = av_frame_alloc();
 if (!s-next_picture.f)
 goto fail;

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


[FFmpeg-cvslog] avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

2015-07-27 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Thu Jul 
 9 22:16:15 2015 +0200| [d137bb92b29895207d0d2fccb34c235451771671] | committer: 
Michael Niedermayer

avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

This ensures that no stale pointers leak through on any path

Fixes: signal_sigsegv_c3097a_991_xtrem_e2_m64q15_a32sxx.3gp

Found-by: Samuel Groß, Mateusz j00ru Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit b160fc290cf49b516c5b6ee0730fd9da7fc623b1)

Signed-off-by: Michael Niedermayer michae...@gmx.at

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

 libavcodec/mpegvideo.c |   82 +---
 1 file changed, 78 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index f84557b..ade85e9 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1286,6 +1286,82 @@ fail:
 return AVERROR(ENOMEM);
 }
 
+static void clear_context(MpegEncContext *s)
+{
+int i, j, k;
+
+memset(s-next_picture, 0, sizeof(s-next_picture));
+memset(s-last_picture, 0, sizeof(s-last_picture));
+memset(s-current_picture, 0, sizeof(s-current_picture));
+memset(s-new_picture, 0, sizeof(s-new_picture));
+
+memset(s-thread_context, 0, sizeof(s-thread_context));
+
+s-me.map = NULL;
+s-me.score_map = NULL;
+s-dct_error_sum = NULL;
+s-block = NULL;
+s-blocks = NULL;
+memset(s-pblocks, 0, sizeof(s-pblocks));
+s-ac_val_base = NULL;
+s-ac_val[0] =
+s-ac_val[1] =
+s-ac_val[2] =NULL;
+s-edge_emu_buffer = NULL;
+s-me.scratchpad = NULL;
+s-me.temp =
+s-rd_scratchpad =
+s-b_scratchpad =
+s-obmc_scratchpad = NULL;
+
+s-parse_context.buffer = NULL;
+s-parse_context.buffer_size = 0;
+s-bitstream_buffer = NULL;
+s-allocated_bitstream_buffer_size = 0;
+s-picture  = NULL;
+s-mb_type  = NULL;
+s-p_mv_table_base  = NULL;
+s-b_forw_mv_table_base = NULL;
+s-b_back_mv_table_base = NULL;
+s-b_bidir_forw_mv_table_base = NULL;
+s-b_bidir_back_mv_table_base = NULL;
+s-b_direct_mv_table_base = NULL;
+s-p_mv_table= NULL;
+s-b_forw_mv_table   = NULL;
+s-b_back_mv_table   = NULL;
+s-b_bidir_forw_mv_table = NULL;
+s-b_bidir_back_mv_table = NULL;
+s-b_direct_mv_table = NULL;
+for (i = 0; i  2; i++) {
+for (j = 0; j  2; j++) {
+for (k = 0; k  2; k++) {
+s-b_field_mv_table_base[i][j][k] = NULL;
+s-b_field_mv_table[i][j][k] = NULL;
+}
+s-b_field_select_table[i][j] = NULL;
+s-p_field_mv_table_base[i][j] = NULL;
+s-p_field_mv_table[i][j] = NULL;
+}
+s-p_field_select_table[i] = NULL;
+}
+
+s-dc_val_base = NULL;
+s-coded_block_base = NULL;
+s-mbintra_table = NULL;
+s-cbp_table = NULL;
+s-pred_dir_table = NULL;
+
+s-mbskip_table = NULL;
+
+s-er.error_status_table = NULL;
+s-er.er_temp_buffer = NULL;
+s-mb_index2xy = NULL;
+s-lambda_table = NULL;
+
+s-cplx_tab = NULL;
+s-bits_tab = NULL;
+}
+
 /**
  * init common structure for both encoder and decoder.
  * this assumes that some variables like width/height are already set
@@ -1297,6 +1373,8 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
  s-avctx-active_thread_type  FF_THREAD_SLICE) ?
 s-avctx-thread_count : 1;
 
+clear_context(s);
+
 if (s-encoding  s-avctx-slices)
 nb_slices = s-avctx-slices;
 
@@ -1344,10 +1422,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
 if (!s-picture[i].f)
 goto fail;
 }
-memset(s-next_picture, 0, sizeof(s-next_picture));
-memset(s-last_picture, 0, sizeof(s-last_picture));
-memset(s-current_picture, 0, sizeof(s-current_picture));
-memset(s-new_picture, 0, sizeof(s-new_picture));
 s-next_picture.f = av_frame_alloc();
 if (!s-next_picture.f)
 goto fail;

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


[FFmpeg-cvslog] avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

2015-07-20 Thread Michael Niedermayer
ffmpeg | branch: release/2.6 | Michael Niedermayer michae...@gmx.at | Thu Jul 
 9 22:16:15 2015 +0200| [27a88f9d45d6fbd08796d8edc274a6758b3d170f] | committer: 
Michael Niedermayer

avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

This ensures that no stale pointers leak through on any path

Fixes: signal_sigsegv_c3097a_991_xtrem_e2_m64q15_a32sxx.3gp

Found-by: Samuel Groß, Mateusz j00ru Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit b160fc290cf49b516c5b6ee0730fd9da7fc623b1)

Signed-off-by: Michael Niedermayer michae...@gmx.at

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

 libavcodec/mpegvideo.c |   82 +---
 1 file changed, 78 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 72e7eda..4d67e7e 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1288,6 +1288,82 @@ fail:
 return AVERROR(ENOMEM);
 }
 
+static void clear_context(MpegEncContext *s)
+{
+int i, j, k;
+
+memset(s-next_picture, 0, sizeof(s-next_picture));
+memset(s-last_picture, 0, sizeof(s-last_picture));
+memset(s-current_picture, 0, sizeof(s-current_picture));
+memset(s-new_picture, 0, sizeof(s-new_picture));
+
+memset(s-thread_context, 0, sizeof(s-thread_context));
+
+s-me.map = NULL;
+s-me.score_map = NULL;
+s-dct_error_sum = NULL;
+s-block = NULL;
+s-blocks = NULL;
+memset(s-pblocks, 0, sizeof(s-pblocks));
+s-ac_val_base = NULL;
+s-ac_val[0] =
+s-ac_val[1] =
+s-ac_val[2] =NULL;
+s-edge_emu_buffer = NULL;
+s-me.scratchpad = NULL;
+s-me.temp =
+s-rd_scratchpad =
+s-b_scratchpad =
+s-obmc_scratchpad = NULL;
+
+s-parse_context.buffer = NULL;
+s-parse_context.buffer_size = 0;
+s-bitstream_buffer = NULL;
+s-allocated_bitstream_buffer_size = 0;
+s-picture  = NULL;
+s-mb_type  = NULL;
+s-p_mv_table_base  = NULL;
+s-b_forw_mv_table_base = NULL;
+s-b_back_mv_table_base = NULL;
+s-b_bidir_forw_mv_table_base = NULL;
+s-b_bidir_back_mv_table_base = NULL;
+s-b_direct_mv_table_base = NULL;
+s-p_mv_table= NULL;
+s-b_forw_mv_table   = NULL;
+s-b_back_mv_table   = NULL;
+s-b_bidir_forw_mv_table = NULL;
+s-b_bidir_back_mv_table = NULL;
+s-b_direct_mv_table = NULL;
+for (i = 0; i  2; i++) {
+for (j = 0; j  2; j++) {
+for (k = 0; k  2; k++) {
+s-b_field_mv_table_base[i][j][k] = NULL;
+s-b_field_mv_table[i][j][k] = NULL;
+}
+s-b_field_select_table[i][j] = NULL;
+s-p_field_mv_table_base[i][j] = NULL;
+s-p_field_mv_table[i][j] = NULL;
+}
+s-p_field_select_table[i] = NULL;
+}
+
+s-dc_val_base = NULL;
+s-coded_block_base = NULL;
+s-mbintra_table = NULL;
+s-cbp_table = NULL;
+s-pred_dir_table = NULL;
+
+s-mbskip_table = NULL;
+
+s-er.error_status_table = NULL;
+s-er.er_temp_buffer = NULL;
+s-mb_index2xy = NULL;
+s-lambda_table = NULL;
+
+s-cplx_tab = NULL;
+s-bits_tab = NULL;
+}
+
 /**
  * init common structure for both encoder and decoder.
  * this assumes that some variables like width/height are already set
@@ -1299,6 +1375,8 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
  s-avctx-active_thread_type  FF_THREAD_SLICE) ?
 s-avctx-thread_count : 1;
 
+clear_context(s);
+
 if (s-encoding  s-avctx-slices)
 nb_slices = s-avctx-slices;
 
@@ -1346,10 +1424,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
 if (!s-picture[i].f)
 goto fail;
 }
-memset(s-next_picture, 0, sizeof(s-next_picture));
-memset(s-last_picture, 0, sizeof(s-last_picture));
-memset(s-current_picture, 0, sizeof(s-current_picture));
-memset(s-new_picture, 0, sizeof(s-new_picture));
 s-next_picture.f = av_frame_alloc();
 if (!s-next_picture.f)
 goto fail;

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


[FFmpeg-cvslog] avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer michae...@gmx.at | Thu Jul 
 9 22:16:15 2015 +0200| [88fa3243ddf320ce1d6691c6098e87263bd6d0ca] | committer: 
Michael Niedermayer

avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

This ensures that no stale pointers leak through on any path

Fixes: signal_sigsegv_c3097a_991_xtrem_e2_m64q15_a32sxx.3gp

Found-by: Samuel Groß, Mateusz j00ru Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit b160fc290cf49b516c5b6ee0730fd9da7fc623b1)

Signed-off-by: Michael Niedermayer michae...@gmx.at

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

 libavcodec/mpegvideo.c |   82 +---
 1 file changed, 78 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 03d6815..06188a0 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1227,6 +1227,82 @@ fail:
 return AVERROR(ENOMEM);
 }
 
+static void clear_context(MpegEncContext *s)
+{
+int i, j, k;
+
+memset(s-next_picture, 0, sizeof(s-next_picture));
+memset(s-last_picture, 0, sizeof(s-last_picture));
+memset(s-current_picture, 0, sizeof(s-current_picture));
+memset(s-new_picture, 0, sizeof(s-new_picture));
+
+memset(s-thread_context, 0, sizeof(s-thread_context));
+
+s-me.map = NULL;
+s-me.score_map = NULL;
+s-dct_error_sum = NULL;
+s-block = NULL;
+s-blocks = NULL;
+memset(s-pblocks, 0, sizeof(s-pblocks));
+s-ac_val_base = NULL;
+s-ac_val[0] =
+s-ac_val[1] =
+s-ac_val[2] =NULL;
+s-sc.edge_emu_buffer = NULL;
+s-me.scratchpad = NULL;
+s-me.temp =
+s-sc.rd_scratchpad =
+s-sc.b_scratchpad =
+s-sc.obmc_scratchpad = NULL;
+
+s-parse_context.buffer = NULL;
+s-parse_context.buffer_size = 0;
+s-bitstream_buffer = NULL;
+s-allocated_bitstream_buffer_size = 0;
+s-picture  = NULL;
+s-mb_type  = NULL;
+s-p_mv_table_base  = NULL;
+s-b_forw_mv_table_base = NULL;
+s-b_back_mv_table_base = NULL;
+s-b_bidir_forw_mv_table_base = NULL;
+s-b_bidir_back_mv_table_base = NULL;
+s-b_direct_mv_table_base = NULL;
+s-p_mv_table= NULL;
+s-b_forw_mv_table   = NULL;
+s-b_back_mv_table   = NULL;
+s-b_bidir_forw_mv_table = NULL;
+s-b_bidir_back_mv_table = NULL;
+s-b_direct_mv_table = NULL;
+for (i = 0; i  2; i++) {
+for (j = 0; j  2; j++) {
+for (k = 0; k  2; k++) {
+s-b_field_mv_table_base[i][j][k] = NULL;
+s-b_field_mv_table[i][j][k] = NULL;
+}
+s-b_field_select_table[i][j] = NULL;
+s-p_field_mv_table_base[i][j] = NULL;
+s-p_field_mv_table[i][j] = NULL;
+}
+s-p_field_select_table[i] = NULL;
+}
+
+s-dc_val_base = NULL;
+s-coded_block_base = NULL;
+s-mbintra_table = NULL;
+s-cbp_table = NULL;
+s-pred_dir_table = NULL;
+
+s-mbskip_table = NULL;
+
+s-er.error_status_table = NULL;
+s-er.er_temp_buffer = NULL;
+s-mb_index2xy = NULL;
+s-lambda_table = NULL;
+
+s-cplx_tab = NULL;
+s-bits_tab = NULL;
+}
+
 /**
  * init common structure for both encoder and decoder.
  * this assumes that some variables like width/height are already set
@@ -1238,6 +1314,8 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
  s-avctx-active_thread_type  FF_THREAD_SLICE) ?
 s-avctx-thread_count : 1;
 
+clear_context(s);
+
 if (s-encoding  s-avctx-slices)
 nb_slices = s-avctx-slices;
 
@@ -1282,10 +1360,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
 if (!s-picture[i].f)
 goto fail;
 }
-memset(s-next_picture, 0, sizeof(s-next_picture));
-memset(s-last_picture, 0, sizeof(s-last_picture));
-memset(s-current_picture, 0, sizeof(s-current_picture));
-memset(s-new_picture, 0, sizeof(s-new_picture));
 s-next_picture.f = av_frame_alloc();
 if (!s-next_picture.f)
 goto fail;

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


[FFmpeg-cvslog] avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

2015-07-09 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu Jul  9 
22:16:15 2015 +0200| [b160fc290cf49b516c5b6ee0730fd9da7fc623b1] | committer: 
Michael Niedermayer

avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

This ensures that no stale pointers leak through on any path

Fixes: signal_sigsegv_c3097a_991_xtrem_e2_m64q15_a32sxx.3gp

Found-by: Samuel Groß, Mateusz j00ru Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer michae...@gmx.at

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

 libavcodec/mpegvideo.c |   82 +---
 1 file changed, 78 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 99d8577..637b569 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -785,6 +785,82 @@ fail:
 return AVERROR(ENOMEM);
 }
 
+static void clear_context(MpegEncContext *s)
+{
+int i, j, k;
+
+memset(s-next_picture, 0, sizeof(s-next_picture));
+memset(s-last_picture, 0, sizeof(s-last_picture));
+memset(s-current_picture, 0, sizeof(s-current_picture));
+memset(s-new_picture, 0, sizeof(s-new_picture));
+
+memset(s-thread_context, 0, sizeof(s-thread_context));
+
+s-me.map = NULL;
+s-me.score_map = NULL;
+s-dct_error_sum = NULL;
+s-block = NULL;
+s-blocks = NULL;
+memset(s-pblocks, 0, sizeof(s-pblocks));
+s-ac_val_base = NULL;
+s-ac_val[0] =
+s-ac_val[1] =
+s-ac_val[2] =NULL;
+s-sc.edge_emu_buffer = NULL;
+s-me.scratchpad = NULL;
+s-me.temp =
+s-sc.rd_scratchpad =
+s-sc.b_scratchpad =
+s-sc.obmc_scratchpad = NULL;
+
+s-parse_context.buffer = NULL;
+s-parse_context.buffer_size = 0;
+s-bitstream_buffer = NULL;
+s-allocated_bitstream_buffer_size = 0;
+s-picture  = NULL;
+s-mb_type  = NULL;
+s-p_mv_table_base  = NULL;
+s-b_forw_mv_table_base = NULL;
+s-b_back_mv_table_base = NULL;
+s-b_bidir_forw_mv_table_base = NULL;
+s-b_bidir_back_mv_table_base = NULL;
+s-b_direct_mv_table_base = NULL;
+s-p_mv_table= NULL;
+s-b_forw_mv_table   = NULL;
+s-b_back_mv_table   = NULL;
+s-b_bidir_forw_mv_table = NULL;
+s-b_bidir_back_mv_table = NULL;
+s-b_direct_mv_table = NULL;
+for (i = 0; i  2; i++) {
+for (j = 0; j  2; j++) {
+for (k = 0; k  2; k++) {
+s-b_field_mv_table_base[i][j][k] = NULL;
+s-b_field_mv_table[i][j][k] = NULL;
+}
+s-b_field_select_table[i][j] = NULL;
+s-p_field_mv_table_base[i][j] = NULL;
+s-p_field_mv_table[i][j] = NULL;
+}
+s-p_field_select_table[i] = NULL;
+}
+
+s-dc_val_base = NULL;
+s-coded_block_base = NULL;
+s-mbintra_table = NULL;
+s-cbp_table = NULL;
+s-pred_dir_table = NULL;
+
+s-mbskip_table = NULL;
+
+s-er.error_status_table = NULL;
+s-er.er_temp_buffer = NULL;
+s-mb_index2xy = NULL;
+s-lambda_table = NULL;
+
+s-cplx_tab = NULL;
+s-bits_tab = NULL;
+}
+
 /**
  * init common structure for both encoder and decoder.
  * this assumes that some variables like width/height are already set
@@ -796,6 +872,8 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
  s-avctx-active_thread_type  FF_THREAD_SLICE) ?
 s-avctx-thread_count : 1;
 
+clear_context(s);
+
 if (s-encoding  s-avctx-slices)
 nb_slices = s-avctx-slices;
 
@@ -840,10 +918,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
 if (!s-picture[i].f)
 goto fail;
 }
-memset(s-next_picture, 0, sizeof(s-next_picture));
-memset(s-last_picture, 0, sizeof(s-last_picture));
-memset(s-current_picture, 0, sizeof(s-current_picture));
-memset(s-new_picture, 0, sizeof(s-new_picture));
 s-next_picture.f = av_frame_alloc();
 if (!s-next_picture.f)
 goto fail;

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