FFmpeg
vf_fspp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
3  * Copyright (C) 2005 Nikolaj Poroshin <porosh3@psu.ru>
4  * Copyright (c) 2014 Arwa Arif <arwaarif1994@gmail.com>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #ifndef AVFILTER_FSPP_H
24 #define AVFILTER_FSPP_H
25 
27 #include "avfilter.h"
28 
29 #define BLOCKSZ 12
30 #define MAX_LEVEL 5
31 
32 #define DCTSIZE 8
33 #define DCTSIZE_S "8"
34 
35 #define FIX(x,s) ((x) * (1 << s) + 0.5)
36 
37 #define MULTIPLY16H(x,k) (((x) * (k)) >> 16)
38 #define THRESHOLD(r,x,t) \
39  if(((unsigned)((x) + t)) > t * 2) r = (x); \
40  else r = 0;
41 #define DESCALE(x,n) (((x) + (1 << ((n) - 1))) >> n)
42 
44 static const int16_t FIX_0_382683433 = FIX(0.382683433, 14);
45 static const int16_t FIX_0_541196100 = FIX(0.541196100, 14);
46 static const int16_t FIX_0_707106781 = FIX(M_SQRT1_2 , 14);
47 static const int16_t FIX_1_306562965 = FIX(1.306562965, 14);
48 static const int16_t FIX_1_414213562_A = FIX(M_SQRT2 , 14);
49 static const int16_t FIX_1_847759065 = FIX(1.847759065, 13);
50 static const int16_t FIX_2_613125930 = FIX(-2.613125930, 13);
51 static const int16_t FIX_1_414213562 = FIX(M_SQRT2 , 13);
52 static const int16_t FIX_1_082392200 = FIX(1.082392200, 13);
53 
54 typedef struct FSPPContext {
55  AVClass *class;
56  uint64_t threshold_mtx_noq[8 * 2];
57  uint64_t threshold_mtx[8 * 2]; //used in both C & MMX (& later SSE2) versions
58 
60  int strength;
61  int hsub;
62  int vsub;
64  int qp;
66  int prev_q;
67  uint8_t *src;
68  int16_t *temp;
69  int8_t *non_b_qp_table;
72 
73  void (*store_slice)(uint8_t *dst, int16_t *src,
74  ptrdiff_t dst_stride, ptrdiff_t src_stride,
75  ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale);
76 
77  void (*store_slice2)(uint8_t *dst, int16_t *src,
78  ptrdiff_t dst_stride, ptrdiff_t src_stride,
79  ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale);
80 
81  void (*mul_thrmat)(int16_t *thr_adr_noq, int16_t *thr_adr, int q);
82 
83  void (*column_fidct)(int16_t *thr_adr, int16_t *data,
84  int16_t *output, int cnt);
85 
86  void (*row_idct)(int16_t *workspace, int16_t *output_adr,
87  ptrdiff_t output_stride, int cnt);
88 
89  void (*row_fdct)(int16_t *data, const uint8_t *pixels,
90  ptrdiff_t line_size, int cnt);
91 
92 } FSPPContext;
93 
94 void ff_fspp_init_x86(FSPPContext *fspp);
95 
96 #endif /* AVFILTER_FSPP_H */
FIX_2_613125930
static const int16_t FIX_2_613125930
Definition: vf_fspp.h:50
FSPPContext::column_fidct
void(* column_fidct)(int16_t *thr_adr, int16_t *data, int16_t *output, int cnt)
Definition: vf_fspp.h:83
FSPPContext::hsub
int hsub
Definition: vf_fspp.h:61
FSPPContext::threshold_mtx_noq
uint64_t threshold_mtx_noq[8 *2]
Definition: vf_fspp.h:56
FIX_1_082392200
static const int16_t FIX_1_082392200
Definition: vf_fspp.h:52
output
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
Definition: filter_design.txt:225
FSPPContext::store_slice
void(* store_slice)(uint8_t *dst, int16_t *src, ptrdiff_t dst_stride, ptrdiff_t src_stride, ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale)
Definition: vf_fspp.h:73
FSPPContext::vsub
int vsub
Definition: vf_fspp.h:62
data
const char data[16]
Definition: mxf.c:148
FIX_1_847759065
static const int16_t FIX_1_847759065
Definition: vf_fspp.h:49
FSPPContext::src
uint8_t * src
Definition: vf_fspp.h:67
FSPPContext::row_idct
void(* row_idct)(int16_t *workspace, int16_t *output_adr, ptrdiff_t output_stride, int cnt)
Definition: vf_fspp.h:86
FSPPContext::qscale_type
enum AVVideoEncParamsType qscale_type
Definition: vf_fspp.h:65
AVVideoEncParamsType
AVVideoEncParamsType
Definition: video_enc_params.h:28
width
#define width
FSPPContext::row_fdct
void(* row_fdct)(int16_t *data, const uint8_t *pixels, ptrdiff_t line_size, int cnt)
Definition: vf_fspp.h:89
FSPPContext::non_b_qp_table
int8_t * non_b_qp_table
Definition: vf_fspp.h:69
FSPPContext::non_b_qp_stride
int non_b_qp_stride
Definition: vf_fspp.h:70
FSPPContext::log2_count
int log2_count
Definition: vf_fspp.h:59
FIX_1_414213562
static const int16_t FIX_1_414213562
Definition: vf_fspp.h:51
FIX
#define FIX(x, s)
Definition: vf_fspp.h:35
FIX_1_306562965
static const int16_t FIX_1_306562965
Definition: vf_fspp.h:47
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
FSPPContext::qp
int qp
Definition: vf_fspp.h:64
FSPPContext::strength
int strength
Definition: vf_fspp.h:60
height
#define height
FSPPContext::threshold_mtx
uint64_t threshold_mtx[8 *2]
Definition: vf_fspp.h:57
FSPPContext::temp_stride
int temp_stride
Definition: vf_fspp.h:63
FSPPContext::use_bframe_qp
int use_bframe_qp
Definition: vf_fspp.h:71
M_SQRT1_2
#define M_SQRT1_2
Definition: mathematics.h:103
FSPPContext
Definition: vf_fspp.h:54
ff_fspp_init_x86
void ff_fspp_init_x86(FSPPContext *fspp)
Definition: vf_fspp_init.c:37
FIX_1_414213562_A
static const int16_t FIX_1_414213562_A
Definition: vf_fspp.h:48
avfilter.h
FSPPContext::mul_thrmat
void(* mul_thrmat)(int16_t *thr_adr_noq, int16_t *thr_adr, int q)
Definition: vf_fspp.h:81
FSPPContext::store_slice2
void(* store_slice2)(uint8_t *dst, int16_t *src, ptrdiff_t dst_stride, ptrdiff_t src_stride, ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale)
Definition: vf_fspp.h:77
M_SQRT2
#define M_SQRT2
Definition: mathematics.h:109
FSPPContext::temp
int16_t * temp
Definition: vf_fspp.h:68
FIX_0_382683433
static const int16_t FIX_0_382683433
Definition: vf_fspp.h:44
FSPPContext::prev_q
int prev_q
Definition: vf_fspp.h:66
int32_t
int32_t
Definition: audioconvert.c:56
FIX_0_707106781
static const int16_t FIX_0_707106781
Definition: vf_fspp.h:46
FIX_0_541196100
static const int16_t FIX_0_541196100
Definition: vf_fspp.h:45
int_simd16_t
int32_t int_simd16_t
Definition: vf_fspp.h:43
video_enc_params.h