From 1eaae7abb8f208fefb4e8b9e983e61b2499206a3 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Sat, 20 Feb 2016 00:43:22 -0500 Subject: intrax8: Reference the current AVCodecContext It will be needed to initialize BlockDSP in the next commit. --- libavcodec/intrax8.c | 4 +++- libavcodec/intrax8.h | 5 ++++- libavcodec/vc1dec.c | 2 +- libavcodec/wmv2dec.c | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c index f23ab811c2..b35d25214b 100644 --- a/libavcodec/intrax8.c +++ b/libavcodec/intrax8.c @@ -737,13 +737,15 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame *frame, int mb_y) w->dest[2] += (mb_y & (~1)) * uvlinesize << 2; } -av_cold int ff_intrax8_common_init(IntraX8Context *w, IDCTDSPContext *idsp, +av_cold int ff_intrax8_common_init(AVCodecContext *avctx, + IntraX8Context *w, IDCTDSPContext *idsp, MpegEncContext *const s) { int ret = x8_vlc_init(); if (ret < 0) return ret; + w->avctx = avctx; w->idsp = *idsp; w->s = s; diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h index f07349f3c4..7a0eaf7a66 100644 --- a/libavcodec/intrax8.h +++ b/libavcodec/intrax8.h @@ -35,6 +35,7 @@ typedef struct IntraX8Context { // set by ff_intrax8_common_init uint8_t *prediction_table; // 2 * (mb_w * 2) ScanTable scantable[3]; + AVCodecContext *avctx; // set by the caller codec MpegEncContext *s; @@ -67,12 +68,14 @@ typedef struct IntraX8Context { /** * Initialize IntraX8 frame decoder. * Requires valid MpegEncContext with valid s->mb_width before calling. + * @param avctx pointer to AVCodecContext * @param w pointer to IntraX8Context * @param idsp pointer to IDCTDSPContext * @param s pointer to MpegEncContext of the parent codec * @return 0 on success, a negative AVERROR value on error */ -int ff_intrax8_common_init(IntraX8Context *w, IDCTDSPContext *idsp, +int ff_intrax8_common_init(AVCodecContext *avctx, + IntraX8Context *w, IDCTDSPContext *idsp, MpegEncContext *const s); /** diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 9e64a6bcd3..250d72ab14 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -379,7 +379,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v) } } - ret = ff_intrax8_common_init(&v->x8, &s->idsp, s); + ret = ff_intrax8_common_init(s->avctx, &v->x8, &s->idsp, s); if (ret < 0) goto error; diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index d7828ad11e..0560d95738 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -473,7 +473,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx) ff_wmv2_common_init(w); - return ff_intrax8_common_init(&w->x8, &w->s.idsp, &w->s); + return ff_intrax8_common_init(avctx, &w->x8, &w->s.idsp, &w->s); } static av_cold int wmv2_decode_end(AVCodecContext *avctx) -- cgit v1.2.3