FFmpeg
Macros | Functions | Variables
h264dsp.c File Reference
#include <string.h>
#include "checkasm.h"
#include "libavcodec/h264dsp.h"
#include "libavcodec/h264data.h"
#include "libavcodec/h264_parse.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem_internal.h"

Go to the source code of this file.

Macros

#define SIZEOF_PIXEL   ((bit_depth + 7) / 8)
 
#define SIZEOF_COEF   (2 * ((bit_depth + 7) / 8))
 
#define PIXEL_STRIDE   16
 
#define randomize_buffers()
 
#define dct4x4_impl(size, dctcoef)
 
#define DCT8_1D(src, srcstride, dst, dststride)
 
#define dct8x8_impl(size, dctcoef)
 
#define CHECK_LOOP_FILTER(name, align, idc)
 
#define CHECK_LOOP_FILTER(name, align, idc)
 

Functions

 dct4x4_impl (16, int16_t)
 
static void dct8x8 (int16_t *coef, int bit_depth)
 
static void check_idct (void)
 
static void check_idct_multiple (void)
 
static void check_loop_filter (void)
 
static void check_loop_filter_intra (void)
 
void checkasm_check_h264dsp (void)
 

Variables

static const uint32_t pixel_mask [3] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff }
 
static const uint32_t pixel_mask_lf [3] = { 0xff0fff0f, 0x01ff000f, 0x03ff000f }
 

Macro Definition Documentation

◆ SIZEOF_PIXEL

#define SIZEOF_PIXEL   ((bit_depth + 7) / 8)

Definition at line 33 of file h264dsp.c.

◆ SIZEOF_COEF

#define SIZEOF_COEF   (2 * ((bit_depth + 7) / 8))

Definition at line 34 of file h264dsp.c.

◆ PIXEL_STRIDE

#define PIXEL_STRIDE   16

Definition at line 35 of file h264dsp.c.

◆ randomize_buffers

#define randomize_buffers ( )
Value:
do { \
int x, y; \
uint32_t mask = pixel_mask[bit_depth - 8]; \
for (y = 0; y < sz; y++) { \
for (x = 0; x < PIXEL_STRIDE; x += 4) { \
AV_WN32A(src + y * PIXEL_STRIDE + x, rnd() & mask); \
AV_WN32A(dst + y * PIXEL_STRIDE + x, rnd() & mask); \
} \
for (x = 0; x < sz; x++) { \
if (bit_depth == 8) { \
coef[y * sz + x] = src[y * PIXEL_STRIDE + x] - \
dst[y * PIXEL_STRIDE + x]; \
} else { \
((int32_t *)coef)[y * sz + x] = \
((uint16_t *)src)[y * (PIXEL_STRIDE/2) + x] - \
((uint16_t *)dst)[y * (PIXEL_STRIDE/2) + x]; \
} \
} \
} \
} while (0)

Definition at line 37 of file h264dsp.c.

◆ dct4x4_impl

#define dct4x4_impl (   size,
  dctcoef 
)

Definition at line 59 of file h264dsp.c.

◆ DCT8_1D

#define DCT8_1D (   src,
  srcstride,
  dst,
  dststride 
)
Value:
do { \
const int a0 = (src)[srcstride * 0] + (src)[srcstride * 7]; \
const int a1 = (src)[srcstride * 0] - (src)[srcstride * 7]; \
const int a2 = (src)[srcstride * 1] + (src)[srcstride * 6]; \
const int a3 = (src)[srcstride * 1] - (src)[srcstride * 6]; \
const int a4 = (src)[srcstride * 2] + (src)[srcstride * 5]; \
const int a5 = (src)[srcstride * 2] - (src)[srcstride * 5]; \
const int a6 = (src)[srcstride * 3] + (src)[srcstride * 4]; \
const int a7 = (src)[srcstride * 3] - (src)[srcstride * 4]; \
const int b0 = a0 + a6; \
const int b1 = a2 + a4; \
const int b2 = a0 - a6; \
const int b3 = a2 - a4; \
const int b4 = a3 + a5 + (a1 + (a1 >> 1)); \
const int b5 = a1 - a7 - (a5 + (a5 >> 1)); \
const int b6 = a1 + a7 - (a3 + (a3 >> 1)); \
const int b7 = a3 - a5 + (a7 + (a7 >> 1)); \
(dst)[dststride * 0] = b0 + b1; \
(dst)[dststride * 1] = b4 + (b7 >> 2); \
(dst)[dststride * 2] = b2 + (b3 >> 1); \
(dst)[dststride * 3] = b5 + (b6 >> 2); \
(dst)[dststride * 4] = b0 - b1; \
(dst)[dststride * 5] = b6 - (b5 >> 2); \
(dst)[dststride * 6] = (b2 >> 1) - b3; \
(dst)[dststride * 7] = (b4 >> 2) - b7; \
} while (0)

Definition at line 93 of file h264dsp.c.

◆ dct8x8_impl

#define dct8x8_impl (   size,
  dctcoef 
)
Value:
static void dct8x8_##size(dctcoef *coef) \
{ \
int i, x, y; \
dctcoef tmp[64]; \
for (i = 0; i < 8; i++) \
DCT8_1D(coef + i, 8, tmp + i, 8); \
for (i = 0; i < 8; i++) \
DCT8_1D(tmp + 8*i, 1, coef + i, 8); \
for (y = 0; y < 8; y++) { \
for (x = 0; x < 8; x++) { \
static const int scale[] = { \
13107 * 20, 11428 * 18, 20972 * 32, \
12222 * 19, 16777 * 25, 15481 * 24, \
}; \
static const int idxmap[] = { \
0, 3, 4, 3, \
3, 1, 5, 1, \
4, 5, 2, 5, \
3, 1, 5, 1, \
}; \
const int idx = idxmap[(y & 3) * 4 + (x & 3)]; \
coef[y*8 + x] = ((int64_t)coef[y*8 + x] * \
scale[idx] + (1 << 17)) >> 18; \
} \
} \
}

Definition at line 120 of file h264dsp.c.

◆ CHECK_LOOP_FILTER [1/2]

#define CHECK_LOOP_FILTER (   name,
  align,
  idc 
)
Value:
do { \
if (check_func(h.name, #name #idc "_%dbpp", bit_depth)) { \
for (j = 0; j < 36; j++) { \
intptr_t off = 8 * 32 + (j & 15) * 4 * !align; \
for (i = 0; i < 1024; i+=4) { \
AV_WN32A(dst + i, rnd() & mask); \
} \
memcpy(dst0, dst, 32 * 16 * 2); \
memcpy(dst1, dst, 32 * 16 * 2); \
call_ref(dst0 + off, 32, alphas[j], betas[j], tc0[j]); \
call_new(dst1 + off, 32, alphas[j], betas[j], tc0[j]); \
if (memcmp(dst0, dst1, 32 * 16 * SIZEOF_PIXEL)) { \
fprintf(stderr, #name #idc ": j:%d, alpha:%d beta:%d " \
"tc0:{%d,%d,%d,%d}\n", j, alphas[j], betas[j], \
tc0[j][0], tc0[j][1], tc0[j][2], tc0[j][3]); \
fail(); \
} \
bench_new(dst1, 32, alphas[j], betas[j], tc0[j]); \
} \
} \
} while (0)

◆ CHECK_LOOP_FILTER [2/2]

#define CHECK_LOOP_FILTER (   name,
  align,
  idc 
)
Value:
do { \
if (check_func(h.name, #name #idc "_%dbpp", bit_depth)) { \
for (j = 0; j < 36; j++) { \
intptr_t off = 8 * 32 + (j & 15) * 4 * !align; \
for (i = 0; i < 1024; i+=4) { \
AV_WN32A(dst + i, rnd() & mask); \
} \
memcpy(dst0, dst, 32 * 16 * 2); \
memcpy(dst1, dst, 32 * 16 * 2); \
call_ref(dst0 + off, 32, alphas[j], betas[j]); \
call_new(dst1 + off, 32, alphas[j], betas[j]); \
if (memcmp(dst0, dst1, 32 * 16 * SIZEOF_PIXEL)) { \
fprintf(stderr, #name #idc ": j:%d, alpha:%d beta:%d\n", \
j, alphas[j], betas[j]); \
fail(); \
} \
bench_new(dst1, 32, alphas[j], betas[j]); \
} \
} \
} while (0)

Function Documentation

◆ dct4x4_impl()

dct4x4_impl ( 16  ,
int16_t   
)

Definition at line 150 of file h264dsp.c.

◆ dct8x8()

static void dct8x8 ( int16_t *  coef,
int  bit_depth 
)
static

Definition at line 164 of file h264dsp.c.

Referenced by check_idct(), and check_idct_multiple().

◆ check_idct()

static void check_idct ( void  )
static

Definition at line 174 of file h264dsp.c.

Referenced by checkasm_check_h264dsp().

◆ check_idct_multiple()

static void check_idct_multiple ( void  )
static

Definition at line 230 of file h264dsp.c.

Referenced by checkasm_check_h264dsp().

◆ check_loop_filter()

static void check_loop_filter ( void  )
static

Definition at line 317 of file h264dsp.c.

Referenced by checkasm_check_h264dsp().

◆ check_loop_filter_intra()

static void check_loop_filter_intra ( void  )
static

Definition at line 382 of file h264dsp.c.

Referenced by checkasm_check_h264dsp().

◆ checkasm_check_h264dsp()

void checkasm_check_h264dsp ( void  )

Definition at line 441 of file h264dsp.c.

Variable Documentation

◆ pixel_mask

const uint32_t pixel_mask[3] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff }
static

