FFmpeg
Data Structures | Macros | Functions | Variables
vc1dsp.c File Reference
#include <string.h>
#include "checkasm.h"
#include "libavcodec/vc1dsp.h"
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem_internal.h"

Go to the source code of this file.

Data Structures

struct  test
 
struct  matrix
 

Macros

#define VC1DSP_TEST(func)   { #func, offsetof(VC1DSPContext, func) },
 
#define VC1DSP_SIZED_TEST(func, width, height)   { #func, offsetof(VC1DSPContext, func), width, height },
 
#define ATTENUATION   4
 
#define RANDOMIZE_BUFFER16(name, size)
 
#define RANDOMIZE_BUFFER8(name, size)
 
#define RANDOMIZE_BUFFER8_MID_WEIGHTED(name, size)
 
#define TEST_UNESCAPE
 
#define LOG2_UNESCAPE_BUF_SIZE   17
 
#define UNESCAPE_BUF_SIZE   (1u<<LOG2_UNESCAPE_BUF_SIZE)
 

Functions

static matrixnew_matrix (size_t width, size_t height)
 
static matrixmultiply (const matrix *a, const matrix *b)
 
static void normalise (matrix *a)
 
static void divide_and_round_nearest (matrix *a, float by)
 
static void tweak (matrix *a)
 
static matrixgenerate_inverse_quantized_transform_coefficients (size_t width, size_t height)
 
static void check_inv_trans_inplace (void)
 
static void check_inv_trans_adding (void)
 
static void check_loop_filter (void)
 
static void check_unescape (void)
 
void checkasm_check_vc1dsp (void)
 

Variables

static const matrix T8
 
static const matrix T4
 
static const matrix T8t
 
static const matrix T4t
 

Macro Definition Documentation

◆ VC1DSP_TEST

#define VC1DSP_TEST (   func)    { #func, offsetof(VC1DSPContext, func) },

Definition at line 32 of file vc1dsp.c.

◆ VC1DSP_SIZED_TEST

#define VC1DSP_SIZED_TEST (   func,
  width,
  height 
)    { #func, offsetof(VC1DSPContext, func), width, height },

Definition at line 33 of file vc1dsp.c.

◆ ATTENUATION

#define ATTENUATION   4

Definition at line 163 of file vc1dsp.c.

◆ RANDOMIZE_BUFFER16

#define RANDOMIZE_BUFFER16 (   name,
  size 
)
Value:
do { \
int i; \
for (i = 0; i < size; ++i) { \
uint16_t r = rnd(); \
AV_WN16A(name##0 + i, r); \
AV_WN16A(name##1 + i, r); \
} \
} while (0)

Definition at line 215 of file vc1dsp.c.

◆ RANDOMIZE_BUFFER8

#define RANDOMIZE_BUFFER8 (   name,
  size 
)
Value:
do { \
int i; \
for (i = 0; i < size; ++i) { \
uint8_t r = rnd(); \
name##0[i] = r; \
name##1[i] = r; \
} \
} while (0)

Definition at line 225 of file vc1dsp.c.

◆ RANDOMIZE_BUFFER8_MID_WEIGHTED

#define RANDOMIZE_BUFFER8_MID_WEIGHTED (   name,
  size 
)
Value:
do { \
uint8_t *p##0 = name##0, *p##1 = name##1; \
int i = (size); \
while (i-- > 0) { \
int x = 0x80 | (rnd() & 0x7F); \
x >>= rnd() % 9; \
if (rnd() & 1) \
x = -x; \
*p##1++ = *p##0++ = 0x80 + x; \
} \
} while (0)

Definition at line 235 of file vc1dsp.c.

◆ TEST_UNESCAPE

#define TEST_UNESCAPE
Value:
do { \
for (int count = 100; count > 0; --count) { \
escaped_offset = rnd() & 7; \
unescaped_offset = rnd() & 7; \
escaped_len = (1u << (rnd() % 8) + 3) - (rnd() & 7); \
RANDOMIZE_BUFFER8(unescaped, UNESCAPE_BUF_SIZE); \
len0 = call_ref(escaped0 + escaped_offset, escaped_len, unescaped0 + unescaped_offset); \
len1 = call_new(escaped1 + escaped_offset, escaped_len, unescaped1 + unescaped_offset); \
if (len0 != len1 || memcmp(unescaped0, unescaped1, UNESCAPE_BUF_SIZE)) \
fail(); \
} \
} while (0)

Definition at line 377 of file vc1dsp.c.

◆ LOG2_UNESCAPE_BUF_SIZE

#define LOG2_UNESCAPE_BUF_SIZE   17

◆ UNESCAPE_BUF_SIZE

#define UNESCAPE_BUF_SIZE   (1u<<LOG2_UNESCAPE_BUF_SIZE)

Function Documentation

◆ new_matrix()

static matrix* new_matrix ( size_t  width,
size_t  height 
)
static

Definition at line 84 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients(), and multiply().

◆ multiply()

static matrix* multiply ( const matrix a,
const matrix b 
)
static

Definition at line 96 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients().

◆ normalise()

static void normalise ( matrix a)
static

Definition at line 114 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients().

◆ divide_and_round_nearest()

static void divide_and_round_nearest ( matrix a,
float  by 
)
static

Definition at line 131 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients().

◆ tweak()

static void tweak ( matrix a)
static

Definition at line 140 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients().

◆ generate_inverse_quantized_transform_coefficients()

static matrix* generate_inverse_quantized_transform_coefficients ( size_t  width,
size_t  height 
)
static

Definition at line 165 of file vc1dsp.c.

Referenced by check_inv_trans_adding(), and check_inv_trans_inplace().

◆ check_inv_trans_inplace()

static void check_inv_trans_inplace ( void  )
static

Definition at line 248 of file vc1dsp.c.

Referenced by checkasm_check_vc1dsp().

◆ check_inv_trans_adding()

static void check_inv_trans_adding ( void  )
static

Definition at line 281 of file vc1dsp.c.

Referenced by checkasm_check_vc1dsp().

◆ check_loop_filter()

static void check_loop_filter ( void  )
static

Definition at line 331 of file vc1dsp.c.

Referenced by checkasm_check_vc1dsp().

◆ check_unescape()

static void check_unescape ( void  )
static

Definition at line 391 of file vc1dsp.c.

Referenced by checkasm_check_vc1dsp().

◆ checkasm_check_vc1dsp()

void checkasm_check_vc1dsp ( void  )

Definition at line 441 of file vc1dsp.c.

Variable Documentation

◆ T8

const matrix T8
static
Initial value:
= { 8, 8, {
12, 12, 12, 12, 12, 12, 12, 12,
16, 15, 9, 4, -4, -9, -15, -16,
16, 6, -6, -16, -16, -6, 6, 16,
15, -4, -16, -9, 9, 16, 4, -15,
12, -12, -12, 12, 12, -12, -12, 12,
9, -16, 4, 15, -15, -4, 16, -9,
6, -16, 16, -6, -6, 16, -16, 6,
4, -9, 15, -16, 16, -15, 9, -4
} }

Definition at line 48 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients().

◆ T4

const matrix T4
static
Initial value:
= { 4, 4, {
17, 17, 17, 17,
22, 10, -10, -22,
17, -17, -17, 17,
10, -22, 22, -10
} }

Definition at line 59 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients().

◆ T8t

const matrix T8t
static
Initial value:
= { 8, 8, {
12, 16, 16, 15, 12, 9, 6, 4,
12, 15, 6, -4, -12, -16, -16, -9,
12, 9, -6, -16, -12, 4, 16, 15,
12, 4, -16, -9, 12, 15, -6, -16,
12, -4, -16, 9, 12, -15, -6, 16,
12, -9, -6, 16, -12, -4, 16, -15,
12, -15, 6, 4, -12, 16, -16, 9,
12, -16, 16, -15, 12, -9, 6, -4
} }

Definition at line 66 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients().

◆ T4t

const matrix T4t
static
Initial value:
= { 4, 4, {
17, 22, 17, 10,
17, 10, -17, -22,
17, -10, -17, 22,
17, -22, 17, -10
} }

Definition at line 77 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients().

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
call_ref
#define call_ref(...)
Definition: checkasm.h:140
rnd
#define rnd()
Definition: checkasm.h:118
call_new
#define call_new(...)
Definition: checkasm.h:222
size
int size
Definition: twinvq_data.h:10344
UNESCAPE_BUF_SIZE
#define UNESCAPE_BUF_SIZE
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269