aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2005-12-31 13:20:24 +0000
committerLoren Merritt <lorenm@u.washington.edu>2005-12-31 13:20:24 +0000
commitf23af3d8258f0a19ac00991dee6491292d93fd82 (patch)
tree1ba4c28e63e1050b8e34e52d85d489fc0091a327 /libavcodec
parent11d86c979ccc97a738c07d2a997ecd3da5ba102f (diff)
downloadffmpeg-f23af3d8258f0a19ac00991dee6491292d93fd82.tar.gz
CQM: fix fallback to JVT scaling lists
Originally committed as revision 4798 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 49788a1070..8d05229f55 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -7112,18 +7112,19 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
return 0;
}
-static void decode_scaling_list(H264Context *h, uint8_t *factors, int size, const uint8_t *default_list){
+static void decode_scaling_list(H264Context *h, uint8_t *factors, int size,
+ const uint8_t *jvt_list, const uint8_t *fallback_list){
MpegEncContext * const s = &h->s;
int i, last = 8, next = 8;
const uint8_t *scan = size == 16 ? zigzag_scan : zigzag_scan8x8;
- if(!get_bits1(&s->gb)) /* matrix not written, we use the default one */
- memcpy(factors, default_list, size*sizeof(uint8_t));
+ if(!get_bits1(&s->gb)) /* matrix not written, we use the predicted one */
+ memcpy(factors, fallback_list, size*sizeof(uint8_t));
else
for(i=0;i<size;i++){
if(next)
next = (last + get_se_golomb(&s->gb)) & 0xff;
- if(!i && !next){ /* matrix not written, we use the default one */
- memcpy(factors, default_list, size*sizeof(uint8_t));
+ if(!i && !next){ /* matrix not written, we use the preset one */
+ memcpy(factors, jvt_list, size*sizeof(uint8_t));
break;
}
last = factors[scan[i]] = next ? next : last;
@@ -7142,15 +7143,15 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s
};
if(get_bits1(&s->gb)){
sps->scaling_matrix_present |= is_sps;
- decode_scaling_list(h,scaling_matrix4[0],16,fallback[0]); // Intra, Y
- decode_scaling_list(h,scaling_matrix4[1],16,scaling_matrix4[0]); // Intra, Cr
- decode_scaling_list(h,scaling_matrix4[2],16,scaling_matrix4[1]); // Intra, Cb
- decode_scaling_list(h,scaling_matrix4[3],16,fallback[1]); // Inter, Y
- decode_scaling_list(h,scaling_matrix4[4],16,scaling_matrix4[3]); // Inter, Cr
- decode_scaling_list(h,scaling_matrix4[5],16,scaling_matrix4[4]); // Inter, Cb
+ decode_scaling_list(h,scaling_matrix4[0],16,default_scaling4[0],fallback[0]); // Intra, Y
+ decode_scaling_list(h,scaling_matrix4[1],16,default_scaling4[0],scaling_matrix4[0]); // Intra, Cr
+ decode_scaling_list(h,scaling_matrix4[2],16,default_scaling4[0],scaling_matrix4[1]); // Intra, Cb
+ decode_scaling_list(h,scaling_matrix4[3],16,default_scaling4[1],fallback[1]); // Inter, Y
+ decode_scaling_list(h,scaling_matrix4[4],16,default_scaling4[1],scaling_matrix4[3]); // Inter, Cr
+ decode_scaling_list(h,scaling_matrix4[5],16,default_scaling4[1],scaling_matrix4[4]); // Inter, Cb
if(is_sps || pps->transform_8x8_mode){
- decode_scaling_list(h,scaling_matrix8[0],64,fallback[2]); // Intra, Y
- decode_scaling_list(h,scaling_matrix8[1],64,fallback[3]); // Inter, Y
+ decode_scaling_list(h,scaling_matrix8[0],64,default_scaling8[0],fallback[2]); // Intra, Y
+ decode_scaling_list(h,scaling_matrix8[1],64,default_scaling8[1],fallback[3]); // Inter, Y
}
} else if(fallback_sps) {
memcpy(scaling_matrix4, sps->scaling_matrix4, 6*16*sizeof(uint8_t));