FreeRDP
prim_YUV_ssse3.c File Reference
#include <winpr/wtypes.h>
#include <freerdp/config.h>
#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 *WINPR_RESTRICT dst, __m128i Yraw, __m128i Uraw, __m128i Vraw, UINT8 pos)
 
static pstatus_t ssse3_YUV420ToRGB_BGRX (const BYTE *const WINPR_RESTRICT pSrc[], const UINT32 *WINPR_RESTRICT srcStep, BYTE *WINPR_RESTRICT pDst, UINT32 dstStep, const prim_size_t *WINPR_RESTRICT roi)
 
static pstatus_t ssse3_YUV420ToRGB (const BYTE *const WINPR_RESTRICT pSrc[3], const UINT32 srcStep[3], BYTE *WINPR_RESTRICT pDst, UINT32 dstStep, UINT32 DstFormat, const prim_size_t *WINPR_RESTRICT roi)
 
static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R_BGRX (const BYTE *const WINPR_RESTRICT pSrc[], const UINT32 srcStep[], BYTE *WINPR_RESTRICT pDst, UINT32 dstStep, const prim_size_t *WINPR_RESTRICT roi)
 
static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R (const BYTE *const WINPR_RESTRICT pSrc[], const UINT32 srcStep[], BYTE *WINPR_RESTRICT pDst, UINT32 dstStep, UINT32 DstFormat, const prim_size_t *WINPR_RESTRICT roi)
 
static INLINE void ssse3_RGBToYUV420_BGRX_Y (const BYTE *WINPR_RESTRICT src, BYTE *dst, UINT32 width)
 
static INLINE void ssse3_RGBToYUV420_BGRX_UV (const BYTE *WINPR_RESTRICT src1, const BYTE *WINPR_RESTRICT src2, BYTE *WINPR_RESTRICT dst1, BYTE *WINPR_RESTRICT dst2, UINT32 width)
 
static pstatus_t ssse3_RGBToYUV420_BGRX (const BYTE *WINPR_RESTRICT pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *WINPR_RESTRICT pDst[], const UINT32 dstStep[], const prim_size_t *WINPR_RESTRICT roi)
 
static pstatus_t ssse3_RGBToYUV420 (const BYTE *WINPR_RESTRICT pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *WINPR_RESTRICT pDst[], const UINT32 dstStep[], const prim_size_t *WINPR_RESTRICT roi)
 
static INLINE void ssse3_RGBToAVC444YUV_BGRX_DOUBLE_ROW (const BYTE *WINPR_RESTRICT srcEven, const BYTE *WINPR_RESTRICT srcOdd, BYTE *WINPR_RESTRICT b1Even, BYTE *WINPR_RESTRICT b1Odd, BYTE *WINPR_RESTRICT b2, BYTE *WINPR_RESTRICT b3, BYTE *WINPR_RESTRICT b4, BYTE *WINPR_RESTRICT b5, BYTE *WINPR_RESTRICT b6, BYTE *WINPR_RESTRICT b7, UINT32 width)
 
static pstatus_t ssse3_RGBToAVC444YUV_BGRX (const BYTE *WINPR_RESTRICT pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *WINPR_RESTRICT pDst1[], const UINT32 dst1Step[], BYTE *WINPR_RESTRICT pDst2[], const UINT32 dst2Step[], const prim_size_t *WINPR_RESTRICT roi)
 
static pstatus_t ssse3_RGBToAVC444YUV (const BYTE *WINPR_RESTRICT pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *WINPR_RESTRICT pDst1[], const UINT32 dst1Step[], BYTE *WINPR_RESTRICT pDst2[], const UINT32 dst2Step[], const prim_size_t *WINPR_RESTRICT roi)
 
static INLINE void ssse3_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW (const BYTE *WINPR_RESTRICT srcEven, const BYTE *WINPR_RESTRICT srcOdd, BYTE *WINPR_RESTRICT yLumaDstEven, BYTE *WINPR_RESTRICT yLumaDstOdd, BYTE *WINPR_RESTRICT uLumaDst, BYTE *WINPR_RESTRICT vLumaDst, BYTE *WINPR_RESTRICT yEvenChromaDst1, BYTE *WINPR_RESTRICT yEvenChromaDst2, BYTE *WINPR_RESTRICT yOddChromaDst1, BYTE *WINPR_RESTRICT yOddChromaDst2, BYTE *WINPR_RESTRICT uChromaDst1, BYTE *WINPR_RESTRICT uChromaDst2, BYTE *WINPR_RESTRICT vChromaDst1, BYTE *WINPR_RESTRICT vChromaDst2, UINT32 width)
 
