FFmpeg
Macros | Functions
output_lsx.c File Reference
#include "swscale_loongarch.h"
#include "libavutil/loongarch/loongson_intrinsics.h"

Go to the source code of this file.

Macros

#define r_b   ((target == AV_PIX_FMT_RGB24) ? r : b)
 
#define b_r   ((target == AV_PIX_FMT_RGB24) ? b : r)
 
#define WRITE_YUV2RGB_LSX(vec_y1, vec_y2, vec_u, vec_v, t1, t2, t3, t4)
 
#define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha)
 
#define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha)
 
#define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha)
 
#define A_DITHER(u, v)   (((((u)+((v)*236))*119)&0xff))
 
#define X_DITHER(u, v)   (((((u)^((v)*237))*181)&0x1ff)/2)
 
#define YUVTORGB_SETUP_LSX
 
#define YUVTORGB_LSX(y, u, v, R, G, B, offset, coeff, y_temp, v2r, v2g, u2g, u2b)
 
#define WRITE_FULL_A_LSX(r, g, b, a, t1, s)
 
#define WRITE_FULL_LSX(r, g, b, t1, s)
 

Functions

static av_always_inline void yuv2rgb_write (uint8_t *_dest, int i, int Y1, int Y2, unsigned A1, unsigned A2, const void *_r, const void *_g, const void *_b, int y, enum AVPixelFormat target, int hasAlpha)
 
static void yuv2rgb_X_template_lsx (SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y, enum AVPixelFormat target, int hasAlpha)
 
static void yuv2rgb_2_template_lsx (SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha)
 
static void yuv2rgb_1_template_lsx (SwsContext *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha)
 
static av_always_inline void yuv2rgb_write_full (SwsContext *c, uint8_t *dest, int i, int R, int A, int G, int B, int y, enum AVPixelFormat target, int hasAlpha, int err[4])
 
static void yuv2rgb_full_X_template_lsx (SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y, enum AVPixelFormat target, int hasAlpha)
 
static void yuv2rgb_full_2_template_lsx (SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha)
 
static void yuv2rgb_full_1_template_lsx (SwsContext *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha)
 
av_cold void ff_sws_init_output_lsx (SwsContext *c)
 

Macro Definition Documentation

◆ r_b

#define r_b   ((target == AV_PIX_FMT_RGB24) ? r : b)

◆ b_r

#define b_r   ((target == AV_PIX_FMT_RGB24) ? b : r)

◆ WRITE_YUV2RGB_LSX

#define WRITE_YUV2RGB_LSX (   vec_y1,
  vec_y2,
  vec_u,
  vec_v,
  t1,
  t2,
  t3,
  t4 
)
Value:
{ \
Y1 = __lsx_vpickve2gr_w(vec_y1, t1); \
Y2 = __lsx_vpickve2gr_w(vec_y2, t2); \
U = __lsx_vpickve2gr_w(vec_u, t3); \
V = __lsx_vpickve2gr_w(vec_v, t4); \
r = c->table_rV[V]; \
g = (c->table_gU[U] + c->table_gV[V]); \
b = c->table_bU[U]; \
yuv2rgb_write(dest, count, Y1, Y2, 0, 0, \
r, g, b, y, target, 0); \
count++; \
}

Definition at line 136 of file output_lsx.c.

◆ YUV2RGBWRAPPERX

#define YUV2RGBWRAPPERX (   name,
  base,
  ext,
  fmt,
  hasAlpha 
)
Value:
static void name ## ext ## _X_lsx(SwsContext *c, const int16_t *lumFilter, \
const int16_t **lumSrc, int lumFilterSize, \
const int16_t *chrFilter, const int16_t **chrUSrc, \
const int16_t **chrVSrc, int chrFilterSize, \
const int16_t **alpSrc, uint8_t *dest, int dstW, \
int y) \
{ \
name ## base ## _X_template_lsx(c, lumFilter, lumSrc, lumFilterSize, \
chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
alpSrc, dest, dstW, y, fmt, hasAlpha); \
}

Definition at line 735 of file output_lsx.c.

◆ YUV2RGBWRAPPERX2

#define YUV2RGBWRAPPERX2 (   name,
  base,
  ext,
  fmt,
  hasAlpha 
)
Value:
YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
static void name ## ext ## _2_lsx(SwsContext *c, const int16_t *buf[2], \
const int16_t *ubuf[2], const int16_t *vbuf[2], \
const int16_t *abuf[2], uint8_t *dest, int dstW, \
int yalpha, int uvalpha, int y) \
{ \
name ## base ## _2_template_lsx(c, buf, ubuf, vbuf, abuf, dest, \
dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
}

