RV3 and RV4 decoders set some deblocking coefs for each macroblock,

so store them in the context and register a function to calculate them.

Originally committed as revision 15651 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Kostya Shishkov 2008-10-20 05:58:05 +00:00
parent c0b821befb
commit def4f63b85
2 changed files with 6 additions and 0 deletions

View File

@ -1039,6 +1039,8 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types)
cbp = cbp2 = rv34_decode_mb_header(r, intra_types); cbp = cbp2 = rv34_decode_mb_header(r, intra_types);
r->cbp_luma [s->mb_x + s->mb_y * s->mb_stride] = cbp; r->cbp_luma [s->mb_x + s->mb_y * s->mb_stride] = cbp;
r->cbp_chroma[s->mb_x + s->mb_y * s->mb_stride] = cbp >> 16; r->cbp_chroma[s->mb_x + s->mb_y * s->mb_stride] = cbp >> 16;
if(r->set_deblock_coef)
r->deblock_coefs[s->mb_x + s->mb_y * s->mb_stride] = r->set_deblock_coef(r);
s->current_picture.qscale_table[s->mb_x + s->mb_y * s->mb_stride] = s->qscale; s->current_picture.qscale_table[s->mb_x + s->mb_y * s->mb_stride] = s->qscale;
if(cbp == -1) if(cbp == -1)
@ -1132,6 +1134,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, uint8_t* buf, int buf_s
r->mb_type = av_realloc(r->mb_type, r->s.mb_stride * r->s.mb_height * sizeof(*r->mb_type)); r->mb_type = av_realloc(r->mb_type, r->s.mb_stride * r->s.mb_height * sizeof(*r->mb_type));
r->cbp_luma = av_realloc(r->cbp_luma, r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_luma)); r->cbp_luma = av_realloc(r->cbp_luma, r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_luma));
r->cbp_chroma = av_realloc(r->cbp_chroma, r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_chroma)); r->cbp_chroma = av_realloc(r->cbp_chroma, r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_chroma));
r->deblock_coefs = av_realloc(r->deblock_coefs, r->s.mb_stride * r->s.mb_height * sizeof(*r->deblock_coefs));
} }
s->pict_type = r->si.type ? r->si.type : FF_I_TYPE; s->pict_type = r->si.type ? r->si.type : FF_I_TYPE;
if(MPV_frame_start(s, s->avctx) < 0) if(MPV_frame_start(s, s->avctx) < 0)
@ -1226,6 +1229,7 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
r->cbp_luma = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_luma)); r->cbp_luma = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_luma));
r->cbp_chroma = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_chroma)); r->cbp_chroma = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_chroma));
r->deblock_coefs = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->deblock_coefs));
if(!intra_vlcs[0].cbppattern[0].bits) if(!intra_vlcs[0].cbppattern[0].bits)
rv34_init_tables(); rv34_init_tables();

View File

@ -107,6 +107,7 @@ typedef struct RV34DecContext{
uint16_t *cbp_luma; ///< CBP values for luma subblocks uint16_t *cbp_luma; ///< CBP values for luma subblocks
uint8_t *cbp_chroma; ///< CBP values for chroma subblocks uint8_t *cbp_chroma; ///< CBP values for chroma subblocks
int *deblock_coefs; ///< deblock coefficients for each macroblock
/** 8x8 block available flags (for MV prediction) */ /** 8x8 block available flags (for MV prediction) */
DECLARE_ALIGNED_8(uint32_t, avail_cache[3*4]); DECLARE_ALIGNED_8(uint32_t, avail_cache[3*4]);
@ -114,6 +115,7 @@ typedef struct RV34DecContext{
int (*parse_slice_header)(struct RV34DecContext *r, GetBitContext *gb, SliceInfo *si); int (*parse_slice_header)(struct RV34DecContext *r, GetBitContext *gb, SliceInfo *si);
int (*decode_mb_info)(struct RV34DecContext *r); int (*decode_mb_info)(struct RV34DecContext *r);
int (*decode_intra_types)(struct RV34DecContext *r, GetBitContext *gb, int8_t *dst); int (*decode_intra_types)(struct RV34DecContext *r, GetBitContext *gb, int8_t *dst);
int (*set_deblock_coef)(struct RV34DecContext *r);
void (*loop_filter)(struct RV34DecContext *r); void (*loop_filter)(struct RV34DecContext *r);
}RV34DecContext; }RV34DecContext;