[FFmpeg-cvslog] Merge commit '0372e73f917e72c40b09270f771046fc142be4a7'
Derek Buitenhuis
git at videolan.org
Sun Apr 17 20:32:10 CEST 2016
ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Sun Apr 17 19:31:32 2016 +0100| [f64b53f2bf5f3f43402564bf57a8555a709d012c] | committer: Derek Buitenhuis
Merge commit '0372e73f917e72c40b09270f771046fc142be4a7'
* commit '0372e73f917e72c40b09270f771046fc142be4a7':
intrax8: Check and propagate errors from ff_intrax8_common_init
Merged-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f64b53f2bf5f3f43402564bf57a8555a709d012c
---
libavcodec/intrax8.c | 20 +++++++++++++++-----
libavcodec/intrax8.h | 3 ++-
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index e655c6e..927f0eb 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -46,7 +46,7 @@ static VLC j_ac_vlc[2][2][8]; // [quant < 13], [intra / inter], [select]
static VLC j_dc_vlc[2][8]; // [quant], [select]
static VLC j_orient_vlc[2][4]; // [quant], [select]
-static av_cold void x8_vlc_init(void)
+static av_cold int x8_vlc_init(void)
{
int i;
int offset = 0;
@@ -115,9 +115,13 @@ static av_cold void x8_vlc_init(void)
init_or_vlc(j_orient_vlc[1][i], x8_orient_lowquant_table[i][0]);
#undef init_or_vlc
- if (offset != sizeof(table)/sizeof(VLC_TYPE)/2)
+ if (offset != sizeof(table) / sizeof(VLC_TYPE) / 2) {
av_log(NULL, AV_LOG_ERROR, "table size %zd does not match needed %i\n",
sizeof(table) / sizeof(VLC_TYPE) / 2, offset);
+ return AVERROR_INVALIDDATA;
+ }
+
+ return 0;
}
static void x8_reset_vlc_tables(IntraX8Context *w)
@@ -738,14 +742,18 @@ static void x8_init_block_index(MpegEncContext *s)
s->dest[2] += (s->mb_y & (~1)) * uvlinesize << 2;
}
-av_cold void ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
+av_cold int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
{
+ int ret = x8_vlc_init();
+ if (ret < 0)
+ return ret;
+
w->s = s;
- x8_vlc_init();
- av_assert0(s->mb_width > 0);
//two rows, 2 blocks per cannon mb
w->prediction_table = av_mallocz(s->mb_width * 2 * 2);
+ if (!w->prediction_table)
+ return AVERROR(ENOMEM);
ff_wmv2dsp_init(&w->wdsp);
@@ -760,6 +768,8 @@ av_cold void ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
ff_wmv1_scantable[3]);
ff_intrax8dsp_init(&w->dsp);
+
+ return 0;
}
av_cold void ff_intrax8_common_end(IntraX8Context *w)
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index 4d99c8d..c2e4501 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -64,8 +64,9 @@ typedef struct IntraX8Context {
* Requires valid MpegEncContext with valid s->mb_width before calling.
* @param w pointer to IntraX8Context
* @param s pointer to MpegEncContext of the parent codec
+ * @return 0 on success, a negative AVERROR value on error
*/
-void ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s);
+int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s);
/**
* Destroy IntraX8 frame structure.
======================================================================
diff --cc libavcodec/intrax8.c
index e655c6e,b961395..927f0eb
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@@ -738,25 -743,24 +742,29 @@@ static void x8_init_block_index(MpegEnc
s->dest[2] += (s->mb_y & (~1)) * uvlinesize << 2;
}
- av_cold void ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
+ av_cold int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
{
+ int ret = x8_vlc_init();
+ if (ret < 0)
+ return ret;
+
w->s = s;
- x8_vlc_init();
- av_assert0(s->mb_width > 0);
- // two rows, 2 blocks per cannon mb
+ //two rows, 2 blocks per cannon mb
w->prediction_table = av_mallocz(s->mb_width * 2 * 2);
+ if (!w->prediction_table)
+ return AVERROR(ENOMEM);
- ff_init_scantable(s->idsp.idct_permutation, &w->scantable[0],
+ ff_wmv2dsp_init(&w->wdsp);
+
+ ff_init_scantable_permutation(w->idct_permutation,
+ w->wdsp.idct_perm);
+
+ ff_init_scantable(w->idct_permutation, &w->scantable[0],
ff_wmv1_scantable[0]);
- ff_init_scantable(s->idsp.idct_permutation, &w->scantable[1],
+ ff_init_scantable(w->idct_permutation, &w->scantable[1],
ff_wmv1_scantable[2]);
- ff_init_scantable(s->idsp.idct_permutation, &w->scantable[2],
+ ff_init_scantable(w->idct_permutation, &w->scantable[2],
ff_wmv1_scantable[3]);
ff_intrax8dsp_init(&w->dsp);
More information about the ffmpeg-cvslog
mailing list