FFmpeg
vf_pp7dsp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at>
3  * Copyright (c) 2014 Arwa Arif <arwaarif1994@gmail.com>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #ifndef AVFILTER_PP7DSP_H
23 #define AVFILTER_PP7DSP_H
24 
25 #include <stdint.h>
26 
27 #include "config.h"
28 
29 typedef struct PP7DSPContext {
30  void (*dctB)(int16_t *restrict dst, const int16_t *restrict src);
32 
33 void ff_pp7dsp_init_x86(PP7DSPContext *pp7dsp);
34 
35 static void dctB_c(int16_t *restrict dst, const int16_t *restrict src)
36 {
37  for (int i = 0; i < 4; i++) {
38  int s0 = src[0 * 4] + src[6 * 4];
39  int s1 = src[1 * 4] + src[5 * 4];
40  int s2 = src[2 * 4] + src[4 * 4];
41  int s3 = src[3 * 4];
42  int s = s3 + s3;
43  s3 = s - s0;
44  s0 = s + s0;
45  s = s2 + s1;
46  s2 = s2 - s1;
47  dst[0 * 4] = s0 + s;
48  dst[2 * 4] = s0 - s;
49  dst[1 * 4] = 2 * s3 + s2;
50  dst[3 * 4] = s3 - 2 * s2;
51  src++;
52  dst++;
53  }
54 }
55 
56 static inline void ff_pp7dsp_init(PP7DSPContext *pp7dsp)
57 {
58  pp7dsp->dctB = dctB_c;
59 
60 #if ARCH_X86 && HAVE_X86ASM
61  ff_pp7dsp_init_x86(pp7dsp);
62 #endif
63 }
64 
65 #endif /* AVFILTER_PP7DSP_H */
ff_pp7dsp_init
static void ff_pp7dsp_init(PP7DSPContext *pp7dsp)
Definition: vf_pp7dsp.h:56
PP7DSPContext::dctB
void(* dctB)(int16_t *restrict dst, const int16_t *restrict src)
Definition: vf_pp7dsp.h:30
s
#define s(width, name)
Definition: cbs_vp9.c:198
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
PP7DSPContext
Definition: vf_pp7dsp.h:29
ff_pp7dsp_init_x86
void ff_pp7dsp_init_x86(PP7DSPContext *pp7dsp)
Definition: vf_pp7_init.c:28
dctB_c
static void dctB_c(int16_t *restrict dst, const int16_t *restrict src)
Definition: vf_pp7dsp.h:35
src
#define src
Definition: vp8dsp.c:248