Definition at line 748 of file output_lsx.c.

◆ YUV2RGBWRAPPER

#define YUV2RGBWRAPPER (   name,
  base,
  ext,
  fmt,
  hasAlpha 
)
Value:
YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
static void name ## ext ## _1_lsx(SwsContext *c, const int16_t *buf0, \
const int16_t *ubuf[2], const int16_t *vbuf[2], \
const int16_t *abuf0, uint8_t *dest, int dstW, \
int uvalpha, int y) \
{ \
name ## base ## _1_template_lsx(c, buf0, ubuf, vbuf, abuf0, dest, \
dstW, uvalpha, y, fmt, hasAlpha); \
}

Definition at line 759 of file output_lsx.c.

◆ A_DITHER

#define A_DITHER (   u,
 
)    (((((u)+((v)*236))*119)&0xff))

◆ X_DITHER

#define X_DITHER (   u,
 
)    (((((u)^((v)*237))*181)&0x1ff)/2)

◆ YUVTORGB_SETUP_LSX

#define YUVTORGB_SETUP_LSX
Value:
int y_offset = c->yuv2rgb_y_offset; \
int y_coeff = c->yuv2rgb_y_coeff; \
int v2r_coe = c->yuv2rgb_v2r_coeff; \
int v2g_coe = c->yuv2rgb_v2g_coeff; \
int u2g_coe = c->yuv2rgb_u2g_coeff; \
int u2b_coe = c->yuv2rgb_u2b_coeff; \
__m128i offset = __lsx_vreplgr2vr_w(y_offset); \
__m128i coeff = __lsx_vreplgr2vr_w(y_coeff); \
__m128i v2r = __lsx_vreplgr2vr_w(v2r_coe); \
__m128i v2g = __lsx_vreplgr2vr_w(v2g_coe); \
__m128i u2g = __lsx_vreplgr2vr_w(u2g_coe); \
__m128i u2b = __lsx_vreplgr2vr_w(u2b_coe); \

Definition at line 919 of file output_lsx.c.

◆ YUVTORGB_LSX

#define YUVTORGB_LSX (   y,
  u,
  v,
  R,
  G,
  B,
  offset,
  coeff,
  y_temp,
  v2r,
  v2g,
  u2g,
  u2b 
)
Value:
{ \
y = __lsx_vsub_w(y, offset); \
y = __lsx_vmul_w(y, coeff); \
y = __lsx_vadd_w(y, y_temp); \
R = __lsx_vmadd_w(y, v, v2r); \
v = __lsx_vmadd_w(y, v, v2g); \
G = __lsx_vmadd_w(v, u, u2g); \
B = __lsx_vmadd_w(y, u, u2b); \
}

Definition at line 933 of file output_lsx.c.

◆ WRITE_FULL_A_LSX

#define WRITE_FULL_A_LSX (   r,
  g,
  b,
  a,
  t1,
  s 
)
Value:
{ \
R = __lsx_vpickve2gr_w(r, t1); \
G = __lsx_vpickve2gr_w(g, t1); \
B = __lsx_vpickve2gr_w(b, t1); \
A = __lsx_vpickve2gr_w(a, t1); \
if (A & 0x100) \
A = av_clip_uint8(A); \
yuv2rgb_write_full(c, dest, i + s, R, A, G, B, y, target, hasAlpha, err);\
dest += step; \
}

Definition at line 945 of file output_lsx.c.

◆ WRITE_FULL_LSX

#define WRITE_FULL_LSX (   r,
  g,
  b,
  t1,
  s 
)
Value:
{ \
R = __lsx_vpickve2gr_w(r, t1); \
G = __lsx_vpickve2gr_w(g, t1); \
B = __lsx_vpickve2gr_w(b, t1); \
yuv2rgb_write_full(c, dest, i + s, R, 0, G, B, y, target, hasAlpha, err); \
dest += step; \
}

Definition at line 957 of file output_lsx.c.

Function Documentation

◆ yuv2rgb_write()

static av_always_inline void yuv2rgb_write ( uint8_t *  _dest,
int  i,
int  Y1,
int  Y2,
unsigned  A1,
unsigned  A2,
const void *  _r,
const void *  _g,
const void *  _b,
int  y,
enum AVPixelFormat  target,
int  hasAlpha 
)
static

◆ yuv2rgb_X_template_lsx()

