comparison cavsdec.c @ 5401:cb5d5d2ee6fd libavcodec

have less functions as inline
author stefang
date Wed, 25 Jul 2007 05:09:54 +0000
parents 2a3d31a8c66f
children b790f8c0ee24
comparison
equal deleted inserted replaced
5400:2433e0070455 5401:cb5d5d2ee6fd
191 int block, pred_mode_uv; 191 int block, pred_mode_uv;
192 uint8_t top[18]; 192 uint8_t top[18];
193 uint8_t *left = NULL; 193 uint8_t *left = NULL;
194 uint8_t *d; 194 uint8_t *d;
195 195
196 init_mb(h); 196 ff_cavs_init_mb(h);
197 197
198 /* get intra prediction modes from stream */ 198 /* get intra prediction modes from stream */
199 for(block=0;block<4;block++) { 199 for(block=0;block<4;block++) {
200 int nA,nB,predpred; 200 int nA,nB,predpred;
201 int pos = ff_cavs_scan3x3[block]; 201 int pos = ff_cavs_scan3x3[block];
214 pred_mode_uv = get_ue_golomb(gb); 214 pred_mode_uv = get_ue_golomb(gb);
215 if(pred_mode_uv > 6) { 215 if(pred_mode_uv > 6) {
216 av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra chroma pred mode\n"); 216 av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra chroma pred mode\n");
217 return -1; 217 return -1;
218 } 218 }
219 modify_mb_i(h, &pred_mode_uv); 219 ff_cavs_modify_mb_i(h, &pred_mode_uv);
220 220
221 /* get coded block pattern */ 221 /* get coded block pattern */
222 if(h->pic_type == FF_I_TYPE) 222 if(h->pic_type == FF_I_TYPE)
223 cbp_code = get_ue_golomb(gb); 223 cbp_code = get_ue_golomb(gb);
224 if(cbp_code > 63){ 224 if(cbp_code > 63){
230 h->qp = (h->qp + get_se_golomb(gb)) & 63; //qp_delta 230 h->qp = (h->qp + get_se_golomb(gb)) & 63; //qp_delta
231 231
232 /* luma intra prediction interleaved with residual decode/transform/add */ 232 /* luma intra prediction interleaved with residual decode/transform/add */
233 for(block=0;block<4;block++) { 233 for(block=0;block<4;block++) {
234 d = h->cy + h->luma_scan[block]; 234 d = h->cy + h->luma_scan[block];
235 load_intra_pred_luma(h, top, &left, block); 235 ff_cavs_load_intra_pred_luma(h, top, &left, block);
236 h->intra_pred_l[h->pred_mode_Y[ff_cavs_scan3x3[block]]] 236 h->intra_pred_l[h->pred_mode_Y[ff_cavs_scan3x3[block]]]
237 (d, top, left, h->l_stride); 237 (d, top, left, h->l_stride);
238 if(h->cbp & (1<<block)) 238 if(h->cbp & (1<<block))
239 decode_residual_block(h,gb,ff_cavs_intra_dec,1,h->qp,d,h->l_stride); 239 decode_residual_block(h,gb,ff_cavs_intra_dec,1,h->qp,d,h->l_stride);
240 } 240 }
241 241
242 /* chroma intra prediction */ 242 /* chroma intra prediction */
243 load_intra_pred_chroma(h); 243 ff_cavs_load_intra_pred_chroma(h);
244 h->intra_pred_c[pred_mode_uv](h->cu, &h->top_border_u[h->mbx*10], 244 h->intra_pred_c[pred_mode_uv](h->cu, &h->top_border_u[h->mbx*10],
245 h->left_border_u, h->c_stride); 245 h->left_border_u, h->c_stride);
246 h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx*10], 246 h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx*10],
247 h->left_border_v, h->c_stride); 247 h->left_border_v, h->c_stride);
248 248
254 254
255 static void decode_mb_p(AVSContext *h, enum mb_t mb_type) { 255 static void decode_mb_p(AVSContext *h, enum mb_t mb_type) {
256 GetBitContext *gb = &h->s.gb; 256 GetBitContext *gb = &h->s.gb;
257 int ref[4]; 257 int ref[4];
258 258
259 init_mb(h); 259 ff_cavs_init_mb(h);
260 switch(mb_type) { 260 switch(mb_type) {
261 case P_SKIP: 261 case P_SKIP:
262 ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_PSKIP, BLK_16X16, 0); 262 ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_PSKIP, BLK_16X16, 0);
263 break; 263 break;
264 case P_16X16: 264 case P_16X16:
299 static void decode_mb_b(AVSContext *h, enum mb_t mb_type) { 299 static void decode_mb_b(AVSContext *h, enum mb_t mb_type) {
300 int block; 300 int block;
301 enum sub_mb_t sub_type[4]; 301 enum sub_mb_t sub_type[4];
302 int flags; 302 int flags;
303 303
304 init_mb(h); 304 ff_cavs_init_mb(h);
305 305
306 /* reset all MVs */ 306 /* reset all MVs */
307 h->mv[MV_FWD_X0] = ff_cavs_dir_mv; 307 h->mv[MV_FWD_X0] = ff_cavs_dir_mv;
308 set_mvs(&h->mv[MV_FWD_X0], BLK_16X16); 308 set_mvs(&h->mv[MV_FWD_X0], BLK_16X16);
309 h->mv[MV_BWD_X0] = ff_cavs_dir_mv; 309 h->mv[MV_BWD_X0] = ff_cavs_dir_mv;
525 } 525 }
526 check_for_slice(h); 526 check_for_slice(h);
527 if(h->pic_type == FF_I_TYPE) { 527 if(h->pic_type == FF_I_TYPE) {
528 do { 528 do {
529 decode_mb_i(h, 0); 529 decode_mb_i(h, 0);
530 } while(next_mb(h)); 530 } while(ff_cavs_next_mb(h));
531 } else if(h->pic_type == FF_P_TYPE) { 531 } else if(h->pic_type == FF_P_TYPE) {
532 do { 532 do {
533 if(h->skip_mode_flag) { 533 if(h->skip_mode_flag) {
534 skip_count = get_ue_golomb(&s->gb); 534 skip_count = get_ue_golomb(&s->gb);
535 while(skip_count--) { 535 while(skip_count--) {
536 decode_mb_p(h,P_SKIP); 536 decode_mb_p(h,P_SKIP);
537 if(!next_mb(h)) 537 if(!ff_cavs_next_mb(h))
538 goto done; 538 goto done;
539 } 539 }
540 mb_type = get_ue_golomb(&s->gb) + P_16X16; 540 mb_type = get_ue_golomb(&s->gb) + P_16X16;
541 } else 541 } else
542 mb_type = get_ue_golomb(&s->gb) + P_SKIP; 542 mb_type = get_ue_golomb(&s->gb) + P_SKIP;
543 if(mb_type > P_8X8) { 543 if(mb_type > P_8X8) {
544 decode_mb_i(h, mb_type - P_8X8 - 1); 544 decode_mb_i(h, mb_type - P_8X8 - 1);
545 } else 545 } else
546 decode_mb_p(h,mb_type); 546 decode_mb_p(h,mb_type);
547 } while(next_mb(h)); 547 } while(ff_cavs_next_mb(h));
548 } else { /* FF_B_TYPE */ 548 } else { /* FF_B_TYPE */
549 do { 549 do {
550 if(h->skip_mode_flag) { 550 if(h->skip_mode_flag) {
551 skip_count = get_ue_golomb(&s->gb); 551 skip_count = get_ue_golomb(&s->gb);
552 while(skip_count--) { 552 while(skip_count--) {
553 decode_mb_b(h,B_SKIP); 553 decode_mb_b(h,B_SKIP);
554 if(!next_mb(h)) 554 if(!ff_cavs_next_mb(h))
555 goto done; 555 goto done;
556 } 556 }
557 mb_type = get_ue_golomb(&s->gb) + B_DIRECT; 557 mb_type = get_ue_golomb(&s->gb) + B_DIRECT;
558 } else 558 } else
559 mb_type = get_ue_golomb(&s->gb) + B_SKIP; 559 mb_type = get_ue_golomb(&s->gb) + B_SKIP;
560 if(mb_type > B_8X8) { 560 if(mb_type > B_8X8) {
561 decode_mb_i(h, mb_type - B_8X8 - 1); 561 decode_mb_i(h, mb_type - B_8X8 - 1);
562 } else 562 } else
563 decode_mb_b(h,mb_type); 563 decode_mb_b(h,mb_type);
564 } while(next_mb(h)); 564 } while(ff_cavs_next_mb(h));
565 } 565 }
566 done: 566 done:
567 if(h->pic_type != FF_B_TYPE) { 567 if(h->pic_type != FF_B_TYPE) {
568 if(h->DPB[1].data[0]) 568 if(h->DPB[1].data[0])
569 s->avctx->release_buffer(s->avctx, (AVFrame *)&h->DPB[1]); 569 s->avctx->release_buffer(s->avctx, (AVFrame *)&h->DPB[1]);