static pstatus_t ssse3_RGBToAVC444YUVv2_BGRX (const BYTE *WINPR_RESTRICT pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *WINPR_RESTRICT pDst1[], const UINT32 dst1Step[], BYTE *WINPR_RESTRICT pDst2[], const UINT32 dst2Step[], const prim_size_t *WINPR_RESTRICT roi)
 
static pstatus_t ssse3_RGBToAVC444YUVv2 (const BYTE *WINPR_RESTRICT pSrc, UINT32 srcFormat, UINT32 srcStep, BYTE *WINPR_RESTRICT pDst1[], const UINT32 dst1Step[], BYTE *WINPR_RESTRICT pDst2[], const UINT32 dst2Step[], const prim_size_t *WINPR_RESTRICT roi)
 
static pstatus_t ssse3_LumaToYUV444 (const BYTE *const WINPR_RESTRICT pSrcRaw[], const UINT32 srcStep[], BYTE *WINPR_RESTRICT pDstRaw[], const UINT32 dstStep[], const RECTANGLE_16 *WINPR_RESTRICT roi)
 
static INLINE void ssse3_filter (BYTE *WINPR_RESTRICT pSrcDst, const BYTE *WINPR_RESTRICT pSrc2)
 
static pstatus_t ssse3_ChromaFilter (BYTE *WINPR_RESTRICT pDst[], const UINT32 dstStep[], const RECTANGLE_16 *WINPR_RESTRICT roi)
 
static pstatus_t ssse3_ChromaV1ToYUV444 (const BYTE *const WINPR_RESTRICT pSrcRaw[3], const UINT32 srcStep[3], BYTE *WINPR_RESTRICT pDstRaw[3], const UINT32 dstStep[3], const RECTANGLE_16 *WINPR_RESTRICT roi)
 
static pstatus_t ssse3_ChromaV2ToYUV444 (const BYTE *const WINPR_RESTRICT pSrc[3], const UINT32 srcStep[3], UINT32 nTotalWidth, UINT32 nTotalHeight, BYTE *WINPR_RESTRICT pDst[3], const UINT32 dstStep[3], const RECTANGLE_16 *WINPR_RESTRICT roi)
 
static pstatus_t ssse3_YUV420CombineToYUV444 (avc444_frame_type type, const BYTE *const WINPR_RESTRICT pSrc[3], const UINT32 srcStep[3], UINT32 nWidth, UINT32 nHeight, BYTE *WINPR_RESTRICT pDst[3], const UINT32 dstStep[3], const RECTANGLE_16 *WINPR_RESTRICT roi)
 
void primitives_init_YUV_opt (primitives_t *WINPR_RESTRICT prims)
 

Variables

static primitives_tgeneric = NULL
 

Macro Definition Documentation

◆ BGRX_U_FACTORS

#define BGRX_U_FACTORS    _mm_set_epi8(0, -29, -99, 127, 0, -29, -99, 127, 0, -29, -99, 127, 0, -29, -99, 127)

◆ BGRX_V_FACTORS

#define BGRX_V_FACTORS    _mm_set_epi8(0, 127, -116, -12, 0, 127, -116, -12, 0, 127, -116, -12, 0, 127, -116, -12)

◆ BGRX_Y_FACTORS

#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

◆ CONST128_FACTORS

#define CONST128_FACTORS   _mm_set1_epi8(-128)

◆ U_SHIFT

#define U_SHIFT   8

◆ V_SHIFT

#define V_SHIFT   8

◆ Y_SHIFT

#define Y_SHIFT   7

Function Documentation

◆ primitives_init_YUV_opt()

void primitives_init_YUV_opt ( primitives_t *WINPR_RESTRICT  prims)
Here is the call graph for this function:

◆ ssse3_ChromaFilter()

