FFmpeg
Loading...
Searching...
No Matches
h264chroma.c
Go to the documentation of this file.
1/*
2 * Copyright (c) Lynne
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <string.h>
22#include <stdint.h>
23#include "checkasm.h"
27
28#define SIZEOF_PIXEL ((bit_depth + 7) / 8)
29
30#define randomize_buffers(bit_depth) \
31 do { \
32 if (bit_depth == 8) { \
33 for (int i = 0; i < 16*18; i++) \
34 src[i] = rnd(); \
35 } else { \
36 unsigned mask = (1 << bit_depth) - 1;\
37 for (int i = 0; i < 16*18*2; i += 2) \
38 AV_WN16A(&src[i], rnd() & mask); \
39 } \
40 } while (0)
41
42static void check_chroma_mc(void)
43{
45 DECLARE_ALIGNED_4(uint8_t, src) [16 * 18 * 2];
46 DECLARE_ALIGNED_16(uint8_t, dst0)[16 * 18 * 2];
47 DECLARE_ALIGNED_16(uint8_t, dst1)[16 * 18 * 2];
48
49 declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, const uint8_t *src,
50 ptrdiff_t stride, int h, int x, int y);
51
52 for (int bit_depth = 8; bit_depth <= 10; bit_depth++) {
55 for (int size = 0; size < 3; size++) {
56 int block_size = 8 >> size;
57
58#define CHECK_CHROMA_MC(name) \
59 do { \
60 if (check_func(h.name## _pixels_tab[size], #name "_mc%d_%d", 1 << (3-size), bit_depth)) { \
61 for (int x = 0; x < 2; x++) { \
62 for (int y = 0; y < 2; y++) { \
63 memcpy(dst0, src, 16 * 18 * SIZEOF_PIXEL); \
64 memcpy(dst1, src, 16 * 18 * SIZEOF_PIXEL); \
65 call_ref(dst0, src, 16 * SIZEOF_PIXEL, block_size, x, y); \
66 call_new(dst1, src, 16 * SIZEOF_PIXEL, block_size, x, y); \
67 if (memcmp(dst0, dst1, 16 * 16 * SIZEOF_PIXEL)) { \
68 fprintf(stderr, #name "_%d: x:%i, y:%i\n", bit_depth, x, y); \
69 fail(); \
70 } \
71 bench_new(dst1, src, 16 * SIZEOF_PIXEL, block_size, x, y); \
72 } \
73 } \
74 } \
75 } while (0)
76
77 CHECK_CHROMA_MC(put_h264_chroma);
78 CHECK_CHROMA_MC(avg_h264_chroma);
79 }
80 }
81}
82
84{
86 report("chroma_mc");
87}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
Definition af_astats.c:246
#define report
Definition test.h:480
#define declare_func_emms
Definition test.h:490
av_cold void ff_h264chroma_init(H264ChromaContext *c, int bit_depth)
Definition h264chroma.c:43
#define AV_CPU_FLAG_MMX
standard MMX
Definition cpu.h:32
#define DECLARE_ALIGNED_4(t, v)
#define DECLARE_ALIGNED_16(t, v)
#define stride
void checkasm_check_h264chroma(void)
Definition h264chroma.c:83
static void check_chroma_mc(void)
Definition h264chroma.c:42
#define CHECK_CHROMA_MC(name)
#define randomize_buffers(bit_depth)
Definition h264chroma.c:30
#define src
Definition vp8dsp.c:248
int size