Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
40d94967
Commit
40d94967
authored
Dec 30, 2015
by
Alexandra Hájková
Committed by
Janne Grunau
Dec 31, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dca: use defines for subband related constants
Signed-off-by:
Janne Grunau
<
janne-libav@jannau.net
>
parent
8563f988
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
18 deletions
+20
-18
dca.h
libavcodec/dca.h
+1
-1
dcadec.c
libavcodec/dcadec.c
+10
-11
dcadsp.c
libavcodec/dcadsp.c
+3
-3
dcadsp.h
libavcodec/dcadsp.h
+6
-3
No files found.
libavcodec/dca.h
View file @
40d94967
...
@@ -147,7 +147,7 @@ typedef struct DCAAudioHeader {
...
@@ -147,7 +147,7 @@ typedef struct DCAAudioHeader {
}
DCAAudioHeader
;
}
DCAAudioHeader
;
typedef
struct
DCAChan
{
typedef
struct
DCAChan
{
DECLARE_ALIGNED
(
32
,
int32_t
,
subband_samples
)[
DCA_BLOCKS_MAX
][
DCA_SUBBANDS
][
8
];
DECLARE_ALIGNED
(
32
,
int32_t
,
subband_samples
)[
DCA_BLOCKS_MAX
][
DCA_SUBBANDS
][
SAMPLES_PER_SUBBAND
];
/* Subband samples history (for ADPCM) */
/* Subband samples history (for ADPCM) */
DECLARE_ALIGNED
(
32
,
int32_t
,
subband_samples_hist
)[
DCA_SUBBANDS
][
4
];
DECLARE_ALIGNED
(
32
,
int32_t
,
subband_samples_hist
)[
DCA_SUBBANDS
][
4
];
...
...
libavcodec/dcadec.c
View file @
40d94967
...
@@ -140,8 +140,6 @@ static const uint64_t dca_core_channel_layout[] = {
...
@@ -140,8 +140,6 @@ static const uint64_t dca_core_channel_layout[] = {
#define DCA_NSYNCAUX 0x9A1105A0
#define DCA_NSYNCAUX 0x9A1105A0
#define SAMPLES_PER_SUBBAND 8 // number of samples per subband per subsubframe
/** Bit allocation */
/** Bit allocation */
typedef
struct
BitAlloc
{
typedef
struct
BitAlloc
{
int
offset
;
///< code values offset
int
offset
;
///< code values offset
...
@@ -544,7 +542,7 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
...
@@ -544,7 +542,7 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
}
}
static
void
qmf_32_subbands
(
DCAContext
*
s
,
int
chans
,
static
void
qmf_32_subbands
(
DCAContext
*
s
,
int
chans
,
float
samples_in
[
32
][
SAMPLES_PER_SUBBAND
],
float
*
samples_out
,
float
samples_in
[
DCA_SUBBANDS
][
SAMPLES_PER_SUBBAND
],
float
*
samples_out
,
float
scale
)
float
scale
)
{
{
const
float
*
prCoeff
;
const
float
*
prCoeff
;
...
@@ -592,7 +590,8 @@ static QMF64_table *qmf64_precompute(void)
...
@@ -592,7 +590,8 @@ static QMF64_table *qmf64_precompute(void)
/* FIXME: Totally unoptimized. Based on the reference code and
/* FIXME: Totally unoptimized. Based on the reference code and
* http://multimedia.cx/mirror/dca-transform.pdf, with guessed tweaks
* http://multimedia.cx/mirror/dca-transform.pdf, with guessed tweaks
* for doubling the size. */
* for doubling the size. */
static
void
qmf_64_subbands
(
DCAContext
*
s
,
int
chans
,
float
samples_in
[
64
][
SAMPLES_PER_SUBBAND
],
static
void
qmf_64_subbands
(
DCAContext
*
s
,
int
chans
,
float
samples_in
[
DCA_SUBBANDS_X96K
][
SAMPLES_PER_SUBBAND
],
float
*
samples_out
,
float
scale
)
float
*
samples_out
,
float
scale
)
{
{
float
raXin
[
64
];
float
raXin
[
64
];
...
@@ -601,7 +600,7 @@ static void qmf_64_subbands(DCAContext *s, int chans, float samples_in[64][SAMPL
...
@@ -601,7 +600,7 @@ static void qmf_64_subbands(DCAContext *s, int chans, float samples_in[64][SAMPL
float
*
raZ
=
s
->
dca_chan
[
chans
].
subband_fir_noidea
;
float
*
raZ
=
s
->
dca_chan
[
chans
].
subband_fir_noidea
;
unsigned
i
,
j
,
k
,
subindex
;
unsigned
i
,
j
,
k
,
subindex
;
for
(
i
=
s
->
audio_header
.
subband_activity
[
chans
];
i
<
64
;
i
++
)
for
(
i
=
s
->
audio_header
.
subband_activity
[
chans
];
i
<
DCA_SUBBANDS_X96K
;
i
++
)
raXin
[
i
]
=
0
.
0
;
raXin
[
i
]
=
0
.
0
;
for
(
subindex
=
0
;
subindex
<
SAMPLES_PER_SUBBAND
;
subindex
++
)
{
for
(
subindex
=
0
;
subindex
<
SAMPLES_PER_SUBBAND
;
subindex
++
)
{
for
(
i
=
0
;
i
<
s
->
audio_header
.
subband_activity
[
chans
];
i
++
)
for
(
i
=
0
;
i
<
s
->
audio_header
.
subband_activity
[
chans
];
i
++
)
...
@@ -622,14 +621,14 @@ static void qmf_64_subbands(DCAContext *s, int chans, float samples_in[64][SAMPL
...
@@ -622,14 +621,14 @@ static void qmf_64_subbands(DCAContext *s, int chans, float samples_in[64][SAMPL
raX
[
63
-
k
]
=
s
->
qmf64_table
->
rsin
[
k
]
*
(
A
[
k
]
-
B
[
k
]);
raX
[
63
-
k
]
=
s
->
qmf64_table
->
rsin
[
k
]
*
(
A
[
k
]
-
B
[
k
]);
}
}
for
(
i
=
0
;
i
<
64
;
i
++
)
{
for
(
i
=
0
;
i
<
DCA_SUBBANDS_X96K
;
i
++
)
{
float
out
=
raZ
[
i
];
float
out
=
raZ
[
i
];
for
(
j
=
0
;
j
<
1024
;
j
+=
128
)
for
(
j
=
0
;
j
<
1024
;
j
+=
128
)
out
+=
ff_dca_fir_64bands
[
j
+
i
]
*
(
raX
[
j
+
i
]
-
raX
[
j
+
63
-
i
]);
out
+=
ff_dca_fir_64bands
[
j
+
i
]
*
(
raX
[
j
+
i
]
-
raX
[
j
+
63
-
i
]);
*
samples_out
++
=
out
*
scale
;
*
samples_out
++
=
out
*
scale
;
}
}
for
(
i
=
0
;
i
<
64
;
i
++
)
{
for
(
i
=
0
;
i
<
DCA_SUBBANDS_X96K
;
i
++
)
{
float
hist
=
0
.
0
;
float
hist
=
0
.
0
;
for
(
j
=
0
;
j
<
1024
;
j
+=
128
)
for
(
j
=
0
;
j
<
1024
;
j
+=
128
)
hist
+=
ff_dca_fir_64bands
[
64
+
j
+
i
]
*
(
-
raX
[
i
+
j
]
-
raX
[
j
+
63
-
i
]);
hist
+=
ff_dca_fir_64bands
[
64
+
j
+
i
]
*
(
-
raX
[
i
+
j
]
-
raX
[
j
+
63
-
i
]);
...
@@ -938,7 +937,7 @@ static int dca_filter_channels(DCAContext *s, int block_index, int upsample)
...
@@ -938,7 +937,7 @@ static int dca_filter_channels(DCAContext *s, int block_index, int upsample)
int
k
;
int
k
;
if
(
upsample
)
{
if
(
upsample
)
{
LOCAL_ALIGNED
(
32
,
float
,
samples
,
[
64
],
[
SAMPLES_PER_SUBBAND
]);
LOCAL_ALIGNED
(
32
,
float
,
samples
,
[
DCA_SUBBANDS_X96K
],
[
SAMPLES_PER_SUBBAND
]);
if
(
!
s
->
qmf64_table
)
{
if
(
!
s
->
qmf64_table
)
{
s
->
qmf64_table
=
qmf64_precompute
();
s
->
qmf64_table
=
qmf64_precompute
();
...
@@ -952,7 +951,7 @@ static int dca_filter_channels(DCAContext *s, int block_index, int upsample)
...
@@ -952,7 +951,7 @@ static int dca_filter_channels(DCAContext *s, int block_index, int upsample)
s
->
dca_chan
[
k
].
subband_samples
[
block_index
];
s
->
dca_chan
[
k
].
subband_samples
[
block_index
];
s
->
fmt_conv
.
int32_to_float
(
samples
[
0
],
subband_samples
[
0
],
s
->
fmt_conv
.
int32_to_float
(
samples
[
0
],
subband_samples
[
0
],
64
*
SAMPLES_PER_SUBBAND
);
DCA_SUBBANDS_X96K
*
SAMPLES_PER_SUBBAND
);
if
(
s
->
channel_order_tab
[
k
]
>=
0
)
if
(
s
->
channel_order_tab
[
k
]
>=
0
)
qmf_64_subbands
(
s
,
k
,
samples
,
qmf_64_subbands
(
s
,
k
,
samples
,
...
@@ -962,14 +961,14 @@ static int dca_filter_channels(DCAContext *s, int block_index, int upsample)
...
@@ -962,14 +961,14 @@ static int dca_filter_channels(DCAContext *s, int block_index, int upsample)
}
}
}
else
{
}
else
{
/* 32 subbands QMF */
/* 32 subbands QMF */
LOCAL_ALIGNED
(
32
,
float
,
samples
,
[
32
],
[
SAMPLES_PER_SUBBAND
]);
LOCAL_ALIGNED
(
32
,
float
,
samples
,
[
DCA_SUBBANDS
],
[
SAMPLES_PER_SUBBAND
]);
for
(
k
=
0
;
k
<
s
->
audio_header
.
prim_channels
;
k
++
)
{
for
(
k
=
0
;
k
<
s
->
audio_header
.
prim_channels
;
k
++
)
{
int32_t
(
*
subband_samples
)[
SAMPLES_PER_SUBBAND
]
=
int32_t
(
*
subband_samples
)[
SAMPLES_PER_SUBBAND
]
=
s
->
dca_chan
[
k
].
subband_samples
[
block_index
];
s
->
dca_chan
[
k
].
subband_samples
[
block_index
];
s
->
fmt_conv
.
int32_to_float
(
samples
[
0
],
subband_samples
[
0
],
s
->
fmt_conv
.
int32_to_float
(
samples
[
0
],
subband_samples
[
0
],
32
*
SAMPLES_PER_SUBBAND
);
DCA_SUBBANDS
*
SAMPLES_PER_SUBBAND
);
if
(
s
->
channel_order_tab
[
k
]
>=
0
)
if
(
s
->
channel_order_tab
[
k
]
>=
0
)
qmf_32_subbands
(
s
,
k
,
samples
,
qmf_32_subbands
(
s
,
k
,
samples
,
...
...
libavcodec/dcadsp.c
View file @
40d94967
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include "dcadsp.h"
#include "dcadsp.h"
#include "dcamath.h"
#include "dcamath.h"
static
void
decode_hf_c
(
int32_t
dst
[
DCA_SUBBANDS
][
8
],
static
void
decode_hf_c
(
int32_t
dst
[
DCA_SUBBANDS
][
SAMPLES_PER_SUBBAND
],
const
int32_t
vq_num
[
DCA_SUBBANDS
],
const
int32_t
vq_num
[
DCA_SUBBANDS
],
const
int8_t
hf_vq
[
1024
][
32
],
intptr_t
vq_offset
,
const
int8_t
hf_vq
[
1024
][
32
],
intptr_t
vq_offset
,
int32_t
scale
[
DCA_SUBBANDS
][
2
],
int32_t
scale
[
DCA_SUBBANDS
][
2
],
...
@@ -62,7 +62,7 @@ static inline void dca_lfe_fir(float *out, const float *in, const float *coefs,
...
@@ -62,7 +62,7 @@ static inline void dca_lfe_fir(float *out, const float *in, const float *coefs,
}
}
}
}
static
void
dca_qmf_32_subbands
(
float
samples_in
[
32
][
8
],
int
sb_act
,
static
void
dca_qmf_32_subbands
(
float
samples_in
[
DCA_SUBBANDS
][
SAMPLES_PER_SUBBAND
],
int
sb_act
,
SynthFilterContext
*
synth
,
FFTContext
*
imdct
,
SynthFilterContext
*
synth
,
FFTContext
*
imdct
,
float
synth_buf_ptr
[
512
],
float
synth_buf_ptr
[
512
],
int
*
synth_buf_offset
,
float
synth_buf2
[
32
],
int
*
synth_buf_offset
,
float
synth_buf2
[
32
],
...
@@ -103,7 +103,7 @@ static void dequantize_c(int32_t *samples, uint32_t step_size, uint32_t scale)
...
@@ -103,7 +103,7 @@ static void dequantize_c(int32_t *samples, uint32_t step_size, uint32_t scale)
shift
=
0
;
shift
=
0
;
step_scale
=
(
int32_t
)(
step
>>
shift
);
step_scale
=
(
int32_t
)(
step
>>
shift
);
for
(
i
=
0
;
i
<
8
;
i
++
)
for
(
i
=
0
;
i
<
SAMPLES_PER_SUBBAND
;
i
++
)
samples
[
i
]
=
dca_clip23
(
dca_norm
((
int64_t
)
samples
[
i
]
*
step_scale
,
22
-
shift
));
samples
[
i
]
=
dca_clip23
(
dca_norm
((
int64_t
)
samples
[
i
]
*
step_scale
,
22
-
shift
));
}
}
...
...
libavcodec/dcadsp.h
View file @
40d94967
...
@@ -22,17 +22,20 @@
...
@@ -22,17 +22,20 @@
#include "avfft.h"
#include "avfft.h"
#include "synth_filter.h"
#include "synth_filter.h"
#define DCA_SUBBANDS_X96K 64
#define DCA_SUBBANDS 32
#define DCA_SUBBANDS 32
#define SAMPLES_PER_SUBBAND 8 // number of samples per subband per subsubframe
typedef
struct
DCADSPContext
{
typedef
struct
DCADSPContext
{
void
(
*
lfe_fir
[
2
])(
float
*
out
,
const
float
*
in
,
const
float
*
coefs
);
void
(
*
lfe_fir
[
2
])(
float
*
out
,
const
float
*
in
,
const
float
*
coefs
);
void
(
*
qmf_32_subbands
)(
float
samples_in
[
32
][
8
],
int
sb_act
,
void
(
*
qmf_32_subbands
)(
float
samples_in
[
DCA_SUBBANDS
][
SAMPLES_PER_SUBBAND
],
int
sb_act
,
SynthFilterContext
*
synth
,
FFTContext
*
imdct
,
SynthFilterContext
*
synth
,
FFTContext
*
imdct
,
float
synth_buf_ptr
[
512
],
float
synth_buf_ptr
[
512
],
int
*
synth_buf_offset
,
float
synth_buf2
[
32
],
int
*
synth_buf_offset
,
float
synth_buf2
[
32
],
const
float
window
[
512
],
float
*
samples_out
,
const
float
window
[
512
],
float
*
samples_out
,
float
raXin
[
32
],
float
scale
);
float
raXin
[
32
],
float
scale
);
void
(
*
decode_hf
)(
int32_t
dst
[
DCA_SUBBANDS
][
8
],
void
(
*
decode_hf
)(
int32_t
dst
[
DCA_SUBBANDS
][
SAMPLES_PER_SUBBAND
],
const
int32_t
vq_num
[
DCA_SUBBANDS
],
const
int32_t
vq_num
[
DCA_SUBBANDS
],
const
int8_t
hf_vq
[
1024
][
32
],
intptr_t
vq_offset
,
const
int8_t
hf_vq
[
1024
][
32
],
intptr_t
vq_offset
,
int32_t
scale
[
DCA_SUBBANDS
][
2
],
int32_t
scale
[
DCA_SUBBANDS
][
2
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment