mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-05 10:12:20 +00:00
h263parse: fix custom picture format (CPFMT) parsing
In the H263 spec, CPFMT is present only if the use of a custom picture format is signalled in PLUSEPTYPE and UFEP is "001", so we need to check params->format and only if the value is 6 (custom source format) the CPFMT should be read, otherwise it's not present and wrong data will be parsed. When reading the CPFMT, the width and height were not calculated correctly (wrong bitmask). https://bugzilla.gnome.org//show_bug.cgi?id=749253
This commit is contained in:
parent
c519169052
commit
6adf3c2499
1 changed files with 37 additions and 20 deletions
|
@ -271,6 +271,9 @@ gst_h263_parse_get_params (H263Params * params, GstBuffer * buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ufep == 1) {
|
if (ufep == 1) {
|
||||||
|
if (params->format == 6) {
|
||||||
|
/* A fixed length codeword of 23 bits that is present only if the use of
|
||||||
|
* a custom picture format is signalled in PLUSPTYPE and UFEP is 001 */
|
||||||
guint32 cpfmt = 0;
|
guint32 cpfmt = 0;
|
||||||
|
|
||||||
/* 5.1.5 CPFMT : Custom Picture Format (23 bits) */
|
/* 5.1.5 CPFMT : Custom Picture Format (23 bits) */
|
||||||
|
@ -281,8 +284,12 @@ gst_h263_parse_get_params (H263Params * params, GstBuffer * buffer,
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
temp8 = cpfmt >> 19;
|
temp8 = cpfmt >> 19;
|
||||||
params->width = (((cpfmt >> 10) & 0x1f) + 1) * 4;
|
/* Bits 5-13: Picture Width Indication: Range [0, ... , 511];
|
||||||
params->height = ((cpfmt & 0x1f) + 1) * 4;
|
* Number of pixels per line = (PWI + 1) * 4 */
|
||||||
|
params->width = (((cpfmt >> 10) & 0x1ff) + 1) * 4;
|
||||||
|
/* Bits 15-23 Picture Height Indication: Range [1, ... , 288];
|
||||||
|
* Number of lines = PHI * 4 */
|
||||||
|
params->height = (cpfmt & 0x1ff) * 4;
|
||||||
|
|
||||||
if (temp8 == 0xf) {
|
if (temp8 == 0xf) {
|
||||||
guint32 epar = 0;
|
guint32 epar = 0;
|
||||||
|
@ -295,6 +302,16 @@ gst_h263_parse_get_params (H263Params * params, GstBuffer * buffer,
|
||||||
params->parnum = partable[temp8][0];
|
params->parnum = partable[temp8][0];
|
||||||
params->pardenom = partable[temp8][1];
|
params->pardenom = partable[temp8][1];
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* Fill in width/height based on format */
|
||||||
|
params->width = sizetable[params->format][0];
|
||||||
|
params->height = sizetable[params->format][1];
|
||||||
|
GST_DEBUG (" Picture width x height: %d x %d",
|
||||||
|
params->width, params->height);
|
||||||
|
/* Fill in default Pixel aspect ratios */
|
||||||
|
params->parnum = 12;
|
||||||
|
params->pardenom = 11;
|
||||||
|
}
|
||||||
|
|
||||||
if (params->custompcfpresent) {
|
if (params->custompcfpresent) {
|
||||||
/* 5.1.7 CPCFC : Custom Picture Clock Frequency Code (8bits) */
|
/* 5.1.7 CPCFC : Custom Picture Clock Frequency Code (8bits) */
|
||||||
|
|
Loading…
Reference in a new issue