static pstatus_t ssse3_ChromaFilter ( BYTE *WINPR_RESTRICT  pDst[],
const UINT32  dstStep[],
const RECTANGLE_16 *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_ChromaV1ToYUV444()

static pstatus_t ssse3_ChromaV1ToYUV444 ( const BYTE *const WINPR_RESTRICT  pSrcRaw[3],
const UINT32  srcStep[3],
BYTE *WINPR_RESTRICT  pDstRaw[3],
const UINT32  dstStep[3],
const RECTANGLE_16 *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_ChromaV2ToYUV444()

static pstatus_t ssse3_ChromaV2ToYUV444 ( const BYTE *const WINPR_RESTRICT  pSrc[3],
const UINT32  srcStep[3],
UINT32  nTotalWidth,
UINT32  nTotalHeight,
BYTE *WINPR_RESTRICT  pDst[3],
const UINT32  dstStep[3],
const RECTANGLE_16 *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_filter()

static INLINE void ssse3_filter ( BYTE *WINPR_RESTRICT  pSrcDst,
const BYTE *WINPR_RESTRICT  pSrc2 
)
static
Here is the caller graph for this function:

◆ ssse3_LumaToYUV444()

static pstatus_t ssse3_LumaToYUV444 ( const BYTE *const WINPR_RESTRICT  pSrcRaw[],
const UINT32  srcStep[],
BYTE *WINPR_RESTRICT  pDstRaw[],
const UINT32  dstStep[],
const RECTANGLE_16 *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_RGBToAVC444YUV()

static pstatus_t ssse3_RGBToAVC444YUV ( const BYTE *WINPR_RESTRICT  pSrc,
UINT32  srcFormat,
UINT32  srcStep,
BYTE *WINPR_RESTRICT  pDst1[],
const UINT32  dst1Step[],
BYTE *WINPR_RESTRICT  pDst2[],
const UINT32  dst2Step[],
const prim_size_t *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_RGBToAVC444YUV_BGRX()

static pstatus_t ssse3_RGBToAVC444YUV_BGRX ( const BYTE *WINPR_RESTRICT  pSrc,
UINT32  srcFormat,
UINT32  srcStep,
BYTE *WINPR_RESTRICT  pDst1[],
const UINT32  dst1Step[],
BYTE *WINPR_RESTRICT  pDst2[],
const UINT32  dst2Step[],
const prim_size_t *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_RGBToAVC444YUV_BGRX_DOUBLE_ROW()

static INLINE void ssse3_RGBToAVC444YUV_BGRX_DOUBLE_ROW ( const BYTE *WINPR_RESTRICT  srcEven,
const BYTE *WINPR_RESTRICT  srcOdd,
BYTE *WINPR_RESTRICT  b1Even,
BYTE *WINPR_RESTRICT  b1Odd,
BYTE *WINPR_RESTRICT  b2,
BYTE *WINPR_RESTRICT  b3,
BYTE *WINPR_RESTRICT  b4,
BYTE *WINPR_RESTRICT  b5,
BYTE *WINPR_RESTRICT  b6,
BYTE *WINPR_RESTRICT  b7,
UINT32  width 
)
static
Here is the caller graph for this function:

◆ ssse3_RGBToAVC444YUVv2()

static pstatus_t ssse3_RGBToAVC444YUVv2 ( const BYTE *WINPR_RESTRICT  pSrc,
UINT32  srcFormat,
UINT32  srcStep,
BYTE *WINPR_RESTRICT  pDst1[],
const UINT32  dst1Step[],
BYTE *WINPR_RESTRICT  pDst2[],
const UINT32  dst2Step[],
const prim_size_t *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_RGBToAVC444YUVv2_BGRX()

static pstatus_t ssse3_RGBToAVC444YUVv2_BGRX ( const BYTE *WINPR_RESTRICT  pSrc,
UINT32  srcFormat,
UINT32  srcStep,
BYTE *WINPR_RESTRICT  pDst1[],
const UINT32  dst1Step[],
BYTE *WINPR_RESTRICT  pDst2[],
const UINT32  dst2Step[],
const prim_size_t *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW()

static INLINE void ssse3_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW ( const BYTE *WINPR_RESTRICT  srcEven,
const BYTE *WINPR_RESTRICT  srcOdd,
BYTE *WINPR_RESTRICT  yLumaDstEven,
BYTE *WINPR_RESTRICT  yLumaDstOdd,
BYTE *WINPR_RESTRICT  uLumaDst,
BYTE *WINPR_RESTRICT  vLumaDst,
BYTE *WINPR_RESTRICT  yEvenChromaDst1,
BYTE *WINPR_RESTRICT  yEvenChromaDst2,
BYTE *WINPR_RESTRICT  yOddChromaDst1,
BYTE *WINPR_RESTRICT  yOddChromaDst2,
BYTE *WINPR_RESTRICT  uChromaDst1,
BYTE *WINPR_RESTRICT  uChromaDst2,
BYTE *WINPR_RESTRICT  vChromaDst1,
BYTE *WINPR_RESTRICT  vChromaDst2,
UINT32  width 
)
static
Here is the caller graph for this function:

◆ ssse3_RGBToYUV420()

static pstatus_t ssse3_RGBToYUV420 ( const BYTE *WINPR_RESTRICT  pSrc,
UINT32  srcFormat,
UINT32  srcStep,
BYTE *WINPR_RESTRICT  pDst[],
const UINT32  dstStep[],
const prim_size_t *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_RGBToYUV420_BGRX()

static pstatus_t ssse3_RGBToYUV420_BGRX ( const BYTE *WINPR_RESTRICT  pSrc,
UINT32  srcFormat,
UINT32  srcStep,
BYTE *WINPR_RESTRICT  pDst[],
const UINT32  dstStep[],
const prim_size_t *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_RGBToYUV420_BGRX_UV()

static INLINE void ssse3_RGBToYUV420_BGRX_UV ( const BYTE *WINPR_RESTRICT  src1,
const BYTE *WINPR_RESTRICT  src2,
BYTE *WINPR_RESTRICT  dst1,
BYTE *WINPR_RESTRICT  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:

◆ ssse3_RGBToYUV420_BGRX_Y()

static INLINE void ssse3_RGBToYUV420_BGRX_Y ( const BYTE *WINPR_RESTRICT  src,
BYTE dst,
UINT32  width 
)
static
Here is the caller graph for this function:

◆ ssse3_YUV420CombineToYUV444()

static pstatus_t ssse3_YUV420CombineToYUV444 ( avc444_frame_type  type,
const BYTE *const WINPR_RESTRICT  pSrc[3],
const UINT32  srcStep[3],
UINT32  nWidth,
UINT32  nHeight,
BYTE *WINPR_RESTRICT  pDst[3],
const UINT32  dstStep[3],
const RECTANGLE_16 *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_YUV420ToRGB()

static pstatus_t ssse3_YUV420ToRGB ( const BYTE *const WINPR_RESTRICT  pSrc[3],
const UINT32  srcStep[3],
BYTE *WINPR_RESTRICT  pDst,
UINT32  dstStep,
UINT32  DstFormat,
const prim_size_t *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_YUV420ToRGB_BGRX()

static pstatus_t ssse3_YUV420ToRGB_BGRX ( const BYTE *const WINPR_RESTRICT  pSrc[],
const UINT32 *WINPR_RESTRICT  srcStep,
BYTE *WINPR_RESTRICT  pDst,
UINT32  dstStep,
const prim_size_t *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_YUV444Pixel()

static __m128i* ssse3_YUV444Pixel ( __m128i *WINPR_RESTRICT  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:

◆ ssse3_YUV444ToRGB_8u_P3AC4R()

static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R ( const BYTE *const WINPR_RESTRICT  pSrc[],
const UINT32  srcStep[],
BYTE *WINPR_RESTRICT  pDst,
UINT32  dstStep,
UINT32  DstFormat,
const prim_size_t *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssse3_YUV444ToRGB_8u_P3AC4R_BGRX()

static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R_BGRX ( const BYTE *const WINPR_RESTRICT  pSrc[],
const UINT32  srcStep[],
BYTE *WINPR_RESTRICT  pDst,
UINT32  dstStep,
const prim_size_t *WINPR_RESTRICT  roi 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ generic

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.