|
|
|
@ -3459,52 +3459,6 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
for(;s->mb_y < s->mb_height; s->mb_y++){ |
|
|
|
|
for(;s->mb_x < s->mb_width; s->mb_x++){ |
|
|
|
|
int ret= decode_mb(h); |
|
|
|
|
|
|
|
|
|
ff_h264_hl_decode_mb(h); |
|
|
|
|
|
|
|
|
|
if(ret<0){ |
|
|
|
|
av_log(s->avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); |
|
|
|
|
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask); |
|
|
|
|
|
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(++s->mb_x >= s->mb_width){ |
|
|
|
|
s->mb_x=0; |
|
|
|
|
if(++s->mb_y >= s->mb_height){ |
|
|
|
|
if(get_bits_count(s->gb) == s->gb.size_in_bits){ |
|
|
|
|
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask); |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
}else{ |
|
|
|
|
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask); |
|
|
|
|
|
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(get_bits_count(s->?gb) >= s->gb?.size_in_bits){ |
|
|
|
|
if(get_bits_count(s->gb) == s->gb.size_in_bits){ |
|
|
|
|
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask); |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
}else{ |
|
|
|
|
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask); |
|
|
|
|
|
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
s->mb_x=0; |
|
|
|
|
ff_draw_horiz_band(s, 16*s->mb_y, 16); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -3971,109 +3925,6 @@ int main(void){ |
|
|
|
|
STOP_TIMER("get_se_golomb"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
printf("testing 4x4 (I)DCT\n"); |
|
|
|
|
|
|
|
|
|
DCTELEM block[16]; |
|
|
|
|
uint8_t src[16], ref[16]; |
|
|
|
|
uint64_t error= 0, max_error=0; |
|
|
|
|
|
|
|
|
|
for(i=0; i<COUNT; i++){ |
|
|
|
|
int j; |
|
|
|
|
// printf("%d %d %d\n", r1, r2, (r2-r1)*16);
|
|
|
|
|
for(j=0; j<16; j++){ |
|
|
|
|
ref[j]= random()%255; |
|
|
|
|
src[j]= random()%255; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
h264_diff_dct_c(block, src, ref, 4); |
|
|
|
|
|
|
|
|
|
//normalize
|
|
|
|
|
for(j=0; j<16; j++){ |
|
|
|
|
// printf("%d ", block[j]);
|
|
|
|
|
block[j]= block[j]*4; |
|
|
|
|
if(j&1) block[j]= (block[j]*4 + 2)/5; |
|
|
|
|
if(j&4) block[j]= (block[j]*4 + 2)/5; |
|
|
|
|
} |
|
|
|
|
// printf("\n");
|
|
|
|
|
|
|
|
|
|
h->h264dsp.h264_idct_add(ref, block, 4); |
|
|
|
|
/* for(j=0; j<16; j++){
|
|
|
|
|
printf("%d ", ref[j]); |
|
|
|
|
} |
|
|
|
|
printf("\n");*/ |
|
|
|
|
|
|
|
|
|
for(j=0; j<16; j++){ |
|
|
|
|
int diff= FFABS(src[j] - ref[j]); |
|
|
|
|
|
|
|
|
|
error+= diff*diff; |
|
|
|
|
max_error= FFMAX(max_error, diff); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
printf("error=%f max_error=%d\n", ((float)error)/COUNT/16, (int)max_error ); |
|
|
|
|
printf("testing quantizer\n"); |
|
|
|
|
for(qp=0; qp<52; qp++){ |
|
|
|
|
for(i=0; i<16; i++) |
|
|
|
|
src1_block[i]= src2_block[i]= random()%255; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
printf("Testing NAL layer\n"); |
|
|
|
|
|
|
|
|
|
uint8_t bitstream[COUNT]; |
|
|
|
|
uint8_t nal[COUNT*2]; |
|
|
|
|
H264Context h; |
|
|
|
|
memset(&h, 0, sizeof(H264Context)); |
|
|
|
|
|
|
|
|
|
for(i=0; i<COUNT; i++){ |
|
|
|
|
int zeros= i; |
|
|
|
|
int nal_length; |
|
|
|
|
int consumed; |
|
|
|
|
int out_length; |
|
|
|
|
uint8_t *out; |
|
|
|
|
int j; |
|
|
|
|
|
|
|
|
|
for(j=0; j<COUNT; j++){ |
|
|
|
|
bitstream[j]= (random() % 255) + 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for(j=0; j<zeros; j++){ |
|
|
|
|
int pos= random() % COUNT; |
|
|
|
|
while(bitstream[pos] == 0){ |
|
|
|
|
pos++; |
|
|
|
|
pos %= COUNT; |
|
|
|
|
} |
|
|
|
|
bitstream[pos]=0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
START_TIMER |
|
|
|
|
|
|
|
|
|
nal_length= encode_nal(&h, nal, bitstream, COUNT, COUNT*2); |
|
|
|
|
if(nal_length<0){ |
|
|
|
|
printf("encoding failed\n"); |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
out= ff_h264_decode_nal(&h, nal, &out_length, &consumed, nal_length); |
|
|
|
|
|
|
|
|
|
STOP_TIMER("NAL") |
|
|
|
|
|
|
|
|
|
if(out_length != COUNT){ |
|
|
|
|
printf("incorrect length %d %d\n", out_length, COUNT); |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(consumed != nal_length){ |
|
|
|
|
printf("incorrect consumed length %d %d\n", nal_length, consumed); |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(memcmp(bitstream, out, COUNT)){ |
|
|
|
|
printf("mismatch\n"); |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
printf("Testing RBSP\n"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|