Mercurial > libavcodec.hg
comparison h264.c @ 8596:68e959302527 libavcodec
replace all occurrence of ENABLE_ by the corresponding CONFIG_, HAVE_ or ARCH_
and remove all ENABLE_ definitions.
author | aurel |
---|---|
date | Wed, 14 Jan 2009 17:19:17 +0000 |
parents | 7a463923ecd1 |
children | 2ca51be7dad8 |
comparison
equal
deleted
inserted
replaced
8595:2f476018b4ac | 8596:68e959302527 |
---|---|
1639 qpix_op[luma_xy](dest_y, src_y, h->mb_linesize); //FIXME try variable height perhaps? | 1639 qpix_op[luma_xy](dest_y, src_y, h->mb_linesize); //FIXME try variable height perhaps? |
1640 if(!square){ | 1640 if(!square){ |
1641 qpix_op[luma_xy](dest_y + delta, src_y + delta, h->mb_linesize); | 1641 qpix_op[luma_xy](dest_y + delta, src_y + delta, h->mb_linesize); |
1642 } | 1642 } |
1643 | 1643 |
1644 if(ENABLE_GRAY && s->flags&CODEC_FLAG_GRAY) return; | 1644 if(CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY) return; |
1645 | 1645 |
1646 if(MB_FIELD){ | 1646 if(MB_FIELD){ |
1647 // chroma offset when predicting from a field of opposite parity | 1647 // chroma offset when predicting from a field of opposite parity |
1648 my += 2 * ((s->mb_y & 1) - (pic->reference - 1)); | 1648 my += 2 * ((s->mb_y & 1) - (pic->reference - 1)); |
1649 emu |= (my>>3) < 0 || (my>>3) + 8 >= (pic_height>>1); | 1649 emu |= (my>>3) < 0 || (my>>3) + 8 >= (pic_height>>1); |
2284 offset = MB_MBAFF ? 1 : 17; | 2284 offset = MB_MBAFF ? 1 : 17; |
2285 uvoffset= MB_MBAFF ? 1 : 9; | 2285 uvoffset= MB_MBAFF ? 1 : 9; |
2286 if(!MB_MBAFF){ | 2286 if(!MB_MBAFF){ |
2287 *(uint64_t*)(h->top_borders[0][s->mb_x]+ 0)= *(uint64_t*)(src_y + 15*linesize); | 2287 *(uint64_t*)(h->top_borders[0][s->mb_x]+ 0)= *(uint64_t*)(src_y + 15*linesize); |
2288 *(uint64_t*)(h->top_borders[0][s->mb_x]+ 8)= *(uint64_t*)(src_y +8+15*linesize); | 2288 *(uint64_t*)(h->top_borders[0][s->mb_x]+ 8)= *(uint64_t*)(src_y +8+15*linesize); |
2289 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ | 2289 if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ |
2290 *(uint64_t*)(h->top_borders[0][s->mb_x]+16)= *(uint64_t*)(src_cb+7*uvlinesize); | 2290 *(uint64_t*)(h->top_borders[0][s->mb_x]+16)= *(uint64_t*)(src_cb+7*uvlinesize); |
2291 *(uint64_t*)(h->top_borders[0][s->mb_x]+24)= *(uint64_t*)(src_cr+7*uvlinesize); | 2291 *(uint64_t*)(h->top_borders[0][s->mb_x]+24)= *(uint64_t*)(src_cr+7*uvlinesize); |
2292 } | 2292 } |
2293 } | 2293 } |
2294 }else{ | 2294 }else{ |
2295 if(!MB_MBAFF){ | 2295 if(!MB_MBAFF){ |
2296 h->left_border[0]= h->top_borders[0][s->mb_x][15]; | 2296 h->left_border[0]= h->top_borders[0][s->mb_x][15]; |
2297 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ | 2297 if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ |
2298 h->left_border[34 ]= h->top_borders[0][s->mb_x][16+7 ]; | 2298 h->left_border[34 ]= h->top_borders[0][s->mb_x][16+7 ]; |
2299 h->left_border[34+18]= h->top_borders[0][s->mb_x][16+8+7]; | 2299 h->left_border[34+18]= h->top_borders[0][s->mb_x][16+8+7]; |
2300 } | 2300 } |
2301 skiplast= 1; | 2301 skiplast= 1; |
2302 } | 2302 } |
2315 } | 2315 } |
2316 | 2316 |
2317 *(uint64_t*)(h->top_borders[top_idx][s->mb_x]+0)= *(uint64_t*)(src_y + 16*linesize); | 2317 *(uint64_t*)(h->top_borders[top_idx][s->mb_x]+0)= *(uint64_t*)(src_y + 16*linesize); |
2318 *(uint64_t*)(h->top_borders[top_idx][s->mb_x]+8)= *(uint64_t*)(src_y +8+16*linesize); | 2318 *(uint64_t*)(h->top_borders[top_idx][s->mb_x]+8)= *(uint64_t*)(src_y +8+16*linesize); |
2319 | 2319 |
2320 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ | 2320 if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ |
2321 h->left_border[uvoffset+34 ]= h->top_borders[top_idx][s->mb_x][16+7]; | 2321 h->left_border[uvoffset+34 ]= h->top_borders[top_idx][s->mb_x][16+7]; |
2322 h->left_border[uvoffset+34+18]= h->top_borders[top_idx][s->mb_x][24+7]; | 2322 h->left_border[uvoffset+34+18]= h->top_borders[top_idx][s->mb_x][24+7]; |
2323 for(i=1; i<9 - skiplast; i++){ | 2323 for(i=1; i<9 - skiplast; i++){ |
2324 h->left_border[uvoffset+34 +i*step]= src_cb[7+i*uvlinesize]; | 2324 h->left_border[uvoffset+34 +i*step]= src_cb[7+i*uvlinesize]; |
2325 h->left_border[uvoffset+34+18+i*step]= src_cr[7+i*uvlinesize]; | 2325 h->left_border[uvoffset+34+18+i*step]= src_cr[7+i*uvlinesize]; |
2385 if(s->mb_x+1 < s->mb_width){ | 2385 if(s->mb_x+1 < s->mb_width){ |
2386 XCHG(*(uint64_t*)(h->top_borders[top_idx][s->mb_x+1]), *(uint64_t*)(src_y +17), temp64, 1); | 2386 XCHG(*(uint64_t*)(h->top_borders[top_idx][s->mb_x+1]), *(uint64_t*)(src_y +17), temp64, 1); |
2387 } | 2387 } |
2388 } | 2388 } |
2389 | 2389 |
2390 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ | 2390 if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ |
2391 if(deblock_left){ | 2391 if(deblock_left){ |
2392 for(i = !deblock_top; i<8; i++){ | 2392 for(i = !deblock_top; i<8; i++){ |
2393 XCHG(h->left_border[uvoffset+34 +i*step], src_cb[i*uvlinesize], temp8, xchg); | 2393 XCHG(h->left_border[uvoffset+34 +i*step], src_cb[i*uvlinesize], temp8, xchg); |
2394 XCHG(h->left_border[uvoffset+34+18+i*step], src_cr[i*uvlinesize], temp8, xchg); | 2394 XCHG(h->left_border[uvoffset+34+18+i*step], src_cr[i*uvlinesize], temp8, xchg); |
2395 } | 2395 } |
2413 int linesize, uvlinesize /*dct_offset*/; | 2413 int linesize, uvlinesize /*dct_offset*/; |
2414 int i; | 2414 int i; |
2415 int *block_offset = &h->block_offset[0]; | 2415 int *block_offset = &h->block_offset[0]; |
2416 const int transform_bypass = !simple && (s->qscale == 0 && h->sps.transform_bypass); | 2416 const int transform_bypass = !simple && (s->qscale == 0 && h->sps.transform_bypass); |
2417 /* is_h264 should always be true if SVQ3 is disabled. */ | 2417 /* is_h264 should always be true if SVQ3 is disabled. */ |
2418 const int is_h264 = !ENABLE_SVQ3_DECODER || simple || s->codec_id == CODEC_ID_H264; | 2418 const int is_h264 = !CONFIG_SVQ3_DECODER || simple || s->codec_id == CODEC_ID_H264; |
2419 void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride); | 2419 void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride); |
2420 void (*idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride); | 2420 void (*idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride); |
2421 | 2421 |
2422 dest_y = s->current_picture.data[0] + (mb_x + mb_y * s->linesize ) * 16; | 2422 dest_y = s->current_picture.data[0] + (mb_x + mb_y * s->linesize ) * 16; |
2423 dest_cb = s->current_picture.data[1] + (mb_x + mb_y * s->uvlinesize) * 8; | 2423 dest_cb = s->current_picture.data[1] + (mb_x + mb_y * s->uvlinesize) * 8; |
2469 } else { | 2469 } else { |
2470 if(IS_INTRA(mb_type)){ | 2470 if(IS_INTRA(mb_type)){ |
2471 if(h->deblocking_filter) | 2471 if(h->deblocking_filter) |
2472 xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, simple); | 2472 xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, simple); |
2473 | 2473 |
2474 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ | 2474 if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ |
2475 h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cb, uvlinesize); | 2475 h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cb, uvlinesize); |
2476 h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cr, uvlinesize); | 2476 h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cr, uvlinesize); |
2477 } | 2477 } |
2478 | 2478 |
2479 if(IS_INTRA4x4(mb_type)){ | 2479 if(IS_INTRA4x4(mb_type)){ |
2604 } | 2604 } |
2605 } | 2605 } |
2606 } | 2606 } |
2607 } | 2607 } |
2608 | 2608 |
2609 if((simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)) && (h->cbp&0x30)){ | 2609 if((simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)) && (h->cbp&0x30)){ |
2610 uint8_t *dest[2] = {dest_cb, dest_cr}; | 2610 uint8_t *dest[2] = {dest_cb, dest_cr}; |
2611 if(transform_bypass){ | 2611 if(transform_bypass){ |
2612 if(IS_INTRA(mb_type) && h->sps.profile_idc==244 && (h->chroma_pred_mode==VERT_PRED8x8 || h->chroma_pred_mode==HOR_PRED8x8)){ | 2612 if(IS_INTRA(mb_type) && h->sps.profile_idc==244 && (h->chroma_pred_mode==VERT_PRED8x8 || h->chroma_pred_mode==HOR_PRED8x8)){ |
2613 h->hpc.pred8x8_add[h->chroma_pred_mode](dest[0], block_offset + 16, h->mb + 16*16, uvlinesize); | 2613 h->hpc.pred8x8_add[h->chroma_pred_mode](dest[0], block_offset + 16, h->mb + 16*16, uvlinesize); |
2614 h->hpc.pred8x8_add[h->chroma_pred_mode](dest[1], block_offset + 20, h->mb + 20*16, uvlinesize); | 2614 h->hpc.pred8x8_add[h->chroma_pred_mode](dest[1], block_offset + 20, h->mb + 20*16, uvlinesize); |
2674 | 2674 |
2675 static void hl_decode_mb(H264Context *h){ | 2675 static void hl_decode_mb(H264Context *h){ |
2676 MpegEncContext * const s = &h->s; | 2676 MpegEncContext * const s = &h->s; |
2677 const int mb_xy= h->mb_xy; | 2677 const int mb_xy= h->mb_xy; |
2678 const int mb_type= s->current_picture.mb_type[mb_xy]; | 2678 const int mb_type= s->current_picture.mb_type[mb_xy]; |
2679 int is_complex = ENABLE_SMALL || h->is_complex || IS_INTRA_PCM(mb_type) || s->qscale == 0; | 2679 int is_complex = CONFIG_SMALL || h->is_complex || IS_INTRA_PCM(mb_type) || s->qscale == 0; |
2680 | 2680 |
2681 if(ENABLE_H264_ENCODER && !s->decode) | 2681 if(CONFIG_H264_ENCODER && !s->decode) |
2682 return; | 2682 return; |
2683 | 2683 |
2684 if (is_complex) | 2684 if (is_complex) |
2685 hl_decode_mb_complex(h); | 2685 hl_decode_mb_complex(h); |
2686 else hl_decode_mb_simple(h); | 2686 else hl_decode_mb_simple(h); |
6587 const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F; | 6587 const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F; |
6588 | 6588 |
6589 s->mb_skip_run= -1; | 6589 s->mb_skip_run= -1; |
6590 | 6590 |
6591 h->is_complex = FRAME_MBAFF || s->picture_structure != PICT_FRAME || s->codec_id != CODEC_ID_H264 || | 6591 h->is_complex = FRAME_MBAFF || s->picture_structure != PICT_FRAME || s->codec_id != CODEC_ID_H264 || |
6592 (ENABLE_GRAY && (s->flags&CODEC_FLAG_GRAY)) || (ENABLE_H264_ENCODER && s->encoding); | 6592 (CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY)) || (CONFIG_H264_ENCODER && s->encoding); |
6593 | 6593 |
6594 if( h->pps.cabac ) { | 6594 if( h->pps.cabac ) { |
6595 int i; | 6595 int i; |
6596 | 6596 |
6597 /* realign */ | 6597 /* realign */ |
7421 if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5 | 7421 if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5 |
7422 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) | 7422 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) |
7423 && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE) | 7423 && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE) |
7424 && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE) | 7424 && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE) |
7425 && avctx->skip_frame < AVDISCARD_ALL){ | 7425 && avctx->skip_frame < AVDISCARD_ALL){ |
7426 if(ENABLE_H264_VDPAU_DECODER && avctx->codec_id == CODEC_ID_H264_VDPAU){ | 7426 if(CONFIG_H264_VDPAU_DECODER && avctx->codec_id == CODEC_ID_H264_VDPAU){ |
7427 static const uint8_t start_code[] = {0x00, 0x00, 0x01}; | 7427 static const uint8_t start_code[] = {0x00, 0x00, 0x01}; |
7428 ff_vdpau_add_data_chunk(s, start_code, sizeof(start_code)); | 7428 ff_vdpau_add_data_chunk(s, start_code, sizeof(start_code)); |
7429 ff_vdpau_add_data_chunk(s, &buf[buf_index - consumed], consumed ); | 7429 ff_vdpau_add_data_chunk(s, &buf[buf_index - consumed], consumed ); |
7430 }else | 7430 }else |
7431 context_count++; | 7431 context_count++; |
7622 s->mb_y= 0; | 7622 s->mb_y= 0; |
7623 | 7623 |
7624 s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_H264; | 7624 s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_H264; |
7625 s->current_picture_ptr->pict_type= s->pict_type; | 7625 s->current_picture_ptr->pict_type= s->pict_type; |
7626 | 7626 |
7627 if (ENABLE_H264_VDPAU_DECODER && avctx->codec_id == CODEC_ID_H264_VDPAU) | 7627 if (CONFIG_H264_VDPAU_DECODER && avctx->codec_id == CODEC_ID_H264_VDPAU) |
7628 ff_vdpau_h264_set_reference_frames(s); | 7628 ff_vdpau_h264_set_reference_frames(s); |
7629 | 7629 |
7630 if(!s->dropable) { | 7630 if(!s->dropable) { |
7631 execute_ref_pic_marking(h, h->mmco, h->mmco_index); | 7631 execute_ref_pic_marking(h, h->mmco, h->mmco_index); |
7632 h->prev_poc_msb= h->poc_msb; | 7632 h->prev_poc_msb= h->poc_msb; |
7633 h->prev_poc_lsb= h->poc_lsb; | 7633 h->prev_poc_lsb= h->poc_lsb; |
7634 } | 7634 } |
7635 h->prev_frame_num_offset= h->frame_num_offset; | 7635 h->prev_frame_num_offset= h->frame_num_offset; |
7636 h->prev_frame_num= h->frame_num; | 7636 h->prev_frame_num= h->frame_num; |
7637 | 7637 |
7638 if (ENABLE_H264_VDPAU_DECODER && avctx->codec_id == CODEC_ID_H264_VDPAU) | 7638 if (CONFIG_H264_VDPAU_DECODER && avctx->codec_id == CODEC_ID_H264_VDPAU) |
7639 ff_vdpau_h264_picture_complete(s); | 7639 ff_vdpau_h264_picture_complete(s); |
7640 | 7640 |
7641 /* | 7641 /* |
7642 * FIXME: Error handling code does not seem to support interlaced | 7642 * FIXME: Error handling code does not seem to support interlaced |
7643 * when slices span multiple rows | 7643 * when slices span multiple rows |