FFmpeg
Loading...
Searching...
No Matches
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.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)
 
#define VC1DSP_SIZED_TEST(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)
 
#define MSPEL_TEST(elem)
 

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)
 
static void check_mspel_pixels (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)
Value:
{ #func, offsetof(VC1DSPContext, func) },
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition jacosubdec.c:66

Definition at line 33 of file vc1dsp.c.

Referenced by check_loop_filter().

◆ VC1DSP_SIZED_TEST

#define VC1DSP_SIZED_TEST ( func,
width,
height )
Value:
{ #func, offsetof(VC1DSPContext, func), width, height },
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89

Definition at line 34 of file vc1dsp.c.

Referenced by check_inv_trans_adding().

◆ ATTENUATION

#define ATTENUATION   4

Definition at line 164 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients().

◆ 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)
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define rnd
Definition checkasm.h:135
#define r
Definition input.c:42
const char * name
Definition qsvenc.c:142
int size

Definition at line 216 of file vc1dsp.c.

Referenced by check_inv_trans_adding(), and check_inv_trans_inplace().

◆ 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 226 of file vc1dsp.c.

Referenced by check_inv_trans_adding(), check_mspel_pixels(), and check_unescape().

◆ 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 236 of file vc1dsp.c.

Referenced by check_loop_filter().

◆ 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)
#define call_new
Definition test.h:486
#define call_ref
Definition test.h:485
#define UNESCAPE_BUF_SIZE

Definition at line 378 of file vc1dsp.c.

Referenced by check_unescape().

◆ LOG2_UNESCAPE_BUF_SIZE

#define LOG2_UNESCAPE_BUF_SIZE   17

◆ UNESCAPE_BUF_SIZE

#define UNESCAPE_BUF_SIZE   (1u<<LOG2_UNESCAPE_BUF_SIZE)

Referenced by check_unescape().

◆ MSPEL_TEST

#define MSPEL_TEST ( elem)
Value:
{ .name = #elem, offsetof(VC1DSPContext, elem) }

Referenced by check_mspel_pixels().

Function Documentation

◆ new_matrix()

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

Definition at line 85 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 97 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients().

◆ normalise()

static void normalise ( matrix * a)
static

Definition at line 115 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 132 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients().

◆ tweak()

static void tweak ( matrix * a)
static

Definition at line 141 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

◆ check_inv_trans_inplace()

static void check_inv_trans_inplace ( void )
static

Definition at line 249 of file vc1dsp.c.

Referenced by checkasm_check_vc1dsp().

◆ check_inv_trans_adding()

static void check_inv_trans_adding ( void )
static

Definition at line 282 of file vc1dsp.c.

Referenced by checkasm_check_vc1dsp().

◆ check_loop_filter()

static void check_loop_filter ( void )
static

Definition at line 332 of file vc1dsp.c.

Referenced by checkasm_check_vc1dsp().

◆ check_unescape()

static void check_unescape ( void )
static

Definition at line 392 of file vc1dsp.c.

Referenced by checkasm_check_vc1dsp().

◆ check_mspel_pixels()

static void check_mspel_pixels ( void )
static

BUF_SIZE is bigger than necessary in order to test strides > block width.

Due to qpel interpolation the input needs one extra line at the top and two at the bottom; horizontal interpolation also needs one pixel to the left and two to the right. At least the x86 implementation actually accesses three pixels to the right. The input is not subject to alignment requirements; making the input buffer bigger (by MAX_BLOCK_SIZE - 1) allows us to use a random misalignment.

Definition at line 442 of file vc1dsp.c.

Referenced by checkasm_check_vc1dsp().

◆ checkasm_check_vc1dsp()

void checkasm_check_vc1dsp ( void )

Definition at line 518 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 49 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 60 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 67 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 78 of file vc1dsp.c.

Referenced by generate_inverse_quantized_transform_coefficients().