FFmpeg
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
libavcodec
jpeg2000dsp.c
Go to the documentation of this file.
1
/*
2
* JPEG 2000 DSP functions
3
* Copyright (c) 2007 Kamil Nowosad
4
* Copyright (c) 2013 Nicolas Bertrand <nicoinattendu@gmail.com>
5
*
6
* This file is part of FFmpeg.
7
*
8
* FFmpeg is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (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 GNU
16
* Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with FFmpeg; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
*/
22
23
#include "
config.h
"
24
#include "
libavutil/attributes.h
"
25
#include "
jpeg2000dsp.h
"
26
27
/* Inverse ICT parameters in float and integer.
28
* int value = (float value) * (1<<16) */
29
static
const
float
f_ict_params
[4] = {
30
1.402f,
31
0.34413f,
32
0.71414f,
33
1.772f
34
};
35
36
static
const
int
i_ict_params
[4] = {
37
91881,
38
22553,
39
46802,
40
116130
41
};
42
43
static
void
ict_float
(
void
*_src0,
void
*_src1,
void
*_src2,
int
csize)
44
{
45
float
*
src0
= _src0, *
src1
= _src1, *src2 = _src2;
46
float
i0f, i1f,
i2f
;
47
int
i;
48
49
for
(i = 0; i < csize; i++) {
50
i0f = *src0 + (
f_ict_params
[0] * *src2);
51
i1f = *src0 - (
f_ict_params
[1] * *
src1
)
52
- (
f_ict_params
[2] * *src2);
53
i2f = *src0 + (
f_ict_params
[3] * *
src1
);
54
*src0++ = i0f;
55
*src1++ = i1f;
56
*src2++ =
i2f
;
57
}
58
}
59
60
static
void
ict_int
(
void
*_src0,
void
*_src1,
void
*_src2,
int
csize)
61
{
62
int32_t
*
src0
= _src0, *
src1
= _src1, *src2 = _src2;
63
int32_t
i0, i1, i2;
64
int
i;
65
66
for
(i = 0; i < csize; i++) {
67
i0 = *src0 + *src2 + (((26345 * *src2) + (1 << 15)) >> 16);
68
i1 = *src0 - ((
int
)(((
unsigned
)
i_ict_params
[1] * *src1) + (1 << 15)) >> 16)
69
- (((
i_ict_params
[2] * *src2) + (1 << 15)) >> 16);
70
i2 = *src0 + (2 * *
src1
) + ((
int
)((-14942
U
* *
src1
) + (1 << 15)) >> 16);
71
*src0++ = i0;
72
*src1++ = i1;
73
*src2++ = i2;
74
}
75
}
76
77
static
void
rct_int
(
void
*_src0,
void
*_src1,
void
*_src2,
int
csize)
78
{
79
int32_t
*
src0
= _src0, *
src1
= _src1, *src2 = _src2;
80
int32_t
i0, i1, i2;
81
int
i;
82
83
for
(i = 0; i < csize; i++) {
84
i1 = *src0 - (*src2 + *src1 >> 2);
85
i0 = i1 + *src2;
86
i2 = i1 + *
src1
;
87
*src0++ = i0;
88
*src1++ = i1;
89
*src2++ = i2;
90
}
91
}
92
93
av_cold
void
ff_jpeg2000dsp_init
(
Jpeg2000DSPContext
*
c
)
94
{
95
c->
mct_decode
[
FF_DWT97
] =
ict_float
;
96
c->
mct_decode
[
FF_DWT53
] =
rct_int
;
97
c->
mct_decode
[
FF_DWT97_INT
] =
ict_int
;
98
99
if
(ARCH_X86)
100
ff_jpeg2000dsp_init_x86
(c);
101
}
Jpeg2000DSPContext::mct_decode
void(* mct_decode[FF_DWT_NB])(void *src0, void *src1, void *src2, int csize)
Definition:
jpeg2000dsp.h:30
ff_jpeg2000dsp_init
av_cold void ff_jpeg2000dsp_init(Jpeg2000DSPContext *c)
Definition:
jpeg2000dsp.c:93
i2f
static Float11 * i2f(int i, Float11 *f)
Definition:
g726.c:45
FF_DWT53
Definition:
jpeg2000dwt.h:38
attributes.h
Macro definitions for various function/variable attributes.
config.h
av_cold
#define av_cold
Definition:
attributes.h:82
f_ict_params
static const float f_ict_params[4]
Definition:
jpeg2000dsp.c:29
U
#define U(x)
Definition:
vp56_arith.h:37
ff_jpeg2000dsp_init_x86
void ff_jpeg2000dsp_init_x86(Jpeg2000DSPContext *c)
Definition:
jpeg2000dsp_init.c:32
rct_int
static void rct_int(void *_src0, void *_src1, void *_src2, int csize)
Definition:
jpeg2000dsp.c:77
int32_t
int32_t
Definition:
audio_convert.c:194
src1
#define src1
Definition:
h264pred.c:139
ict_int
static void ict_int(void *_src0, void *_src1, void *_src2, int csize)
Definition:
jpeg2000dsp.c:60
Jpeg2000DSPContext
Definition:
jpeg2000dsp.h:29
FF_DWT97_INT
Definition:
jpeg2000dwt.h:39
src0
#define src0
Definition:
h264pred.c:138
jpeg2000dsp.h
i_ict_params
static const int i_ict_params[4]
Definition:
jpeg2000dsp.c:36
int
int
Definition:
ffmpeg_filter.c:190
c
static double c[64]
Definition:
vsrc_mptestsrc.c:87
ict_float
static void ict_float(void *_src0, void *_src1, void *_src2, int csize)
Definition:
jpeg2000dsp.c:43
FF_DWT97
Definition:
jpeg2000dwt.h:37
Generated on Fri Jan 12 2018 01:45:40 for FFmpeg by
1.8.6