Commit d3273657 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

gst-libs/gst/video/video.c: YV12 is I420 with swapped components 1 and 2, so...

gst-libs/gst/video/video.c: YV12 is I420 with swapped components 1 and 2, so the offset of component 1 for I420 shoul...

Original commit message from CVS:
* gst-libs/gst/video/video.c: (gst_video_format_get_component_offset):
YV12 is I420 with swapped components 1 and 2, so the offset of
component 1 for I420 should be the offset for component 2 for YV12
and vice versa.
parent fac95d0e
2008-03-02 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/video/video.c: (gst_video_format_get_component_offset):
YV12 is I420 with swapped components 1 and 2, so the offset of
component 1 for I420 should be the offset for component 2 for YV12
and vice versa.
2008-02-29 Rene Stadler <mail@renestadler.de>
 
* sys/v4l/gstv4lelement.c:
......@@ -904,19 +904,27 @@ gst_video_format_get_component_offset (GstVideoFormat format, int component,
{
switch (format) {
case GST_VIDEO_FORMAT_I420:
case GST_VIDEO_FORMAT_YV12:
if (component == 0) {
if (component == 0)
return 0;
} else {
int offset;
offset = GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
if (component == 2) {
offset += GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
(GST_ROUND_UP_2 (height) / 2);
}
return offset;
if (component == 1)
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
if (component == 2) {
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) +
GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
(GST_ROUND_UP_2 (height) / 2);
}
return 0;
case GST_VIDEO_FORMAT_YV12: /* same as I420, but components 1+2 swapped */
if (component == 0)
return 0;
if (component == 2)
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
if (component == 1) {
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) +
GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
(GST_ROUND_UP_2 (height) / 2);
}
return 0;
case GST_VIDEO_FORMAT_YUY2:
if (component == 0)
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment