comparison h264.h @ 10863:974ac220c93a libavcodec

Move check_intra4x4_pred_mode() back from h264.h to h264.c, the function is just called once per MB in worst case and doesnt seem to benefit from static inline. Actually the code might be a hair faster now (0.1% according to my benchmark but this could be random noise)
author michael
date Tue, 12 Jan 2010 21:17:26 +0000
parents d9c084a0c22b
children e3f5eb016712
comparison
equal deleted inserted replaced
10862:d9c084a0c22b 10863:974ac220c93a
628 628
629 629
630 /** 630 /**
631 * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks. 631 * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
632 */ 632 */
633 int ff_h264_check_intra4x4_pred_mode(H264Context *h);
634
635 /**
636 * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
637 */
633 int ff_h264_check_intra_pred_mode(H264Context *h, int mode); 638 int ff_h264_check_intra_pred_mode(H264Context *h, int mode);
634 639
635 void ff_h264_write_back_intra_pred_mode(H264Context *h); 640 void ff_h264_write_back_intra_pred_mode(H264Context *h);
636 void ff_h264_hl_decode_mb(H264Context *h); 641 void ff_h264_hl_decode_mb(H264Context *h);
637 int ff_h264_frame_start(H264Context *h); 642 int ff_h264_frame_start(H264Context *h);
679 return (b&0xFFFF) + (a<<16); 684 return (b&0xFFFF) + (a<<16);
680 #else 685 #else
681 return (a&0xFFFF) + (b<<16); 686 return (a&0xFFFF) + (b<<16);
682 #endif 687 #endif
683 } 688 }
684
685 /**
686 * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
687 */
688 static inline int check_intra4x4_pred_mode(H264Context *h){
689 MpegEncContext * const s = &h->s;
690 static const int8_t top [12]= {-1, 0,LEFT_DC_PRED,-1,-1,-1,-1,-1, 0};
691 static const int8_t left[12]= { 0,-1, TOP_DC_PRED, 0,-1,-1,-1, 0,-1,DC_128_PRED};
692 int i;
693
694 if(!(h->top_samples_available&0x8000)){
695 for(i=0; i<4; i++){
696 int status= top[ h->intra4x4_pred_mode_cache[scan8[0] + i] ];
697 if(status<0){
698 av_log(h->s.avctx, AV_LOG_ERROR, "top block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y);
699 return -1;
700 } else if(status){
701 h->intra4x4_pred_mode_cache[scan8[0] + i]= status;
702 }
703 }
704 }
705
706 if((h->left_samples_available&0x8888)!=0x8888){
707 static const int mask[4]={0x8000,0x2000,0x80,0x20};
708 for(i=0; i<4; i++){
709 if(!(h->left_samples_available&mask[i])){
710 int status= left[ h->intra4x4_pred_mode_cache[scan8[0] + 8*i] ];
711 if(status<0){
712 av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y);
713 return -1;
714 } else if(status){
715 h->intra4x4_pred_mode_cache[scan8[0] + 8*i]= status;
716 }
717 }
718 }
719 }
720
721 return 0;
722 } //FIXME cleanup like ff_h264_check_intra_pred_mode
723 689
724 /** 690 /**
725 * gets the chroma qp. 691 * gets the chroma qp.
726 */ 692 */
727 static inline int get_chroma_qp(H264Context *h, int t, int qscale){ 693 static inline int get_chroma_qp(H264Context *h, int t, int qscale){