FreeRDP
prim_YUV.c File Reference
#include <freerdp/types.h>
#include <freerdp/primitives.h>
#include <freerdp/codec/color.h>
#include "prim_internal.h"

Functions

static pstatus_t general_LumaToYUV444 (const BYTE *pSrcRaw[3], const UINT32 srcStep[3], BYTE *pDstRaw[3], const UINT32 dstStep[3], const RECTANGLE_16 *roi)
 
static pstatus_t general_ChromaFilter (BYTE *pDst[3], const UINT32 dstStep[3], const RECTANGLE_16 *roi)
 
static pstatus_t general_ChromaV1ToYUV444 (const BYTE *pSrcRaw[3], const UINT32 srcStep[3], BYTE *pDstRaw[3], const UINT32 dstStep[3], const RECTANGLE_16 *roi)
 
static pstatus_t general_ChromaV2ToYUV444 (const BYTE *pSrc[3], const UINT32 srcStep[3], UINT32 nTotalWidth, UINT32 nTotalHeight, BYTE *pDst[3], const UINT32 dstStep[3], const RECTANGLE_16 *roi)
 
static pstatus_t general_YUV420CombineToYUV444 (avc444_frame_type type, const BYTE *pSrc[3], const UINT32 srcStep[3], UINT32 nWidth, UINT32 nHeight, BYTE *pDst[3], const UINT32 dstStep[3], const RECTANGLE_16 *roi)
 
static pstatus_t general_YUV444SplitToYUV420 (const BYTE *pSrc[3], const UINT32 srcStep[3], BYTE *pMainDst[3], const UINT32 dstMainStep[3], BYTE *pAuxDst[3], const UINT32 dstAuxStep[3], const prim_size_t *roi)
 
static pstatus_t general_YUV444ToRGB_8u_P3AC4R_general (const BYTE *pSrc[3], const UINT32 srcStep[3], BYTE *pDst, UINT32 dstStep, UINT32 DstFormat, const prim_size_t *roi)
 
static pstatus_t general_YUV444ToRGB_8u_P3AC4R_BGRX (const BYTE *pSrc[3], const UINT32 srcStep[3], BYTE *pDst, UINT32 dstStep, UINT32 DstFormat, const prim_size_t *roi)
 
static pstatus_t general_YUV444ToRGB_8u_P3AC4R (const BYTE *pSrc[3], const UINT32 srcStep[3], BYTE *pDst, UINT32 dstStep, UINT32 DstFormat, const prim_size_t *roi)
 
static pstatus_t general_YUV420ToRGB_8u_P3AC4R (const BYTE *pSrc[3], const UINT32 srcStep[3], BYTE *pDst, UINT32 dstStep, UINT32 DstFormat, const prim_size_t *roi)
 
static INLINE BYTE RGB2Y (BYTE R, BYTE G, BYTE B)
 
static INLINE BYTE RGB2U (BYTE R, BYTE G, BYTE B)
 
static INLINE BYTE RGB2V (INT32 R, INT32 G, INT32 B)
 
static pstatus_t general_RGBToYUV444_8u_P3AC4R (const BYTE *pSrc, UINT32 SrcFormat, const UINT32 srcStep, BYTE *pDst[3], UINT32 dstStep[3], const prim_size_t *roi)
 
static INLINE pstatus_t general_RGBToYUV420_BGRX (const BYTE *pSrc, UINT32 srcStep, BYTE *pDst[3], UINT32 dstStep[3], const prim_size_t *roi)
 
static INLINE pstatus_t general_RGBToYUV420_RGBX (const BYTE *pSrc, UINT32 srcStep, BYTE *pDst[3], UINT32 dstStep[3], const prim_size_t *roi)
 
static INLINE pstatus_t general_RGBToYUV420_ANY (const BYTE *pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *pDst[3], UINT32 dstStep[3], const prim_size_t *roi)
 
static pstatus_t general_RGBToYUV420_8u_P3AC4R (const BYTE *pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *pDst[3], UINT32 dstStep[3], const prim_size_t *roi)
 
static INLINE void general_RGBToAVC444YUV_BGRX_DOUBLE_ROW (const BYTE *srcEven, const BYTE *srcOdd, BYTE *b1Even, BYTE *b1Odd, BYTE *b2, BYTE *b3, BYTE *b4, BYTE *b5, BYTE *b6, BYTE *b7, UINT32 width)
 
static INLINE pstatus_t general_RGBToAVC444YUV_BGRX (const BYTE *pSrc, UINT32 srcStep, BYTE *pDst1[3], const UINT32 dst1Step[3], BYTE *pDst2[3], const UINT32 dst2Step[3], const prim_size_t *roi)
 
static INLINE void general_RGBToAVC444YUV_RGBX_DOUBLE_ROW (const BYTE *srcEven, const BYTE *srcOdd, BYTE *b1Even, BYTE *b1Odd, BYTE *b2, BYTE *b3, BYTE *b4, BYTE *b5, BYTE *b6, BYTE *b7, UINT32 width)
 
static INLINE pstatus_t general_RGBToAVC444YUV_RGBX (const BYTE *pSrc, UINT32 srcStep, BYTE *pDst1[3], const UINT32 dst1Step[3], BYTE *pDst2[3], const UINT32 dst2Step[3], const prim_size_t *roi)
 
static INLINE void general_RGBToAVC444YUV_ANY_DOUBLE_ROW (const BYTE *srcEven, const BYTE *srcOdd, UINT32 srcFormat, BYTE *b1Even, BYTE *b1Odd, BYTE *b2, BYTE *b3, BYTE *b4, BYTE *b5, BYTE *b6, BYTE *b7, UINT32 width)
 
static INLINE pstatus_t general_RGBToAVC444YUV_ANY (const BYTE *pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *pDst1[3], const UINT32 dst1Step[3], BYTE *pDst2[3], const UINT32 dst2Step[3], const prim_size_t *roi)
 
static INLINE pstatus_t general_RGBToAVC444YUV (const BYTE *pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *pDst1[3], const UINT32 dst1Step[3], BYTE *pDst2[3], const UINT32 dst2Step[3], const prim_size_t *roi)
 
static INLINE void general_RGBToAVC444YUVv2_ANY_DOUBLE_ROW (const BYTE *srcEven, const BYTE *srcOdd, UINT32 srcFormat, BYTE *yLumaDstEven, BYTE *yLumaDstOdd, BYTE *uLumaDst, BYTE *vLumaDst, BYTE *yEvenChromaDst1, BYTE *yEvenChromaDst2, BYTE *yOddChromaDst1, BYTE *yOddChromaDst2, BYTE *uChromaDst1, BYTE *uChromaDst2, BYTE *vChromaDst1, BYTE *vChromaDst2, UINT32 width)
 
static INLINE pstatus_t general_RGBToAVC444YUVv2_ANY (const BYTE *pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *pDst1[3], const UINT32 dst1Step[3], BYTE *pDst2[3], const UINT32 dst2Step[3], const prim_size_t *roi)
 
static INLINE void general_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW (const BYTE *srcEven, const BYTE *srcOdd, BYTE *yLumaDstEven, BYTE *yLumaDstOdd, BYTE *uLumaDst, BYTE *vLumaDst, BYTE *yEvenChromaDst1, BYTE *yEvenChromaDst2, BYTE *yOddChromaDst1, BYTE *yOddChromaDst2, BYTE *uChromaDst1, BYTE *uChromaDst2, BYTE *vChromaDst1, BYTE *vChromaDst2, UINT32 width)
 
static INLINE pstatus_t general_RGBToAVC444YUVv2_BGRX (const BYTE *pSrc, UINT32 srcStep, BYTE *pDst1[3], const UINT32 dst1Step[3], BYTE *pDst2[3], const UINT32 dst2Step[3], const prim_size_t *roi)
 
static INLINE pstatus_t general_RGBToAVC444YUVv2 (const BYTE *pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *pDst1[3], const UINT32 dst1Step[3], BYTE *pDst2[3], const UINT32 dst2Step[3], const prim_size_t *roi)
 
void primitives_init_YUV (primitives_t *prims)
 

Function Documentation

static pstatus_t general_ChromaFilter ( BYTE pDst[3],
const UINT32  dstStep[3],
const RECTANGLE_16 *  roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static pstatus_t general_ChromaV1ToYUV444 ( const BYTE pSrcRaw[3],
const UINT32  srcStep[3],
BYTE pDstRaw[3],
const UINT32  dstStep[3],
const RECTANGLE_16 *  roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static pstatus_t general_ChromaV2ToYUV444 ( const BYTE pSrc[3],
const UINT32  srcStep[3],
UINT32  nTotalWidth,
UINT32  nTotalHeight,
BYTE pDst[3],
const UINT32  dstStep[3],
const RECTANGLE_16 *  roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static pstatus_t general_LumaToYUV444 ( const BYTE pSrcRaw[3],
const UINT32  srcStep[3],
BYTE pDstRaw[3],
const UINT32  dstStep[3],
const RECTANGLE_16 *  roi 
)
static

FreeRDP: A Remote Desktop Protocol Implementation Generic YUV/RGB conversion operations

Copyright 2014 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2015-2017 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2015-2017 Norbert Federa norbe.nosp@m.rt.f.nosp@m.edera.nosp@m.@thi.nosp@m.ncast.nosp@m..com Copyright 2015-2017 Vic Lee Copyright 2015-2017 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE pstatus_t general_RGBToAVC444YUV ( const BYTE pSrc,
UINT32  srcFormat,
UINT32  srcStep,
BYTE pDst1[3],
const UINT32  dst1Step[3],
BYTE pDst2[3],
const UINT32  dst2Step[3],
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE pstatus_t general_RGBToAVC444YUV_ANY ( const BYTE pSrc,
UINT32  srcFormat,
UINT32  srcStep,
BYTE pDst1[3],
const UINT32  dst1Step[3],
BYTE pDst2[3],
const UINT32  dst2Step[3],
const prim_size_t roi 
)
static

Note: According to [MS-RDPEGFX 2.2.4.4 RFX_AVC420_BITMAP_STREAM] the width and height of the MPEG-4 AVC/H.264 codec bitstream MUST be aligned to a multiple of 16. Hence the passed destination YUV420/CHROMA420 buffers must have been allocated accordingly !!

[MS-RDPEGFX 3.3.8.3.2 YUV420p Stream Combination] defines the following "Bx areas":

YUV420 frame (main view): B1: From Y444 all pixels B2: From U444 all pixels in even rows with even columns B3: From V444 all pixels in even rows with even columns

Chroma420 frame (auxillary view): B45: From U444 and V444 all pixels from all odd rows (The odd U444 and V444 rows must be interleaved in 8-line blocks in B45 !!!) B6: From U444 all pixels in even rows with odd columns B7: From V444 all pixels in even rows with odd columns

Microsoft's horrible unclear description in MS-RDPEGFX translated to pseudo code looks like this:

for (y = 0; y < fullHeight; y++) { for (x = 0; x < fullWidth; x++) { B1[x,y] = Y444[x,y]; } }

for (y = 0; y < halfHeight; y++) { for (x = 0; x < halfWidth; x++) { B2[x,y] = U444[2 * x, 2 * y]; B3[x,y] = V444[2 * x, 2 * y]; B6[x,y] = U444[2 * x + 1, 2 * y]; B7[x,y] = V444[2 * x + 1, 2 * y]; } }

for (y = 0; y < halfHeight; y++) { yU = (y / 8) * 16; // identify first row of correct 8-line U block in B45 yU += (y % 8); // add offset rows in destination block yV = yU + 8; // the corresponding v line is always 8 rows ahead

for (x = 0; x < fullWidth; x++) { B45[x,yU] = U444[x, 2 * y + 1]; B45[x,yV] = V444[x, 2 * y + 1]; } }

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE void general_RGBToAVC444YUV_ANY_DOUBLE_ROW ( const BYTE srcEven,
const BYTE srcOdd,
UINT32  srcFormat,
BYTE b1Even,
BYTE b1Odd,
BYTE b2,
BYTE b3,
BYTE b4,
BYTE b5,
BYTE b6,
BYTE b7,
UINT32  width 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE pstatus_t general_RGBToAVC444YUV_BGRX ( const BYTE pSrc,
UINT32  srcStep,
BYTE pDst1[3],
const UINT32  dst1Step[3],
BYTE pDst2[3],
const UINT32  dst2Step[3],
const prim_size_t roi 
)
static

Note: Read information in function general_RGBToAVC444YUV_ANY below !

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE void general_RGBToAVC444YUV_BGRX_DOUBLE_ROW ( const BYTE srcEven,
const BYTE srcOdd,
BYTE b1Even,
BYTE b1Odd,
BYTE b2,
BYTE b3,
BYTE b4,
BYTE b5,
BYTE b6,
BYTE b7,
UINT32  width 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE pstatus_t general_RGBToAVC444YUV_RGBX ( const BYTE pSrc,
UINT32  srcStep,
BYTE pDst1[3],
const UINT32  dst1Step[3],
BYTE pDst2[3],
const UINT32  dst2Step[3],
const prim_size_t roi 
)
static

Note: Read information in function general_RGBToAVC444YUV_ANY below !

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE void general_RGBToAVC444YUV_RGBX_DOUBLE_ROW ( const BYTE srcEven,
const BYTE srcOdd,
BYTE b1Even,
BYTE b1Odd,
BYTE b2,
BYTE b3,
BYTE b4,
BYTE b5,
BYTE b6,
BYTE b7,
UINT32  width 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE pstatus_t general_RGBToAVC444YUVv2 ( const BYTE pSrc,
UINT32  srcFormat,
UINT32  srcStep,
BYTE pDst1[3],
const UINT32  dst1Step[3],
BYTE pDst2[3],
const UINT32  dst2Step[3],
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE pstatus_t general_RGBToAVC444YUVv2_ANY ( const BYTE pSrc,
UINT32  srcFormat,
UINT32  srcStep,
BYTE pDst1[3],
const UINT32  dst1Step[3],
BYTE pDst2[3],
const UINT32  dst2Step[3],
const prim_size_t roi 
)
static

Note: According to [MS-RDPEGFX 2.2.4.4 RFX_AVC420_BITMAP_STREAM] the width and height of the MPEG-4 AVC/H.264 codec bitstream MUST be aligned to a multiple of 16. Hence the passed destination YUV420/CHROMA420 buffers must have been allocated accordingly !!

[MS-RDPEGFX 3.3.8.3.3 YUV420p Stream Combination for YUV444v2 mode] defines the following "Bx areas":

YUV420 frame (main view): B1: From Y444 all pixels B2: From U444 all pixels in even rows with even rows and columns B3: From V444 all pixels in even rows with even rows and columns

Chroma420 frame (auxillary view): B45: From U444 and V444 all pixels from all odd columns B67: From U444 and V444 every 4th pixel in odd rows B89: From U444 and V444 every 4th pixel (initial offset of 2) in odd rows

Chroma Bxy areas correspond to the left and right half of the YUV420 plane. for (y = 0; y < fullHeight; y++) { for (x = 0; x < fullWidth; x++) { B1[x,y] = Y444[x,y]; }

for (x = 0; x < halfWidth; x++) { B4[x,y] = U444[2 * x, 2 * y]; B5[x,y] = V444[2 * x, 2 * y]; } }

for (y = 0; y < halfHeight; y++) { for (x = 0; x < halfWidth; x++) { B2[x,y] = U444[2 * x, 2 * y]; B3[x,y] = V444[2 * x, 2 * y]; B6[x,y] = U444[4 * x, 2 * y + 1]; B7[x,y] = V444[4 * x, 2 * y + 1]; B8[x,y] = V444[4 * x + 2, 2 * y + 1]; B9[x,y] = V444[4 * x + 2, 2 * y] + 1; } }

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE void general_RGBToAVC444YUVv2_ANY_DOUBLE_ROW ( const BYTE srcEven,
const BYTE srcOdd,
UINT32  srcFormat,
BYTE yLumaDstEven,
BYTE yLumaDstOdd,
BYTE uLumaDst,
BYTE vLumaDst,
BYTE yEvenChromaDst1,
BYTE yEvenChromaDst2,
BYTE yOddChromaDst1,
BYTE yOddChromaDst2,
BYTE uChromaDst1,
BYTE uChromaDst2,
BYTE vChromaDst1,
BYTE vChromaDst2,
UINT32  width 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE pstatus_t general_RGBToAVC444YUVv2_BGRX ( const BYTE pSrc,
UINT32  srcStep,
BYTE pDst1[3],
const UINT32  dst1Step[3],
BYTE pDst2[3],
const UINT32  dst2Step[3],
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE void general_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW ( const BYTE srcEven,
const BYTE srcOdd,
BYTE yLumaDstEven,
BYTE yLumaDstOdd,
BYTE uLumaDst,
BYTE vLumaDst,
BYTE yEvenChromaDst1,
BYTE yEvenChromaDst2,
BYTE yOddChromaDst1,
BYTE yOddChromaDst2,
BYTE uChromaDst1,
BYTE uChromaDst2,
BYTE vChromaDst1,
BYTE vChromaDst2,
UINT32  width 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static pstatus_t general_RGBToYUV420_8u_P3AC4R ( const BYTE pSrc,
UINT32  srcFormat,
UINT32  srcStep,
BYTE pDst[3],
UINT32  dstStep[3],
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE pstatus_t general_RGBToYUV420_ANY ( const BYTE pSrc,
UINT32  srcFormat,
UINT32  srcStep,
BYTE pDst[3],
UINT32  dstStep[3],
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE pstatus_t general_RGBToYUV420_BGRX ( const BYTE pSrc,
UINT32  srcStep,
BYTE pDst[3],
UINT32  dstStep[3],
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE pstatus_t general_RGBToYUV420_RGBX ( const BYTE pSrc,
UINT32  srcStep,
BYTE pDst[3],
UINT32  dstStep[3],
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static pstatus_t general_RGBToYUV444_8u_P3AC4R ( const BYTE pSrc,
UINT32  SrcFormat,
const UINT32  srcStep,
BYTE pDst[3],
UINT32  dstStep[3],
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static pstatus_t general_YUV420CombineToYUV444 ( avc444_frame_type  type,
const BYTE pSrc[3],
const UINT32  srcStep[3],
UINT32  nWidth,
UINT32  nHeight,
BYTE pDst[3],
const UINT32  dstStep[3],
const RECTANGLE_16 *  roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static pstatus_t general_YUV420ToRGB_8u_P3AC4R ( const BYTE pSrc[3],
const UINT32  srcStep[3],
BYTE pDst,
UINT32  dstStep,
UINT32  DstFormat,
const prim_size_t roi 
)
static

| R | ( | 256 0 403 | | Y | ) | G | = ( | 256 -48 -120 | | U - 128 | ) >> 8 | B | ( | 256 475 0 | | V - 128 | )

Here is the call graph for this function:

Here is the caller graph for this function:

static pstatus_t general_YUV444SplitToYUV420 ( const BYTE pSrc[3],
const UINT32  srcStep[3],
BYTE pMainDst[3],
const UINT32  dstMainStep[3],
BYTE pAuxDst[3],
const UINT32  dstAuxStep[3],
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static pstatus_t general_YUV444ToRGB_8u_P3AC4R ( const BYTE pSrc[3],
const UINT32  srcStep[3],
BYTE pDst,
UINT32  dstStep,
UINT32  DstFormat,
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static pstatus_t general_YUV444ToRGB_8u_P3AC4R_BGRX ( const BYTE pSrc[3],
const UINT32  srcStep[3],
BYTE pDst,
UINT32  dstStep,
UINT32  DstFormat,
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static pstatus_t general_YUV444ToRGB_8u_P3AC4R_general ( const BYTE pSrc[3],
const UINT32  srcStep[3],
BYTE pDst,
UINT32  dstStep,
UINT32  DstFormat,
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

void primitives_init_YUV ( primitives_t prims)

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE BYTE RGB2U ( BYTE  R,
BYTE  G,
BYTE  B 
)
static

Here is the caller graph for this function:

static INLINE BYTE RGB2V ( INT32  R,
INT32  G,
INT32  B 
)
static

Here is the caller graph for this function:

static INLINE BYTE RGB2Y ( BYTE  R,
BYTE  G,
BYTE  B 
)
static

| Y | ( | 54 183 18 | | R | ) | 0 | | U | = ( | -29 -99 128 | | G | ) >> 8 + | 128 | | V | ( | 128 -116 -12 | | B | ) | 128 |

Here is the caller graph for this function: