FFmpeg
Macros | Functions | Variables
h264dsp.c File Reference
#include <string.h>
#include "checkasm.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/h264dsp.h"
#include "libavcodec/h264data.h"
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.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

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

Definition at line 33 of file h264dsp.c.

Referenced by check_idct(), and check_idct_multiple().

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

Definition at line 34 of file h264dsp.c.

Referenced by check_idct(), and check_idct_multiple().

#define PIXEL_STRIDE   16

Definition at line 35 of file h264dsp.c.

Referenced by check_idct(), and check_idct_multiple().

#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)
#define src
Definition: vp8dsp.c:254
#define AV_WN32A(p, v)
Definition: intreadwrite.h:538
static const uint32_t pixel_mask[3]
Definition: h264dsp.c:30
static const uint16_t mask[17]
Definition: lzw.c:38
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
Definition: af_astats.c:226
int32_t
if(ret)
#define PIXEL_STRIDE
Definition: h264dsp.c:35
int
#define rnd()
Definition: checkasm.h:106
for(j=16;j >0;--j)

Definition at line 37 of file h264dsp.c.

Referenced by check_idct(), and check_idct_multiple().

#define dct4x4_impl (   size,
  dctcoef 
)

Definition at line 59 of file h264dsp.c.

#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)
#define a0
Definition: regdef.h:46
#define a1
Definition: regdef.h:47
#define src
Definition: vp8dsp.c:254
#define a3
Definition: regdef.h:49
#define a2
Definition: regdef.h:48
#define a5
Definition: regdef.h:51
#define a4
Definition: regdef.h:50

Definition at line 93 of file h264dsp.c.

Referenced by dct_sad8x8_c().

#define dct8x8_impl (   size,
  dctcoef 
)
Value:
static void dct8x8_##size(dctcoef *coef) \
{ \
int i, x, y; \
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; \
} \
} \
}
ptrdiff_t size
Definition: opengl_enc.c:100
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
#define dctcoef
#define DCT8_1D(src, srcstride, dst, dststride)
Definition: h264dsp.c:93
int
for(j=16;j >0;--j)
static uint8_t tmp[11]
Definition: aes_ctr.c:26

Definition at line 120 of file h264dsp.c.

#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)
#define AV_WN32A(p, v)
Definition: intreadwrite.h:538
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
static const uint16_t mask[17]
Definition: lzw.c:38
#define fail()
Definition: checkasm.h:122
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
Definition: af_astats.c:226
if(ret)
#define call_ref(...)
Definition: checkasm.h:128
const AVS_VideoInfo int align
Definition: avisynth_c.h:887
#define SIZEOF_PIXEL
Definition: h264dsp.c:33
#define check_func(func,...)
Definition: checkasm.h:113
#define rnd()
Definition: checkasm.h:106
#define bench_new(...)
Definition: checkasm.h:255
#define call_new(...)
Definition: checkasm.h:195
for(j=16;j >0;--j)
const char * name
Definition: opengl_enc.c:102

Referenced by check_loop_filter(), and check_loop_filter_intra().

#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)
#define AV_WN32A(p, v)
Definition: intreadwrite.h:538
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
static const uint16_t mask[17]
Definition: lzw.c:38
#define fail()
Definition: checkasm.h:122
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
Definition: af_astats.c:226
if(ret)
#define call_ref(...)
Definition: checkasm.h:128
const AVS_VideoInfo int align
Definition: avisynth_c.h:887
#define SIZEOF_PIXEL
Definition: h264dsp.c:33
#define check_func(func,...)
Definition: checkasm.h:113
#define rnd()
Definition: checkasm.h:106
#define bench_new(...)
Definition: checkasm.h:255
#define call_new(...)
Definition: checkasm.h:195
for(j=16;j >0;--j)
const char * name
Definition: opengl_enc.c:102

Function Documentation

dct4x4_impl ( 16  ,
int16_t   
)

Definition at line 150 of file h264dsp.c.

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().

static void check_idct ( void  )
static

Definition at line 174 of file h264dsp.c.

Referenced by checkasm_check_h264dsp().

static void check_idct_multiple ( void  )
static

Definition at line 230 of file h264dsp.c.

Referenced by checkasm_check_h264dsp().

static void check_loop_filter ( void  )
static

Definition at line 317 of file h264dsp.c.

Referenced by checkasm_check_h264dsp().

static void check_loop_filter_intra ( void  )
static

Definition at line 382 of file h264dsp.c.

Referenced by checkasm_check_h264dsp().

void checkasm_check_h264dsp ( void  )

Definition at line 441 of file h264dsp.c.

Variable Documentation

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

Definition at line 30 of file h264dsp.c.

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().