This allows dropping an afterwards redundant assert. --- libavcodec/intrax8.c | 12 +++++++++--- libavcodec/intrax8.h | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-)
Unchanged. diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c index bea1b76..0c720b0 100644 --- a/libavcodec/intrax8.c +++ b/libavcodec/intrax8.c @@ -742,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(); - assert(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_init_scantable(s->idsp.idct_permutation, &w->scantable[0], ff_wmv1_scantable[0]); @@ -759,6 +763,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 3339bc6..f69f03e 100644 --- a/libavcodec/intrax8.h +++ b/libavcodec/intrax8.h @@ -61,8 +61,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. -- 2.7.3 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel