|
|
@ -370,6 +370,7 @@ static inline int svq3_mc_dir (H264Context *h, int size, int mode, int dir, int |
|
|
|
dx = svq3_get_se_golomb (&s->gb); |
|
|
|
dx = svq3_get_se_golomb (&s->gb); |
|
|
|
|
|
|
|
|
|
|
|
if (dx == INVALID_VLC || dy == INVALID_VLC) { |
|
|
|
if (dx == INVALID_VLC || dy == INVALID_VLC) { |
|
|
|
|
|
|
|
av_log(h->s.avctx, AV_LOG_ERROR, "invalid MV vlc\n"); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -564,8 +565,10 @@ static int svq3_decode_mb (H264Context *h, unsigned int mb_type) { |
|
|
|
for (i=0; i < 16; i+=2) { |
|
|
|
for (i=0; i < 16; i+=2) { |
|
|
|
vlc = svq3_get_ue_golomb (&s->gb); |
|
|
|
vlc = svq3_get_ue_golomb (&s->gb); |
|
|
|
|
|
|
|
|
|
|
|
if (vlc >= 25) |
|
|
|
if (vlc >= 25){ |
|
|
|
|
|
|
|
av_log(h->s.avctx, AV_LOG_ERROR, "luma prediction:%d\n", vlc); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
left = &h->intra4x4_pred_mode_cache[scan8[i] - 1]; |
|
|
|
left = &h->intra4x4_pred_mode_cache[scan8[i] - 1]; |
|
|
|
top = &h->intra4x4_pred_mode_cache[scan8[i] - 8]; |
|
|
|
top = &h->intra4x4_pred_mode_cache[scan8[i] - 8]; |
|
|
@ -573,8 +576,10 @@ static int svq3_decode_mb (H264Context *h, unsigned int mb_type) { |
|
|
|
left[1] = svq3_pred_1[top[0] + 1][left[0] + 1][svq3_pred_0[vlc][0]]; |
|
|
|
left[1] = svq3_pred_1[top[0] + 1][left[0] + 1][svq3_pred_0[vlc][0]]; |
|
|
|
left[2] = svq3_pred_1[top[1] + 1][left[1] + 1][svq3_pred_0[vlc][1]]; |
|
|
|
left[2] = svq3_pred_1[top[1] + 1][left[1] + 1][svq3_pred_0[vlc][1]]; |
|
|
|
|
|
|
|
|
|
|
|
if (left[1] == -1 || left[2] == -1) |
|
|
|
if (left[1] == -1 || left[2] == -1){ |
|
|
|
|
|
|
|
av_log(h->s.avctx, AV_LOG_ERROR, "weird prediction\n"); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { /* mb_type == 33, DC_128_PRED block type */ |
|
|
|
} else { /* mb_type == 33, DC_128_PRED block type */ |
|
|
|
for (i=0; i < 4; i++) { |
|
|
|
for (i=0; i < 4; i++) { |
|
|
@ -603,8 +608,10 @@ static int svq3_decode_mb (H264Context *h, unsigned int mb_type) { |
|
|
|
dir = i_mb_type_info[mb_type - 8].pred_mode; |
|
|
|
dir = i_mb_type_info[mb_type - 8].pred_mode; |
|
|
|
dir = (dir >> 1) ^ 3*(dir & 1) ^ 1; |
|
|
|
dir = (dir >> 1) ^ 3*(dir & 1) ^ 1; |
|
|
|
|
|
|
|
|
|
|
|
if ((h->intra16x16_pred_mode = check_intra_pred_mode (h, dir)) == -1) |
|
|
|
if ((h->intra16x16_pred_mode = check_intra_pred_mode (h, dir)) == -1){ |
|
|
|
|
|
|
|
av_log(h->s.avctx, AV_LOG_ERROR, "check_intra_pred_mode = -1\n"); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cbp = i_mb_type_info[mb_type - 8].cbp; |
|
|
|
cbp = i_mb_type_info[mb_type - 8].cbp; |
|
|
|
mb_type = MB_TYPE_INTRA16x16; |
|
|
|
mb_type = MB_TYPE_INTRA16x16; |
|
|
@ -629,20 +636,26 @@ static int svq3_decode_mb (H264Context *h, unsigned int mb_type) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == B_TYPE)) { |
|
|
|
if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == B_TYPE)) { |
|
|
|
if ((vlc = svq3_get_ue_golomb (&s->gb)) >= 48) |
|
|
|
if ((vlc = svq3_get_ue_golomb (&s->gb)) >= 48){ |
|
|
|
|
|
|
|
av_log(h->s.avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cbp = IS_INTRA(mb_type) ? golomb_to_intra4x4_cbp[vlc] : golomb_to_inter_cbp[vlc]; |
|
|
|
cbp = IS_INTRA(mb_type) ? golomb_to_intra4x4_cbp[vlc] : golomb_to_inter_cbp[vlc]; |
|
|
|
} |
|
|
|
} |
|
|
|
if (IS_INTRA16x16(mb_type) || (s->pict_type != I_TYPE && s->adaptive_quant && cbp)) { |
|
|
|
if (IS_INTRA16x16(mb_type) || (s->pict_type != I_TYPE && s->adaptive_quant && cbp)) { |
|
|
|
s->qscale += svq3_get_se_golomb (&s->gb); |
|
|
|
s->qscale += svq3_get_se_golomb (&s->gb); |
|
|
|
|
|
|
|
|
|
|
|
if (s->qscale > 31) |
|
|
|
if (s->qscale > 31){ |
|
|
|
|
|
|
|
av_log(h->s.avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (IS_INTRA16x16(mb_type)) { |
|
|
|
if (IS_INTRA16x16(mb_type)) { |
|
|
|
if (svq3_decode_block (&s->gb, h->mb, 0, 0)) |
|
|
|
if (svq3_decode_block (&s->gb, h->mb, 0, 0)){ |
|
|
|
|
|
|
|
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding intra luma dc\n"); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (cbp) { |
|
|
|
if (cbp) { |
|
|
@ -655,24 +668,30 @@ static int svq3_decode_mb (H264Context *h, unsigned int mb_type) { |
|
|
|
k = index ? ((j&1) + 2*(i&1) + 2*(j&2) + 4*(i&2)) : (4*i + j); |
|
|
|
k = index ? ((j&1) + 2*(i&1) + 2*(j&2) + 4*(i&2)) : (4*i + j); |
|
|
|
h->non_zero_count_cache[ scan8[k] ] = 1; |
|
|
|
h->non_zero_count_cache[ scan8[k] ] = 1; |
|
|
|
|
|
|
|
|
|
|
|
if (svq3_decode_block (&s->gb, &h->mb[16*k], index, type)) |
|
|
|
if (svq3_decode_block (&s->gb, &h->mb[16*k], index, type)){ |
|
|
|
|
|
|
|
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding block\n"); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((cbp & 0x30)) { |
|
|
|
if ((cbp & 0x30)) { |
|
|
|
for (i=0; i < 2; ++i) { |
|
|
|
for (i=0; i < 2; ++i) { |
|
|
|
if (svq3_decode_block (&s->gb, &h->mb[16*(16 + 4*i)], 0, 3)) |
|
|
|
if (svq3_decode_block (&s->gb, &h->mb[16*(16 + 4*i)], 0, 3)){ |
|
|
|
|
|
|
|
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n"); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((cbp & 0x20)) { |
|
|
|
if ((cbp & 0x20)) { |
|
|
|
for (i=0; i < 8; i++) { |
|
|
|
for (i=0; i < 8; i++) { |
|
|
|
h->non_zero_count_cache[ scan8[16+i] ] = 1; |
|
|
|
h->non_zero_count_cache[ scan8[16+i] ] = 1; |
|
|
|
|
|
|
|
|
|
|
|
if (svq3_decode_block (&s->gb, &h->mb[16*(16 + i)], 1, 1)) |
|
|
|
if (svq3_decode_block (&s->gb, &h->mb[16*(16 + i)], 1, 1)){ |
|
|
|
|
|
|
|
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma ac block\n"); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|