FFmpeg
Macros | Functions
output_lasx.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(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 YUV2RGB_SETUP
 
#define YUV2RGB(y, u, v, R, G, B, offset, coeff, y_temp, v2r, v2g, u2g, u2b)
 
#define WRITE_FULL_A(r, g, b, a, t1, s)
 
#define WRITE_FULL(r, g, b, t1, s)
 

Functions

void ff_yuv2planeX_8_lasx (const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
 
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_lasx (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_lasx (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_lasx (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_lasx (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_lasx (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_lasx (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_loongarch (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

#define WRITE_YUV2RGB (   vec_y1,
  vec_y2,
  vec_u,
  vec_v,
  t1,
  t2,
  t3,
  t4 
)
Value:
{ \
Y1 = __lasx_xvpickve2gr_w(vec_y1, t1); \
Y2 = __lasx_xvpickve2gr_w(vec_y2, t2); \
U = __lasx_xvpickve2gr_w(vec_u, t3); \
V = __lasx_xvpickve2gr_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 215 of file output_lasx.c.

◆ YUV2RGBWRAPPERX

#define YUV2RGBWRAPPERX (   name,
  base,
  ext,
  fmt,
  hasAlpha 
)
Value:
static void name ## ext ## _X_lasx(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_lasx(c, lumFilter, lumSrc, lumFilterSize, \
chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
alpSrc, dest, dstW, y, fmt, hasAlpha); \
}

Definition at line 784 of file output_lasx.c.

◆ YUV2RGBWRAPPERX2

#define YUV2RGBWRAPPERX2 (   name,
  base,
  ext,
  fmt,
  hasAlpha 
)
Value:
YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
static void name ## ext ## _2_lasx(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_lasx(c, buf, ubuf, vbuf, abuf, dest, \
dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
}

Definition at line 797 of file output_lasx.c.

◆ YUV2RGBWRAPPER

#define YUV2RGBWRAPPER (   name,
  base,
  ext,
  fmt,
  hasAlpha 
)
Value:
YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
static void name ## ext ## _1_lasx(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_lasx(c, buf0, ubuf, vbuf, abuf0, dest, \
dstW, uvalpha, y, fmt, hasAlpha); \
}

Definition at line 808 of file output_lasx.c.

◆ A_DITHER

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

◆ X_DITHER

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

◆ YUV2RGB_SETUP

#define YUV2RGB_SETUP
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; \
__m256i offset = __lasx_xvreplgr2vr_w(y_offset); \
__m256i coeff = __lasx_xvreplgr2vr_w(y_coeff); \
__m256i v2r = __lasx_xvreplgr2vr_w(v2r_coe); \
__m256i v2g = __lasx_xvreplgr2vr_w(v2g_coe); \
__m256i u2g = __lasx_xvreplgr2vr_w(u2g_coe); \
__m256i u2b = __lasx_xvreplgr2vr_w(u2b_coe); \

Definition at line 969 of file output_lasx.c.

◆ YUV2RGB

#define YUV2RGB (   y,
  u,
  v,
  R,
  G,
  B,
  offset,
  coeff,
  y_temp,
  v2r,
  v2g,
  u2g,
  u2b 
)
Value:
{ \
y = __lasx_xvsub_w(y, offset); \
y = __lasx_xvmul_w(y, coeff); \
y = __lasx_xvadd_w(y, y_temp); \
R = __lasx_xvmadd_w(y, v, v2r); \
v = __lasx_xvmadd_w(y, v, v2g); \
G = __lasx_xvmadd_w(v, u, u2g); \
B = __lasx_xvmadd_w(y, u, u2b); \
}

Definition at line 984 of file output_lasx.c.

◆ WRITE_FULL_A

#define WRITE_FULL_A (   r,
  g,
  b,
  a,
  t1,
  s 
)
Value:
{ \
R = __lasx_xvpickve2gr_w(r, t1); \
G = __lasx_xvpickve2gr_w(g, t1); \
B = __lasx_xvpickve2gr_w(b, t1); \
A = __lasx_xvpickve2gr_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 996 of file output_lasx.c.

◆ WRITE_FULL

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

Definition at line 1008 of file output_lasx.c.

Function Documentation

◆ ff_yuv2planeX_8_lasx()

void ff_yuv2planeX_8_lasx ( const int16_t *  filter,
int  filterSize,
const int16_t **  src,
uint8_t *  dest,
int  dstW,
const uint8_t *  dither,
int  offset 
)

Definition at line 25 of file output_lasx.c.

Referenced by ff_sws_init_swscale_loongarch().

◆ 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_lasx()

static void yuv2rgb_X_template_lasx ( 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 230 of file output_lasx.c.

◆ yuv2rgb_2_template_lasx()

static void yuv2rgb_2_template_lasx ( 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 518 of file output_lasx.c.

◆ yuv2rgb_1_template_lasx()

static void yuv2rgb_1_template_lasx ( 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 628 of file output_lasx.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_lasx()

static void yuv2rgb_full_X_template_lasx ( 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 1018 of file output_lasx.c.

◆ yuv2rgb_full_2_template_lasx()

static void yuv2rgb_full_2_template_lasx ( 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 1225 of file output_lasx.c.

◆ yuv2rgb_full_1_template_lasx()

static void yuv2rgb_full_1_template_lasx ( 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 1438 of file output_lasx.c.

◆ ff_sws_init_output_loongarch()

av_cold void ff_sws_init_output_loongarch ( SwsContext c)

Definition at line 1780 of file output_lasx.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:262
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
s
#define s(width, name)
Definition: cbs_vp9.c:256
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
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
t4
#define t4
Definition: regdef.h:32
t3
#define t3
Definition: regdef.h:31
YUV2RGBWRAPPERX
#define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha)
Definition: output_lasx.c:784
YUV2RGBWRAPPERX2
#define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha)
Definition: output_lasx.c:797
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:101
G
#define G
Definition: huffyuv.h:43
coeff
static const double coeff[2][5]
Definition: vf_owdenoise.c:78
SwsContext
Definition: swscale_internal.h:299