YUY2->RGB MMX, YUY2 MMX scaling, YUY2 brightness, contrast, saturation.

YUY2->RGB MMX, YUY2 MMX scaling, YUY2 brightness, contrast, saturation.

Post by » Wed, 17 Dec 2003 09:10:22


I'm looking for the following procedures:

- fast MMX asm conversion YUY2->RGB,
- fast MMX asm scalling of YUY2 frames,
- changing level of brightness, contrast, saturation of YUY2 image.
( reasonable speed in C++, I would like to avoid YUY2->RGB->YUY2
onversion ).

Quality and memory usage doesn't really matter, I'd even prefer to reduce
depth to 16bits and conversion to RGB through 65535-element lookup table.
( this one should be fastest method I think ). Scale ratio also doesn't
change. Could you give me some links or samples ?

Thanks in advance,
Kamil
 
 
 

YUY2->RGB MMX, YUY2 MMX scaling, YUY2 brightness, contrast, saturation.

Post by VideoDe » Thu, 18 Dec 2003 16:31:22

Hi,
good image proccessing filters can be found at
www.montivision.com
enze, www.mpegcode.com

 
 
 

YUY2->RGB MMX, YUY2 MMX scaling, YUY2 brightness, contrast, saturation.

Post by Antoni » Thu, 18 Dec 2003 17:33:52

Hi, Kamil

We've used Intel Integrated Performance Primitives library that can do
efficiently all this things and provides static or dynamic linkage to either
preselected set of Intel processors or a common routine that will select
appropriate based on the dlls you have. Disadvantage is that when you are
running it on the non-Intel processor it will use generic code, however as
far as I know most of the architectures support MMX by now so you will be
able to benefit at least from this (their code is optimized for each
processor using its new features). You can find this library here
http://www.yqcomputer.com/

Best regards,
Antonio
 
 
 

YUY2->RGB MMX, YUY2 MMX scaling, YUY2 brightness, contrast, saturation.

Post by Jim Easter » Thu, 18 Dec 2003 18:51:32


Why would you do a YUY2->RGB->YUY2 conversion? Adjusting brightness,
contrast and saturation is much easier in YUV space:
brightness - add a constant to Y
contrast - multiply Y by a constant
saturation - multiply U&V by a constant, allowing for the 128 offset.

Domestic TV sets in Europe have RGB inputs. They convert to YUV before
the brightness, contrast and saturation controls, then convert back to
RGB for display. There are good reasons for this.
--
Jim Easterbrook
BBC Research & Development < http://www.yqcomputer.com/ ;
*** All opinions are mine and might not be shared by the BBC ***
 
 
 

YUY2->RGB MMX, YUY2 MMX scaling, YUY2 brightness, contrast, saturation.

Post by » Thu, 18 Dec 2003 23:16:46


Utkownik "Jim Easterbrook" < XXXX@XXXXX.COM > napisaw

>>>>I'm looking for the following procedures: >>>> >>>>- changing level of brightness, contrast, saturation of YUY2 image. >>>>( reasonable speed in C++, I would like to avoid YUY2>>RGB>>YUY2 >>>>onversion ). >> >> Why would you do a YUY2>>RGB>>YUY2 conversion? Adjusting brightness, >> contrast and saturation is much easier in YUV space: >> brightness - add a constant to Y >> contrast - multiply Y by a constant >> saturation - multiply U&V by a constant, allowing for the 128 offset. >> >> Domestic TV sets in Europe have RGB inputs. They convert to YUV before >> the brightness, contrast and saturation controls, then convert back to >> RGB for display. There are good reasons for this. >> -- >> Jim Easterbrook


Thanks for all answers !

I posted this questions to other forum and got answer about YU>>RGB>>YUV
conversion, but I also noticed that changing brightness should be as easy as
changing Y component. We are also planning to use IPP library in our program
but I didn't found any YUY2>>RGB conversion/scalling routine. There is
YUV>>RGB conversion present but I don't know how it can be used in YUY2
case.

Kamil
 
 
 

YUY2->RGB MMX, YUY2 MMX scaling, YUY2 brightness, contrast, saturation.

Post by Pepela » Fri, 19 Dec 2003 14:13:47


>>
>>> >>>>I'm looking for the following procedures: >>>> >>>>- changing level of brightness, contrast, saturation of YUY2 image. >>>>( reasonable speed in C++, I would like to avoid YUY2>>RGB>>YUY2 >>>>onversion ). >>> >>>Why would you do a YUY2>>RGB>>YUY2 conversion? Adjusting brightness, >>>contrast and saturation is much easier in YUV space: >>>brightness - add a constant to Y >>>contrast - multiply Y by a constant >>>saturation - multiply U&V by a constant, allowing for the 128 offset. >>> >>>Domestic TV sets in Europe have RGB inputs. They convert to YUV before >>>the brightness, contrast and saturation controls, then convert back to >>>RGB for display. There are good reasons for this. >>>-- >>>Jim Easterbrook >> >> >> >> Thanks for all answers ! >> >> I posted this questions to other forum and got answer about YU>>RGB>>YUV >> conversion, but I also noticed that changing brightness should be as easy as >> changing Y component. We are also planning to use IPP library in our program >> but I didn't found any YUY2>>RGB conversion/scalling routine. There is >> YUV>>RGB conversion present but I don't know how it can be used in YUY2 >> case. >> >> Kamil >> >>
Hi!

