FreeRDP
prim_YUV_ssse3.c File Reference
#include <winpr/sysinfo.h>
#include <winpr/crt.h>
#include <freerdp/types.h>
#include <freerdp/primitives.h>
#include "prim_internal.h"
#include <emmintrin.h>
#include <tmmintrin.h>

Macros

#define BGRX_Y_FACTORS   _mm_set_epi8(0, 27, 92, 9, 0, 27, 92, 9, 0, 27, 92, 9, 0, 27, 92, 9)
 
#define BGRX_U_FACTORS   _mm_set_epi8(0, -29, -99, 127, 0, -29, -99, 127, 0, -29, -99, 127, 0, -29, -99, 127)
 
#define BGRX_V_FACTORS   _mm_set_epi8(0, 127, -116, -12, 0, 127, -116, -12, 0, 127, -116, -12, 0, 127, -116, -12)
 
#define CONST128_FACTORS   _mm_set1_epi8(-128)
 
#define Y_SHIFT   7
 
#define U_SHIFT   8
 
#define V_SHIFT   8
 

Functions

static __m128i * ssse3_YUV444Pixel (__m128i *dst, __m128i Yraw, __m128i Uraw, __m128i Vraw, UINT8 pos)
 
static pstatus_t ssse3_YUV420ToRGB_BGRX (const BYTE **pSrc, const UINT32 *srcStep, BYTE *pDst, UINT32 dstStep, const prim_size_t *roi)
 
static pstatus_t ssse3_YUV420ToRGB (const BYTE **pSrc, const UINT32 *srcStep, BYTE *pDst, UINT32 dstStep, UINT32 DstFormat, const prim_size_t *roi)
 
static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R_BGRX (const BYTE **pSrc, const UINT32 *srcStep, BYTE *pDst, UINT32 dstStep, const prim_size_t *roi)
 
static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R (const BYTE **pSrc, const UINT32 *srcStep, BYTE *pDst, UINT32 dstStep, UINT32 DstFormat, const prim_size_t *roi)
 
static INLINE void ssse3_RGBToYUV420_BGRX_Y (const BYTE *src, BYTE *dst, UINT32 width)
 
static INLINE void ssse3_RGBToYUV420_BGRX_UV (const BYTE *src1, const BYTE *src2, BYTE *dst1, BYTE *dst2, UINT32 width)
 
static pstatus_t ssse3_RGBToYUV420_BGRX (const BYTE *pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *pDst[3], UINT32 dstStep[3], const prim_size_t *roi)
 
static pstatus_t ssse3_RGBToYUV420 (const BYTE *pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *pDst[3], UINT32 dstStep[3], const prim_size_t *roi)
 
static INLINE void ssse3_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 pstatus_t ssse3_RGBToAVC444YUV_BGRX (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 pstatus_t ssse3_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 ssse3_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 pstatus_t ssse3_RGBToAVC444YUVv2_BGRX (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 pstatus_t ssse3_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 pstatus_t ssse3_LumaToYUV444 (const BYTE *pSrcRaw[3], const UINT32 srcStep[3], BYTE *pDstRaw[3], const UINT32 dstStep[3], const RECTANGLE_16 *roi)
 
static INLINE void ssse3_filter (BYTE *pSrcDst, const BYTE *pSrc2)
 
static pstatus_t ssse3_ChromaFilter (BYTE *pDst[3], const UINT32 dstStep[3], const RECTANGLE_16 *roi)
 
static pstatus_t ssse3_ChromaV1ToYUV444 (const BYTE *pSrcRaw[3], const UINT32 srcStep[3], BYTE *pDstRaw[3], const UINT32 dstStep[3], const RECTANGLE_16 *roi)
 
static pstatus_t ssse3_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 ssse3_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)
 
void primitives_init_YUV_opt (primitives_t *prims)
 

Variables

static primitives_tgeneric = NULL
 

Macro Definition Documentation

#define BGRX_U_FACTORS   _mm_set_epi8(0, -29, -99, 127, 0, -29, -99, 127, 0, -29, -99, 127, 0, -29, -99, 127)
#define BGRX_V_FACTORS   _mm_set_epi8(0, 127, -116, -12, 0, 127, -116, -12, 0, 127, -116, -12, 0, 127, -116, -12)
#define BGRX_Y_FACTORS   _mm_set_epi8(0, 27, 92, 9, 0, 27, 92, 9, 0, 27, 92, 9, 0, 27, 92, 9)

Note (nfedera): The used forward transformation factors from RGB to YUV are based on the values specified in [Rec. ITU-R BT.709-6] Section 3: http://www.itu.int/rec/R-REC-BT.709-6-201506-I/en

Y = 0.21260 * R + 0.71520 * G + 0.07220 * B + 0; U = -0.11457 * R - 0.38543 * G + 0.50000 * B + 128; V = 0.50000 * R - 0.45415 * G - 0.04585 * B + 128;

The most accurate integer arithmetic approximation when using 8-bit signed integer factors with 16-bit signed integer intermediate results is:

Y = ( ( 27 * R + 92 * G + 9 * B) >> 7 ); U = ( (-29 * R - 99 * G + 128 * B) >> 8 ) + 128; V = ( ( 128 * R - 116 * G - 12 * B) >> 8 ) + 128;

Due to signed 8bit range being [-128,127] the U and V constants of 128 are rounded to 127

#define CONST128_FACTORS   _mm_set1_epi8(-128)
#define U_SHIFT   8
#define V_SHIFT   8
#define Y_SHIFT   7

Function Documentation

void primitives_init_YUV_opt ( primitives_t prims)

Here is the call graph for this function:

static pstatus_t ssse3_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 ssse3_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 ssse3_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 INLINE void ssse3_filter ( BYTE pSrcDst,
const BYTE pSrc2 
)
static

Here is the caller graph for this function:

static pstatus_t ssse3_LumaToYUV444 ( 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 ssse3_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 pstatus_t ssse3_RGBToAVC444YUV_BGRX ( 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 void ssse3_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 caller graph for this function:

static pstatus_t ssse3_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 pstatus_t ssse3_RGBToAVC444YUVv2_BGRX ( 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 void ssse3_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 caller graph for this function:

static pstatus_t ssse3_RGBToYUV420 ( 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 pstatus_t ssse3_RGBToYUV420_BGRX ( 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 void ssse3_RGBToYUV420_BGRX_UV ( const BYTE src1,
const BYTE src2,
BYTE dst1,
BYTE dst2,
UINT32  width 
)
static

shuffle controls c = a[0],a[2],b[0],b[2] == 10 00 10 00 = 0x88 c = a[1],a[3],b[1],b[3] == 11 01 11 01 = 0xdd

Here is the caller graph for this function:

static INLINE void ssse3_RGBToYUV420_BGRX_Y ( const BYTE src,
BYTE dst,
UINT32  width 
)
static

Here is the caller graph for this function:

static pstatus_t ssse3_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 ssse3_YUV420ToRGB ( const BYTE **  pSrc,
const UINT32 srcStep,
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 ssse3_YUV420ToRGB_BGRX ( const BYTE **  pSrc,
const UINT32 srcStep,
BYTE pDst,
UINT32  dstStep,
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static __m128i* ssse3_YUV444Pixel ( __m128i *  dst,
__m128i  Yraw,
__m128i  Uraw,
__m128i  Vraw,
UINT8  pos 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R ( const BYTE **  pSrc,
const UINT32 srcStep,
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 ssse3_YUV444ToRGB_8u_P3AC4R_BGRX ( const BYTE **  pSrc,
const UINT32 srcStep,
BYTE pDst,
UINT32  dstStep,
const prim_size_t roi 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

primitives_t* generic = NULL
static

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

Copyright 2014 Thomas Erbesdobler Copyright 2016-2017 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2016-2017 Norbert Federa norbe.nosp@m.rt.f.nosp@m.edera.nosp@m.@thi.nosp@m.ncast.nosp@m..com Copyright 2016-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.