Ticket #113: ffmpegcbplumaspeed.diff
File ffmpegcbplumaspeed.diff, 1.9 KB (added by astrange, 8 years ago) 


libavcodec/h264.c
5761 5761 return 3; 5762 5762 } 5763 5763 5764 static const uint8_t block_idx_x[16] = {5765 0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, 35766 };5767 static const uint8_t block_idx_y[16] = {5768 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 35769 };5770 static const uint8_t block_idx_xy[4][4] = {5771 { 0, 2, 8, 10},5772 { 1, 3, 9, 11},5773 { 4, 6, 12, 14},5774 { 5, 7, 13, 15}5775 };5776 5777 5764 static int decode_cabac_mb_cbp_luma( H264Context *h) { 5778 5765 int cbp = 0; 5779 5766 int cbp_b = 1; … … 5789 5776 int x, y; 5790 5777 int ctx = 0; 5791 5778 5792 x = block_idx_x[4*i8x8];5793 y = block_idx_y[4*i8x8];5779 x = (i8x8 & 1) * 2; 5780 y = i8x8 & 2; 5794 5781 5795 5782 if( x > 0 ) 5796 5783 cbp_a = cbp; … … 5802 5789 if( y > 0 ) 5803 5790 cbp_b = cbp; 5804 5791 5792 #define block_idx_xy(r, c) ((((r) & 2) >> 1) + ((c) & 2)) 5793 #define lsb_is_zero(x) (((x) & 1) ^ 1) 5794 5805 5795 /* No need to test for skip as we put 0 for skip block */ 5806 5796 /* No need to test for IPCM as we put 1 for IPCM block */ 5807 5797 if( cbp_a >= 0 ) { 5808 int i8x8a = block_idx_xy [(x1)&0x03][y]/4;5809 if( ((cbp_a >> i8x8a)&0x01) == 0 ) 5810 ctx++;5798 int i8x8a = block_idx_xy(x1, y); 5799 5800 ctx = lsb_is_zero(cbp_a >> i8x8a); 5811 5801 } 5812 5802 5813 5803 if( cbp_b >= 0 ) { 5814 int i8x8b = block_idx_xy [x][(y1)&0x03]/4;5815 if( ((cbp_b >> i8x8b)&0x01) == 0 ) 5816 ctx +=2;5804 int i8x8b = block_idx_xy(x, y1); 5805 5806 ctx += lsb_is_zero(cbp_b >> i8x8b) * 2; 5817 5807 } 5818 5808 5809 #undef block_idx_xy 5810 #undef lsb_is_zero 5811 5819 5812 if( get_cabac( &h>cabac, &h>cabac_state[73 + ctx] ) ) { 5820 5813 cbp = 1 << i8x8; 5821 5814 }