X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Frv40.c;h=e236c8fa05bd4e59ac8e1c3e161ebfea9b0fc552;hb=2a81f4bde50f731074c1be7368128de49f78925a;hp=98f8514abf583d7dbf1df8b71c0e095f8a671864;hpb=0a044f0f0634362f03bfd8e2bc9d273a71ea22e2;p=ffmpeg diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c index 98f8514abf5..e236c8fa05b 100644 --- a/libavcodec/rv40.c +++ b/libavcodec/rv40.c @@ -20,10 +20,12 @@ */ /** - * @file libavcodec/rv40.c + * @file * RV40 decoder */ +#include "libavcore/imgutils.h" + #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" @@ -76,17 +78,17 @@ static av_cold void rv40_init_tables(void) aic_mode2_vlc_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); } for(i = 0; i < NUM_PTYPE_VLCS; i++){ - ptype_vlc[i].table = &ptype_table[i << PTYPE_VLC_BITS]; - ptype_vlc[i].table_allocated = 1 << PTYPE_VLC_BITS; - init_vlc_sparse(&ptype_vlc[i], PTYPE_VLC_BITS, PTYPE_VLC_SIZE, + ptype_vlc[i].table = &ptype_table[i << PTYPE_VLC_BITS]; + ptype_vlc[i].table_allocated = 1 << PTYPE_VLC_BITS; + init_vlc_sparse(&ptype_vlc[i], PTYPE_VLC_BITS, PTYPE_VLC_SIZE, ptype_vlc_bits[i], 1, 1, ptype_vlc_codes[i], 1, 1, ptype_vlc_syms, 1, 1, INIT_VLC_USE_NEW_STATIC); } for(i = 0; i < NUM_BTYPE_VLCS; i++){ - btype_vlc[i].table = &btype_table[i << BTYPE_VLC_BITS]; - btype_vlc[i].table_allocated = 1 << BTYPE_VLC_BITS; - init_vlc_sparse(&btype_vlc[i], BTYPE_VLC_BITS, BTYPE_VLC_SIZE, + btype_vlc[i].table = &btype_table[i << BTYPE_VLC_BITS]; + btype_vlc[i].table_allocated = 1 << BTYPE_VLC_BITS; + init_vlc_sparse(&btype_vlc[i], BTYPE_VLC_BITS, BTYPE_VLC_SIZE, btype_vlc_bits[i], 1, 1, btype_vlc_codes[i], 1, 1, btype_vlc_syms, 1, 1, INIT_VLC_USE_NEW_STATIC); @@ -142,7 +144,7 @@ static int rv40_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceIn si->pts = get_bits(gb, 13); if(!si->type || !get_bits1(gb)) rv40_parse_picture_size(gb, &w, &h); - if(avcodec_check_dimensions(r->s.avctx, w, h) < 0) + if(av_image_check_size(w, h, 0, r->s.avctx) < 0) return -1; si->width = w; si->height = h; @@ -164,7 +166,7 @@ static int rv40_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t int pattern; int8_t *ptr; - for(i = 0; i < 4; i++, dst += s->b4_stride){ + for(i = 0; i < 4; i++, dst += r->intra_types_stride){ if(!i && s->first_slice_line){ pattern = get_vlc2(gb, aic_top_vlc.table, AIC_TOP_BITS, 1); dst[0] = (pattern >> 2) & 2; @@ -181,8 +183,8 @@ static int rv40_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t * The second one (used for retrieving only one coefficient) is * top + 10 * left. */ - A = ptr[-s->b4_stride + 1]; // it won't be used for the last coefficient in a row - B = ptr[-s->b4_stride]; + A = ptr[-r->intra_types_stride + 1]; // it won't be used for the last coefficient in a row + B = ptr[-r->intra_types_stride]; C = ptr[-1]; pattern = A + (B << 4) + (C << 8); for(k = 0; k < MODE2_PATTERNS_NUM; k++) @@ -235,13 +237,13 @@ static int rv40_decode_mb_info(RV34DecContext *r) if(--r->s.mb_skip_run) return RV34_MB_SKIP; - if(r->avail_cache[5-1]) + if(r->avail_cache[6-1]) blocks[r->mb_type[mb_pos - 1]]++; - if(r->avail_cache[5-4]){ + if(r->avail_cache[6-4]){ blocks[r->mb_type[mb_pos - s->mb_stride]]++; - if(r->avail_cache[5-2]) + if(r->avail_cache[6-2]) blocks[r->mb_type[mb_pos - s->mb_stride + 1]]++; - if(r->avail_cache[5-5]) + if(r->avail_cache[6-5]) blocks[r->mb_type[mb_pos - s->mb_stride - 1]]++; } @@ -307,7 +309,7 @@ static inline void rv40_weak_loop_filter(uint8_t *src, const int step, } } -static inline void rv40_adaptive_loop_filter(uint8_t *src, const int step, +static av_always_inline void rv40_adaptive_loop_filter(uint8_t *src, const int step, const int stride, const int dmode, const int lim_q1, const int lim_p1, const int alpha, @@ -668,7 +670,7 @@ static av_cold int rv40_decode_init(AVCodecContext *avctx) AVCodec rv40_decoder = { "rv40", - CODEC_TYPE_VIDEO, + AVMEDIA_TYPE_VIDEO, CODEC_ID_RV40, sizeof(RV34DecContext), rv40_decode_init,