static void yuv2rgb_X_template_lsx ( SwsContext c,
const int16_t *  lumFilter,
const int16_t **  lumSrc,
int  lumFilterSize,
const int16_t *  chrFilter,
const int16_t **  chrUSrc,
const int16_t **  chrVSrc,
int  chrFilterSize,
const int16_t **  alpSrc,
uint8_t *  dest,
int  dstW,
int  y,
enum AVPixelFormat  target,
int  hasAlpha 
)
static

Definition at line 151 of file output_lsx.c.

◆ yuv2rgb_2_template_lsx()

static void yuv2rgb_2_template_lsx ( SwsContext c,
const int16_t *  buf[2],
const int16_t *  ubuf[2],
const int16_t *  vbuf[2],
const int16_t *  abuf[2],
uint8_t *  dest,
int  dstW,
int  yalpha,
int  uvalpha,
int  y,
enum AVPixelFormat  target,
int  hasAlpha 
)
static

Definition at line 479 of file output_lsx.c.

◆ yuv2rgb_1_template_lsx()

static void yuv2rgb_1_template_lsx ( SwsContext c,
const int16_t *  buf0,
const int16_t *  ubuf[2],
const int16_t *  vbuf[2],
const int16_t *  abuf0,
uint8_t *  dest,
int  dstW,
int  uvalpha,
int  y,
enum AVPixelFormat  target,
int  hasAlpha 
)
static

Definition at line 586 of file output_lsx.c.

◆ yuv2rgb_write_full()

static av_always_inline void yuv2rgb_write_full ( SwsContext c,
uint8_t *  dest,
int  i,
int  R,
int  A,
int  G,
int  B,
int  y,
enum AVPixelFormat  target,
int  hasAlpha,
int  err[4] 
)
static

◆ yuv2rgb_full_X_template_lsx()

static void yuv2rgb_full_X_template_lsx ( SwsContext c,
const int16_t *  lumFilter,
const int16_t **  lumSrc,
int  lumFilterSize,
const int16_t *  chrFilter,
const int16_t **  chrUSrc,
const int16_t **  chrVSrc,
int  chrFilterSize,
const int16_t **  alpSrc,
uint8_t *  dest,
int  dstW,
int  y,
enum AVPixelFormat  target,
int  hasAlpha 
)
static

Definition at line 967 of file output_lsx.c.

◆ yuv2rgb_full_2_template_lsx()

static void yuv2rgb_full_2_template_lsx ( SwsContext c,
const int16_t *  buf[2],
const int16_t *  ubuf[2],
const int16_t *  vbuf[2],
const int16_t *  abuf[2],
uint8_t *  dest,
int  dstW,
int  yalpha,
int  uvalpha,
int  y,
enum AVPixelFormat  target,
int  hasAlpha 
)
static

Definition at line 1146 of file output_lsx.c.

◆ yuv2rgb_full_1_template_lsx()

static void yuv2rgb_full_1_template_lsx ( SwsContext c,
const int16_t *  buf0,
const int16_t *  ubuf[2],
const int16_t *  vbuf[2],
const int16_t *  abuf0,
uint8_t *  dest,
int  dstW,
int  uvalpha,
int  y,
enum AVPixelFormat  target,
int  hasAlpha 
)
static

Definition at line 1335 of file output_lsx.c.

◆ ff_sws_init_output_lsx()

av_cold void ff_sws_init_output_lsx ( SwsContext c)

Definition at line 1627 of file output_lsx.c.

Referenced by ff_sws_init_swscale_loongarch().

A
#define A(x)
Definition: vpx_arith.h:28
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
r
const char * r
Definition: vf_curves.c:126
u
#define u(width, name, range_min, range_max)
Definition: cbs_h2645.c:250
step
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
Definition: rate_distortion.txt:58
b
#define b
Definition: input.c:41
R
#define R
Definition: huffyuv.h:44
base
uint8_t base
Definition: vp3data.h:128
t1
#define t1
Definition: regdef.h:29
YUV2RGBWRAPPERX
#define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha)
Definition: output_lsx.c:735
s
#define s(width, name)
Definition: cbs_vp9.c:198
g
const char * g
Definition: vf_curves.c:127
B
#define B
Definition: huffyuv.h:42
V
#define V
Definition: avdct.c:30
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
YUV2RGBWRAPPERX2
#define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha)
Definition: output_lsx.c:748
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
t4
#define t4
Definition: regdef.h:32
t3
#define t3
Definition: regdef.h:31
U
#define U(x)
Definition: vpx_arith.h:37
t2
#define t2
Definition: regdef.h:30
av_clip_uint8
#define av_clip_uint8
Definition: common.h:104
G
#define G
Definition: huffyuv.h:43
coeff
static const double coeff[2][5]
Definition: vf_owdenoise.c:79
SwsContext
Definition: swscale_internal.h:299