Definition at line 30 of file h264dsp.c.

◆ pixel_mask_lf

const uint32_t pixel_mask_lf[3] = { 0xff0fff0f, 0x01ff000f, 0x03ff000f }
static

Definition at line 31 of file h264dsp.c.

Referenced by check_loop_filter(), and check_loop_filter_intra().

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
int64_t
long long int64_t
Definition: coverity.c:34
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:28
SIZEOF_PIXEL
#define SIZEOF_PIXEL
Definition: h264dsp.c:33
check_func
#define check_func(func,...)
Definition: checkasm.h:170
call_ref
#define call_ref(...)
Definition: checkasm.h:185
bit_depth
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
Definition: af_astats.c:245
b1
static double b1(void *priv, double x, double y)
Definition: vf_xfade.c:2035
dctcoef
#define dctcoef
Definition: bit_depth_template.c:84
a1
#define a1
Definition: regdef.h:47
rnd
#define rnd()
Definition: checkasm.h:163
mask
static const uint16_t mask[17]
Definition: lzw.c:38
b3
static double b3(void *priv, double x, double y)
Definition: vf_xfade.c:2037
a4
#define a4
Definition: regdef.h:50
pixel_mask
static const uint32_t pixel_mask[3]
Definition: h264dsp.c:30
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: vvc_intra.c:291
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
size
int size
Definition: twinvq_data.h:10344
align
static const uint8_t *BS_FUNC() align(BSCTX *bc)
Skip bits to a byte boundary.
Definition: bitstream_template.h:411
b2
static double b2(void *priv, double x, double y)
Definition: vf_xfade.c:2036
a0
#define a0
Definition: regdef.h:46
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
PIXEL_STRIDE
#define PIXEL_STRIDE
Definition: h264dsp.c:35
a2
#define a2
Definition: regdef.h:48
a5
#define a5
Definition: regdef.h:51
DCT8_1D
#define DCT8_1D(src, srcstride, dst, dststride)
Definition: h264dsp.c:93
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
int32_t
int32_t
Definition: audioconvert.c:56
b0
static double b0(void *priv, double x, double y)
Definition: vf_xfade.c:2034
h
h
Definition: vp9dsp_template.c:2038
a3
#define a3
Definition: regdef.h:49