Revision dc172ecc libavcodec/h264_cavlc.c
libavcodec/h264_cavlc.c  

488  488 
zeros_left= get_vlc2(gb, (total_zeros_vlc1)[ total_coeff ].table, TOTAL_ZEROS_VLC_BITS, 1); 
489  489 
} 
490  490  
491 
scantable += zeros_left + total_coeff  1; 

492 
if(n >= LUMA_DC_BLOCK_INDEX){ 

493 
block[*scantable] = level[0]; 

494 
for(i=1;i<total_coeff && zeros_left > 0;i++) { 

495 
if(zeros_left < 7) 

496 
run_before= get_vlc2(gb, (run_vlc1)[zeros_left].table, RUN_VLC_BITS, 1); 

497 
else 

498 
run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2); 

499 
zeros_left = run_before; 

500 
scantable = 1 + run_before; 

501 
block[*scantable]= level[i]; 

502 
} 

503 
for(;i<total_coeff;i++) { 

504 
scantable; 

505 
block[*scantable]= level[i]; 

506 
} 

507 
}else{ 

508 
block[*scantable] = (level[0] * qmul[*scantable] + 32)>>6; 

509 
for(i=1;i<total_coeff && zeros_left > 0;i++) { 

510 
if(zeros_left < 7) 

511 
run_before= get_vlc2(gb, (run_vlc1)[zeros_left].table, RUN_VLC_BITS, 1); 

512 
else 

513 
run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2); 

514 
zeros_left = run_before; 

515 
scantable = 1 + run_before; 

516 
block[*scantable]= (level[i] * qmul[*scantable] + 32)>>6; 

517 
} 

518 
for(;i<total_coeff;i++) { 

519 
scantable; 

520 
block[*scantable]= (level[i] * qmul[*scantable] + 32)>>6; 

521 
} 

491 
#define STORE_BLOCK(type) \ 

492 
scantable += zeros_left + total_coeff  1; \ 

493 
if(n >= LUMA_DC_BLOCK_INDEX){ \ 

494 
((type*)block)[*scantable] = level[0]; \ 

495 
for(i=1;i<total_coeff && zeros_left > 0;i++) { \ 

496 
if(zeros_left < 7) \ 

497 
run_before= get_vlc2(gb, (run_vlc1)[zeros_left].table, RUN_VLC_BITS, 1); \ 

498 
else \ 

499 
run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2); \ 

500 
zeros_left = run_before; \ 

501 
scantable = 1 + run_before; \ 

502 
((type*)block)[*scantable]= level[i]; \ 

503 
} \ 

504 
for(;i<total_coeff;i++) { \ 

505 
scantable; \ 

506 
((type*)block)[*scantable]= level[i]; \ 

507 
} \ 

508 
}else{ \ 

509 
((type*)block)[*scantable] = ((int)(level[0] * qmul[*scantable] + 32))>>6; \ 

510 
for(i=1;i<total_coeff && zeros_left > 0;i++) { \ 

511 
if(zeros_left < 7) \ 

512 
run_before= get_vlc2(gb, (run_vlc1)[zeros_left].table, RUN_VLC_BITS, 1); \ 

513 
else \ 

514 
run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2); \ 

515 
zeros_left = run_before; \ 

516 
scantable = 1 + run_before; \ 

517 
((type*)block)[*scantable]= ((int)(level[i] * qmul[*scantable] + 32))>>6; \ 

518 
} \ 

519 
for(;i<total_coeff;i++) { \ 

520 
scantable; \ 

521 
((type*)block)[*scantable]= ((int)(level[i] * qmul[*scantable] + 32))>>6; \ 

522 
} \ 

523 
} 