For YUY2 you should use following algorithm:
1) Take 2 adjacent pixels of RGB image (i.e 0 and 1, 2 and 3..and so on)
2) Calculate Y1, U1, V1 from first point RGB values
3) Calculate Y2, U2, V2 from second point RGB values
4) Write 4 bytes into target memory Y1 |(U1+U2)/2 | Y2 | (V1+V2)/2
5) Increment corresponding pointers

Regards,
Vladimir Baldetski
 
 
 

YUY2->RGB MMX, YUY2 MMX scaling, YUY2 brightness, contrast, saturation.

Post by Pepela » Fri, 19 Dec 2003 14:25:24


>>
>>> >>>>I'm looking for the following procedures: >>>> >>>>- changing level of brightness, contrast, saturation of YUY2 image. >>>>( reasonable speed in C++, I would like to avoid YUY2>>RGB>>YUY2 >>>>onversion ). >>> >>>Why would you do a YUY2>>RGB>>YUY2 conversion? Adjusting brightness, >>>contrast and saturation is much easier in YUV space: >>>brightness - add a constant to Y >>>contrast - multiply Y by a constant >>>saturation - multiply U&V by a constant, allowing for the 128 offset. >>> >>>Domestic TV sets in Europe have RGB inputs. They convert to YUV before >>>the brightness, contrast and saturation controls, then convert back to >>>RGB for display. There are good reasons for this. >>>-- >>>Jim Easterbrook >> >> >> >> Thanks for all answers ! >> >> I posted this questions to other forum and got answer about YU>>RGB>>YUV >> conversion, but I also noticed that changing brightness should be as easy as >> changing Y component. We are also planning to use IPP library in our program >> but I didn't found any YUY2>>RGB conversion/scalling routine. There is >> YUV>>RGB conversion present but I don't know how it can be used in YUY2 >> case. >> >> Kamil >> >>
As for YUY2>>RGB conversion: YUY2 image is placed in memory in followind
way:

number of byte: 0 1 2 3 4 5 6 7
value of byte: Y1 U1 Y2 V1 Y3 U2 Y4 V2

so you get 2 RGB points (6 bytes in RGB24, 8 bytes in RGB32) from 4
bytes of YUY2

R1, B1, G1 from Y1 U1 V1
R2, B2, G2 from Y2 U1 V1

and

R3, B3, G3 from Y3 U2 V2
R4, B4, G4 from Y4 U2 V2

and so on..

Hope this helps

Regards,
Vladimit Baldetski
 
 
 

YUY2->RGB MMX, YUY2 MMX scaling, YUY2 brightness, contrast, saturation.

Post by Antoni » Fri, 19 Dec 2003 18:47:15

Hi, Kamil

In IPP library RGB and YUV stand for generic colorspaces not for particular
formats. By mean of their structures you can then define with which
particular RGB or YUV format you'd like to work. They certainly support lots
of planar YUV formats and if my memory serves me well some packed ones too.
Taking into account that YUY2 is packed format I can't promise that You'll
be able to work with it in IPP, however it worth having a look at the
samples and documentation cause this format is used by variety of
applications (e.g. JPEG conversion if I'm not mistaken) and they have some
samples for these kinds of applications (have a look at sample for JPEG
encoding in IPP first, maybe it will help).

Regards,
Antonio



>>>>>>I'm looking for the following procedures: >>>>>> >>>>>>- changing level of brightness, contrast, saturation of YUY2 image. >>>>>>( reasonable speed in C++, I would like to avoid YUY2>>RGB>>YUY2 >>>>>>onversion ). >>>> >>>> Why would you do a YUY2>>RGB>>YUY2 conversion? Adjusting brightness, >>>> contrast and saturation is much easier in YUV space: >>>> brightness - add a constant to Y >>>> contrast - multiply Y by a constant >>>> saturation - multiply U&V by a constant, allowing for the 128 offset. >>>> >>>> Domestic TV sets in Europe have RGB inputs. They convert to YUV before >>>> the brightness, contrast and saturation controls, then convert back to >>>> RGB for display. There are good reasons for this. >>>> -- >>>> Jim Easterbrook >> >> >> Thanks for all answers ! >> >> I posted this questions to other forum and got answer about YU>>RGB>>YUV >> conversion, but I also noticed that changing brightness should be as easy
as >> changing Y component. We are also planning to use IPP library in our
program >> but I didn't found any YUY2>>RGB conversion/scalling routine. There is >> YUV>>RGB conversion present but I don't know how it can be used in YUY2 >> case. >> >> Kamil >> >>