MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / rv34_decode_inter_macroblock

Function rv34_decode_inter_macroblock

libavcodec/rv34.c:1212–1318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1210}
1211
1212static int rv34_decode_inter_macroblock(RV34DecContext *r, int8_t *intra_types)
1213{
1214 MpegEncContext *s = &r->s;
1215 GetBitContext *const gb = &r->gb;
1216 uint8_t *dst = s->dest[0];
1217 int16_t *const ptr = r->block;
1218 int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
1219 int cbp, cbp2;
1220 int q_dc, q_ac, has_ac;
1221 int i, j;
1222 int dist;
1223
1224 // Calculate which neighbours are available. Maybe it's worth optimizing too.
1225 memset(r->avail_cache, 0, sizeof(r->avail_cache));
1226 fill_rectangle(r->avail_cache + 6, 2, 2, 4, 1, 4);
1227 dist = (s->mb_x - s->resync_mb_x) + (s->mb_y - s->resync_mb_y) * s->mb_width;
1228 if(s->mb_x && dist)
1229 r->avail_cache[5] =
1230 r->avail_cache[9] = s->cur_pic.mb_type[mb_pos - 1];
1231 if(dist >= s->mb_width)
1232 r->avail_cache[2] =
1233 r->avail_cache[3] = s->cur_pic.mb_type[mb_pos - s->mb_stride];
1234 if(((s->mb_x+1) < s->mb_width) && dist >= s->mb_width - 1)
1235 r->avail_cache[4] = s->cur_pic.mb_type[mb_pos - s->mb_stride + 1];
1236 if(s->mb_x && dist > s->mb_width)
1237 r->avail_cache[1] = s->cur_pic.mb_type[mb_pos - s->mb_stride - 1];
1238
1239 s->qscale = r->si.quant;
1240 cbp = cbp2 = rv34_decode_inter_mb_header(r, intra_types);
1241 r->cbp_luma [mb_pos] = cbp;
1242 r->cbp_chroma[mb_pos] = cbp >> 16;
1243 r->deblock_coefs[mb_pos] = rv34_set_deblock_coef(r) | r->cbp_luma[mb_pos];
1244 s->cur_pic.qscale_table[mb_pos] = s->qscale;
1245
1246 if(cbp == -1)
1247 return -1;
1248
1249 if (IS_INTRA(s->cur_pic.mb_type[mb_pos])) {
1250 if(r->is16) rv34_output_i16x16(r, intra_types, cbp);
1251 else rv34_output_intra(r, intra_types, cbp);
1252 return 0;
1253 }
1254
1255 if(r->is16){
1256 // Only for RV34_MB_P_MIX16x16
1257 LOCAL_ALIGNED_16(int16_t, block16, [16]);
1258 memset(block16, 0, 16 * sizeof(*block16));
1259 q_dc = rv34_qscale_tab[ r->luma_dc_quant_p[s->qscale] ];
1260 q_ac = rv34_qscale_tab[s->qscale];
1261 if (rv34_decode_block(block16, gb, r->cur_vlcs, 3, 0, q_dc, q_dc, q_ac))
1262 r->rdsp.rv34_inv_transform(block16);
1263 else
1264 r->rdsp.rv34_inv_transform_dc(block16);
1265
1266 q_ac = rv34_qscale_tab[s->qscale];
1267
1268 for(j = 0; j < 4; j++){
1269 for(i = 0; i < 4; i++, cbp >>= 1){

Callers 1

rv34_decode_sliceFunction · 0.85

Calls 8

rv34_set_deblock_coefFunction · 0.85
rv34_output_i16x16Function · 0.85
rv34_output_intraFunction · 0.85
rv34_decode_blockFunction · 0.85
choose_vlc_setFunction · 0.85
rv34_process_blockFunction · 0.85
fill_rectangleFunction · 0.70

Tested by

no test coverage detected