mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-13 03:24:14 +00:00
codecparsers: VC1: compute MB height and width
Add them to GstVC1SequenceHdr
This commit is contained in:
parent
6137d841a0
commit
2b5e7c1f0f
3 changed files with 25 additions and 11 deletions
|
@ -649,6 +649,8 @@ parse_sequence_header_advanced (GstVC1SeqHdr * seqhdr, GstBitReader * br)
|
|||
gst_bit_reader_get_bits_uint16_unchecked (br, 12);
|
||||
advanced->max_coded_width = (advanced->max_coded_width + 1) << 1;
|
||||
advanced->max_coded_height = (advanced->max_coded_height + 1) << 1;
|
||||
seqhdr->mb_height = (advanced->max_coded_height + 15) >> 4;
|
||||
seqhdr->mb_width = (advanced->max_coded_width + 15) >> 4;
|
||||
advanced->pulldown = gst_bit_reader_get_bits_uint8_unchecked (br, 1);
|
||||
advanced->interlace = gst_bit_reader_get_bits_uint8_unchecked (br, 1);
|
||||
advanced->tfcntrflag = gst_bit_reader_get_bits_uint8_unchecked (br, 1);
|
||||
|
@ -724,8 +726,8 @@ parse_frame_header_advanced (GstBitReader * br, GstVC1FrameHdr * framehdr,
|
|||
GstVC1PicAdvanced *pic = &framehdr->pic.advanced;
|
||||
GstVC1EntryPointHdr *entrypthdr = &advhdr->entrypoint;
|
||||
guint8 mvmodeidx;
|
||||
guint width = (entrypthdr->coded_width + 15) >> 4;
|
||||
guint height = (entrypthdr->coded_height + 15) >> 4;
|
||||
guint width = seqhdr->mb_width;
|
||||
guint height = seqhdr->mb_height;
|
||||
|
||||
GST_DEBUG ("Parsing Frame header advanced %u", advhdr->interlace);
|
||||
|
||||
|
@ -982,8 +984,8 @@ parse_frame_header (GstBitReader * br, GstVC1FrameHdr * framehdr,
|
|||
guint8 mvmodeidx;
|
||||
GstVC1PicSimpleMain *pic = &framehdr->pic.simple;
|
||||
GstVC1SimpleMainSeqHdr *simplehdr = &seqhdr->profile.simplemain;
|
||||
guint width = (simplehdr->coded_width + 15) >> 4;
|
||||
guint height = (simplehdr->coded_height + 15) >> 4;
|
||||
guint width = seqhdr->mb_width;
|
||||
guint height = seqhdr->mb_height;
|
||||
|
||||
|
||||
GST_DEBUG ("Parsing frame header in simple or main mode");
|
||||
|
@ -1204,7 +1206,8 @@ gst_vc1_identify_next_bdu (const guint8 * data, gsize size, GstVC1BDU * bdu)
|
|||
ensure_debug_category ();
|
||||
|
||||
if (size < 4) {
|
||||
GST_DEBUG ("Can't parse, buffer has too small size %" G_GSSIZE_FORMAT, size);
|
||||
GST_DEBUG ("Can't parse, buffer has too small size %" G_GSSIZE_FORMAT,
|
||||
size);
|
||||
return GST_VC1_PARSER_ERROR;
|
||||
}
|
||||
|
||||
|
@ -1339,6 +1342,10 @@ gst_vc1_parse_sequence_header (const guint8 * data, gsize size,
|
|||
simplehdr->slice_code);
|
||||
}
|
||||
|
||||
/* compute height and width */
|
||||
seqhdr->mb_height = (simplehdr->coded_height + 15) >> 4;
|
||||
seqhdr->mb_width = (simplehdr->coded_width + 15) >> 4;
|
||||
|
||||
return GST_VC1_PARSER_OK;
|
||||
|
||||
failed:
|
||||
|
@ -1399,6 +1406,8 @@ gst_vc1_parse_entry_point_header (const guint8 * data, gsize size,
|
|||
READ_UINT16 (&br, entrypoint->coded_height, 12);
|
||||
entrypoint->coded_height = (entrypoint->coded_height + 1) << 1;
|
||||
entrypoint->coded_width = (entrypoint->coded_width + 1) << 1;
|
||||
seqhdr->mb_height = (entrypoint->coded_height + 15) >> 4;
|
||||
seqhdr->mb_width = (entrypoint->coded_width + 15) >> 4;
|
||||
}
|
||||
|
||||
if (entrypoint->extended_mv)
|
||||
|
|
|
@ -268,6 +268,8 @@ struct _GstVC1SeqHdr
|
|||
/* calculated */
|
||||
guint framerate; /* Around in fps, 0 if unknown*/
|
||||
guint bitrate; /* Around in kpbs, 0 if unknown*/
|
||||
guint mb_height;
|
||||
guint mb_width;
|
||||
|
||||
union {
|
||||
GstVC1AdvancedSeqHdr advanced;
|
||||
|
|
|
@ -825,14 +825,14 @@ GST_START_TEST (test_vc1_parse_p_frame_header_main)
|
|||
GstVC1SimpleMainSeqHdr *simplehdr = &seqhdr.profile.simplemain;
|
||||
GstVC1PicSimpleMain *pic = &framehdr.pic.simple;
|
||||
|
||||
simplehdr->coded_height = 240;
|
||||
simplehdr->coded_width = 320;
|
||||
|
||||
assert_equals_int (gst_vc1_parse_sequence_header (pframe_header_main,
|
||||
sizeof (pframe_header_main), &seqhdr), GST_VC1_PARSER_OK);
|
||||
|
||||
assert_equals_int (seqhdr.profiletype, GST_VC1_PROFILE_MAIN);
|
||||
|
||||
simplehdr->coded_height = 240;
|
||||
simplehdr->coded_width = 320;
|
||||
|
||||
assert_equals_int (seqhdr.frmrtq_postproc, 7);
|
||||
assert_equals_int (seqhdr.bitrtq_postproc, 2);
|
||||
assert_equals_int (simplehdr->loop_filter, 1);
|
||||
|
@ -869,13 +869,15 @@ GST_START_TEST (test_vc1_parse_b_frame_header_main)
|
|||
GstVC1SimpleMainSeqHdr *simplehdr = &seqhdr.profile.simplemain;
|
||||
GstVC1PicSimpleMain *pic = &framehdr.pic.simple;
|
||||
|
||||
simplehdr->coded_height = 240;
|
||||
simplehdr->coded_width = 320;
|
||||
|
||||
assert_equals_int (gst_vc1_parse_sequence_header (bframe_header_main,
|
||||
sizeof (bframe_header_main), &seqhdr), GST_VC1_PARSER_OK);
|
||||
|
||||
assert_equals_int (seqhdr.profiletype, GST_VC1_PROFILE_MAIN);
|
||||
|
||||
simplehdr->coded_height = 240;
|
||||
simplehdr->coded_width = 320;
|
||||
assert_equals_int (seqhdr.mb_height, 15);
|
||||
assert_equals_int (seqhdr.mb_width, 20);
|
||||
|
||||
assert_equals_int (seqhdr.frmrtq_postproc, 7);
|
||||
assert_equals_int (seqhdr.bitrtq_postproc, 3);
|
||||
|
@ -915,6 +917,7 @@ GST_START_TEST (test_vc1_parse_bi_frame_header_main)
|
|||
|
||||
GstVC1SimpleMainSeqHdr *simplehdr = &seqhdr.profile.simplemain;
|
||||
GstVC1PicSimpleMain *pic = &framehdr.pic.simple;
|
||||
|
||||
simplehdr->coded_height = 240;
|
||||
simplehdr->coded_width = 320;
|
||||
|
||||
|
|
Loading…
Reference in a new issue