From 4280a61a237ad8ff1d4b7cd3acae7915e4f2eb3e Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 7 Oct 2011 13:59:29 +0200 Subject: [PATCH] codecparsers: vc1: fix MVMODE and MVMODE2 parsing. --- gst-libs/gst/codecparsers/gstvc1parser.c | 39 ++++++++++++------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/gst-libs/gst/codecparsers/gstvc1parser.c b/gst-libs/gst/codecparsers/gstvc1parser.c index 6a77409469..ba40ffd659 100644 --- a/gst-libs/gst/codecparsers/gstvc1parser.c +++ b/gst-libs/gst/codecparsers/gstvc1parser.c @@ -119,32 +119,36 @@ const guint8 vc1_pquant_table[3][32] = { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 31} }; -const guint8 mvmode_table[2][5] = { +static const guint8 vc1_mvmode_table[2][5] = { + /* Table 47: P Picture High rate (PQUANT <= 12) MVMODE code table */ { - GST_VC1_MVMODE_1MV_HPEL_BILINEAR, GST_VC1_MVMODE_1MV, - GST_VC1_MVMODE_1MV_HPEL, GST_VC1_MVMODE_MIXED_MV, - GST_VC1_MVMODE_INTENSITY_COMP}, + GST_VC1_MVMODE_1MV_HPEL, + GST_VC1_MVMODE_INTENSITY_COMP, + GST_VC1_MVMODE_1MV_HPEL_BILINEAR}, + /* Table 46: P Picture Low rate (PQUANT > 12) MVMODE code table */ { + GST_VC1_MVMODE_1MV_HPEL_BILINEAR, GST_VC1_MVMODE_1MV, - GST_VC1_MVMODE_MIXED_MV, GST_VC1_MVMODE_1MV_HPEL, GST_VC1_MVMODE_INTENSITY_COMP, - GST_VC1_MVMODE_1MV_HPEL_BILINEAR} + GST_VC1_MVMODE_MIXED_MV} }; -const guint8 mvmode2_table[2][4] = { +static const guint8 vc1_mvmode2_table[2][4] = { + /* Table 50: P Picture High rate (PQUANT <= 12) MVMODE2 code table */ { - GST_VC1_MVMODE_1MV_HPEL_BILINEAR, GST_VC1_MVMODE_1MV, + GST_VC1_MVMODE_MIXED_MV, GST_VC1_MVMODE_1MV_HPEL, - GST_VC1_MVMODE_MIXED_MV}, + GST_VC1_MVMODE_1MV_HPEL_BILINEAR}, + /* Table 49: P Picture Low rate (PQUANT > 12) MVMODE2 code table */ { + GST_VC1_MVMODE_1MV_HPEL_BILINEAR, GST_VC1_MVMODE_1MV, - GST_VC1_MVMODE_MIXED_MV, GST_VC1_MVMODE_1MV_HPEL, - GST_VC1_MVMODE_1MV_HPEL_BILINEAR} + GST_VC1_MVMODE_MIXED_MV} }; /* Table 40: BFRACTION VLC Table */ @@ -1056,15 +1060,13 @@ parse_frame_header_advanced (GstBitReader * br, GstVC1FrameHdr * framehdr, else pic->mvrange = 0; - mvmodeidx = framehdr->pquant > 12 ? 0 : 1; - pic->mvmode = mvmode_table[mvmodeidx][get_unary (br, 1, 4)]; + mvmodeidx = framehdr->pquant > 12; + pic->mvmode = vc1_mvmode_table[mvmodeidx][get_unary (br, 1, 4)]; if (pic->mvmode == GST_VC1_MVMODE_INTENSITY_COMP) { - - pic->mvmode2 = mvmode2_table[mvmodeidx][get_unary (br, 1, 4)]; + pic->mvmode2 = vc1_mvmode2_table[mvmodeidx][get_unary (br, 1, 3)]; READ_UINT8 (br, pic->lumscale, 6); READ_UINT8 (br, pic->lumshift, 6); - GST_DEBUG ("lumscale %u lumshift %u", pic->lumscale, pic->lumshift); } @@ -1238,11 +1240,10 @@ parse_frame_header (GstBitReader * br, GstVC1FrameHdr * framehdr, case GST_VC1_PICTURE_TYPE_P: mvmodeidx = framehdr->pquant > 12; - - pic->mvmode = mvmode_table[mvmodeidx][get_unary (br, 1, 4)]; + pic->mvmode = vc1_mvmode_table[mvmodeidx][get_unary (br, 1, 4)]; if (pic->mvmode == GST_VC1_MVMODE_INTENSITY_COMP) { - pic->mvmode2 = mvmode2_table[mvmodeidx][get_unary (br, 1, 4)]; + pic->mvmode2 = vc1_mvmode2_table[mvmodeidx][get_unary (br, 1, 3)]; READ_UINT8 (br, pic->lumscale, 6); READ_UINT8 (br, pic->lumshift, 6); GST_DEBUG ("lumscale %u lumshift %u", pic->lumscale, pic->lumshift); -- 2.34.1