diff options
author | cehoyos <cehoyos@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-08-11 18:44:43 +0000 |
---|---|---|
committer | cehoyos <cehoyos@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-08-11 18:44:43 +0000 |
commit | 6a3c6ad075e1d937b213df3bec94f2c9ee7019a3 (patch) | |
tree | 3343a4dbcf67f76763296f117808245b16be4d0f /libmpdemux/mpeg_hdr.c | |
parent | bb6c23de0c3d2a76325f365efe25128482d004b0 (diff) | |
download | mpv-6a3c6ad075e1d937b213df3bec94f2c9ee7019a3.tar.bz2 mpv-6a3c6ad075e1d937b213df3bec94f2c9ee7019a3.tar.xz |
Fix H.264 SPS parsing in case of scaling list present.
Patch by Marco Munderloh, munderl A tnt D uni-hannover D de
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29494 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/mpeg_hdr.c')
-rw-r--r-- | libmpdemux/mpeg_hdr.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libmpdemux/mpeg_hdr.c b/libmpdemux/mpeg_hdr.c index bb1e416875..c07cd6bf16 100644 --- a/libmpdemux/mpeg_hdr.c +++ b/libmpdemux/mpeg_hdr.c @@ -303,6 +303,11 @@ static unsigned int read_golomb(unsigned char *buffer, unsigned int *init) return v2; } +inline static int read_golomb_s(unsigned char *buffer, unsigned int *init) +{ + unsigned int v = read_golomb(buffer, init); + return (v & 1) ? ((v + 1) >> 1) : -(v >> 1); +} static int h264_parse_vui(mp_mpeg_header_t * picture, unsigned char * buf, unsigned int n) { @@ -361,7 +366,7 @@ static int mp_unescape03(unsigned char *buf, int len); int h264_parse_sps(mp_mpeg_header_t * picture, unsigned char * buf, int len) { - unsigned int n = 0, v, i, mbh; + unsigned int n = 0, v, i, k, mbh; int frame_mbs_only; len = mp_unescape03(buf, len); @@ -376,7 +381,15 @@ int h264_parse_sps(mp_mpeg_header_t * picture, unsigned char * buf, int len) read_golomb(buf, &n); n++; if(getbits(buf, n++, 1)){ - //FIXME scaling matrix + for(i = 0; i < 8; i++) + { // scaling list is skipped for now + if(getbits(buf, n++, 1)) + { + v = 8; + for(k = (i < 6 ? 16 : 64); k && v; k--) + v = (v + read_golomb_s(buf, &n)) & 255; + } + } } } read_golomb(buf, &n); |