524  
525 
if (h>pixel_size == 2) { 

526 
STORE_BLOCK(int32_t) 

527 
} else { 

528 
STORE_BLOCK(int16_t) 

522  529 
} 
523  530  
524  531 
if(zeros_left<0){ 
...  ...  
605  612 
align_get_bits(&s>gb); 
606  613  
607  614 
// The pixels are stored in the same order as levels in h>mb array. 
608 
for(x=0; x < (CHROMA ? 384 : 256); x++){ 

615 
for(x=0; x < (CHROMA ? 384 : 256)*h>sps.bit_depth_luma/8; x++){


609  616 
((uint8_t*)h>mb)[x]= get_bits(&s>gb, 8); 
610  617 
} 
611  618  
...  ...  
941  948 
if(IS_INTRA16x16(mb_type)){ 
942  949 
AV_ZERO128(h>mb_luma_dc+0); 
943  950 
AV_ZERO128(h>mb_luma_dc+8); 
951 
AV_ZERO128(h>mb_luma_dc+16); 

952 
AV_ZERO128(h>mb_luma_dc+24); 

944  953 
if( decode_residual(h, h>intra_gb_ptr, h>mb_luma_dc, LUMA_DC_BLOCK_INDEX, scan, h>dequant4_coeff[0][s>qscale], 16) < 0){ 
945  954 
return 1; //FIXME continue if partitioned and other return 1 too 
946  955 
} 
...  ...  
951  960 
for(i8x8=0; i8x8<4; i8x8++){ 
952  961 
for(i4x4=0; i4x4<4; i4x4++){ 
953  962 
const int index= i4x4 + 4*i8x8; 
954 
if( decode_residual(h, h>intra_gb_ptr, h>mb + 16*index, index, scan + 1, h>dequant4_coeff[0][s>qscale], 15) < 0 ){ 

963 
if( decode_residual(h, h>intra_gb_ptr, h>mb + 16*index*h>pixel_size, index, scan + 1, h>dequant4_coeff[0][s>qscale], 15) < 0 ){


955  964 
return 1; 
956  965 
} 
957  966 
} 
...  ...  
963  972 
for(i8x8=0; i8x8<4; i8x8++){ 
964  973 
if(cbp & (1<<i8x8)){ 
965  974 
if(IS_8x8DCT(mb_type)){ 
966 
DCTELEM *buf = &h>mb[64*i8x8]; 

975 
DCTELEM *buf = &h>mb[64*i8x8*h>pixel_size];


967  976 
uint8_t *nnz; 
968  977 
for(i4x4=0; i4x4<4; i4x4++){ 
969  978 
if( decode_residual(h, gb, buf, i4x4+4*i8x8, scan8x8+16*i4x4, 
...  ...  
976  985 
for(i4x4=0; i4x4<4; i4x4++){ 
977  986 
const int index= i4x4 + 4*i8x8; 
978  987  
979 
if( decode_residual(h, gb, h>mb + 16*index, index, scan, h>dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s>qscale], 16) <0 ){ 

988 
if( decode_residual(h, gb, h>mb + 16*index*h>pixel_size, index, scan, h>dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s>qscale], 16) <0 ){


980  989 
return 1; 
981  990 
} 
982  991 
} 
...  ...  
990  999  
991  1000 
if(cbp&0x30){ 
992  1001 
for(chroma_idx=0; chroma_idx<2; chroma_idx++) 
993 
if( decode_residual(h, gb, h>mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){


1002 
if( decode_residual(h, gb, h>mb + (256 + 16*4*chroma_idx)*h>pixel_size, CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){


994  1003 
return 1; 
995  1004 
} 
996  1005 
} 
...  ...  
1000  1009 
const uint32_t *qmul = h>dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h>chroma_qp[chroma_idx]]; 
1001  1010 
for(i4x4=0; i4x4<4; i4x4++){ 
1002  1011 
const int index= 16 + 4*chroma_idx + i4x4; 
1003 
if( decode_residual(h, gb, h>mb + 16*index, index, scan + 1, qmul, 15) < 0){ 

1012 
if( decode_residual(h, gb, h>mb + 16*index*h>pixel_size, index, scan + 1, qmul, 15) < 0){


1004  1013 
return 1; 
1005  1014 
} 
1006  1015 
} 
Also available in: Unified diff