* libv4lconvert: fix RGB32 conversion
@ 2014-07-19 7:18 Hans Verkuil
2014-07-19 12:37 ` Hans de Goede
0 siblings, 1 reply; 4+ messages in thread
From: Hans Verkuil @ 2014-07-19 7:18 UTC (permalink / raw)
To: Hans de Goede, Linux Media Mailing List
The RGB32 formats start with an alpha byte in memory. So before calling the
v4lconvert_rgb32_to_rgb24 or v4lconvert_rgb24_to_yuv420 function skip that initial
alpha byte so the src pointer is aligned with the first color component, since
that is what those functions expect.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c
index cea65aa..e4aa54a 100644
--- a/lib/libv4lconvert/libv4lconvert.c
+++ b/lib/libv4lconvert/libv4lconvert.c
@@ -1132,6 +1132,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
errno = EPIPE;
result = -1;
}
+ src++;
switch (dest_pix_fmt) {
case V4L2_PIX_FMT_RGB24:
v4lconvert_rgb32_to_rgb24(src, dest, width, height, 0);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: libv4lconvert: fix RGB32 conversion
2014-07-19 7:18 libv4lconvert: fix RGB32 conversion Hans Verkuil
@ 2014-07-19 12:37 ` Hans de Goede
2014-07-19 13:38 ` Hans Verkuil
0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2014-07-19 12:37 UTC (permalink / raw)
To: Hans Verkuil, Linux Media Mailing List
Hi,
On 07/19/2014 09:18 AM, Hans Verkuil wrote:
> The RGB32 formats start with an alpha byte in memory. So before calling the
> v4lconvert_rgb32_to_rgb24 or v4lconvert_rgb24_to_yuv420 function skip that initial
> alpha byte so the src pointer is aligned with the first color component, since
> that is what those functions expect.
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>
> diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c
> index cea65aa..e4aa54a 100644
> --- a/lib/libv4lconvert/libv4lconvert.c
> +++ b/lib/libv4lconvert/libv4lconvert.c
> @@ -1132,6 +1132,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
> errno = EPIPE;
> result = -1;
> }
> + src++;
Hmm what about bgr versus rgb, since those are mirrored, maybe the location of
the alpha byte is mirrored to, and we should only do the src++ for one of them ?
> switch (dest_pix_fmt) {
> case V4L2_PIX_FMT_RGB24:
> v4lconvert_rgb32_to_rgb24(src, dest, width, height, 0);
>
Regards,
Hans
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libv4lconvert: fix RGB32 conversion
2014-07-19 12:37 ` Hans de Goede
@ 2014-07-19 13:38 ` Hans Verkuil
2014-07-20 14:28 ` Hans de Goede
0 siblings, 1 reply; 4+ messages in thread
From: Hans Verkuil @ 2014-07-19 13:38 UTC (permalink / raw)
To: Hans de Goede, Linux Media Mailing List
On 07/19/2014 02:37 PM, Hans de Goede wrote:
> Hi,
>
> On 07/19/2014 09:18 AM, Hans Verkuil wrote:
>> The RGB32 formats start with an alpha byte in memory. So before calling the
>> v4lconvert_rgb32_to_rgb24 or v4lconvert_rgb24_to_yuv420 function skip that initial
>> alpha byte so the src pointer is aligned with the first color component, since
>> that is what those functions expect.
>>
>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>>
>> diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c
>> index cea65aa..e4aa54a 100644
>> --- a/lib/libv4lconvert/libv4lconvert.c
>> +++ b/lib/libv4lconvert/libv4lconvert.c
>> @@ -1132,6 +1132,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
>> errno = EPIPE;
>> result = -1;
>> }
>> + src++;
>
> Hmm what about bgr versus rgb, since those are mirrored, maybe the location of
> the alpha byte is mirrored to, and we should only do the src++ for one of them ?
Uh, that's what I do. Only for the RGB32 pixformats does the src have to be
increased by one. The BGR32 pixformats have the alpha at the end, so there is
no need to increment src.
Regards,
Hans
>
>> switch (dest_pix_fmt) {
>> case V4L2_PIX_FMT_RGB24:
>> v4lconvert_rgb32_to_rgb24(src, dest, width, height, 0);
>>
>
> Regards,
>
> Hans
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libv4lconvert: fix RGB32 conversion
2014-07-19 13:38 ` Hans Verkuil
@ 2014-07-20 14:28 ` Hans de Goede
0 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2014-07-20 14:28 UTC (permalink / raw)
To: Hans Verkuil, Linux Media Mailing List
Hi,
On 07/19/2014 03:38 PM, Hans Verkuil wrote:
> On 07/19/2014 02:37 PM, Hans de Goede wrote:
>> Hi,
>>
>> On 07/19/2014 09:18 AM, Hans Verkuil wrote:
>>> The RGB32 formats start with an alpha byte in memory. So before calling the
>>> v4lconvert_rgb32_to_rgb24 or v4lconvert_rgb24_to_yuv420 function skip that initial
>>> alpha byte so the src pointer is aligned with the first color component, since
>>> that is what those functions expect.
>>>
>>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>>>
>>> diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c
>>> index cea65aa..e4aa54a 100644
>>> --- a/lib/libv4lconvert/libv4lconvert.c
>>> +++ b/lib/libv4lconvert/libv4lconvert.c
>>> @@ -1132,6 +1132,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
>>> errno = EPIPE;
>>> result = -1;
>>> }
>>> + src++;
>>
>> Hmm what about bgr versus rgb, since those are mirrored, maybe the location of
>> the alpha byte is mirrored to, and we should only do the src++ for one of them ?
>
> Uh, that's what I do. Only for the RGB32 pixformats does the src have to be
> increased by one. The BGR32 pixformats have the alpha at the end, so there is
> no need to increment src.
Duh, I did not look closely enough, so the original patch is:
Acked-by: Hans de Goede <hdegoede@redhat.com>
Feel free to push it.
Regards,
Hans
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-20 14:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-19 7:18 libv4lconvert: fix RGB32 conversion Hans Verkuil
2014-07-19 12:37 ` Hans de Goede
2014-07-19 13:38 ` Hans Verkuil
2014-07-20 14:28 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).