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
f507a9fe
Commit
f507a9fe
authored
Apr 03, 2011
by
Mans Rullgard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ac3enc: move inner loop of compute_rematrixing_strategy to ac3dsp
parent
fce1e434
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
12 deletions
+70
-12
ac3dsp.c
libavcodec/ac3dsp.c
+45
-0
ac3dsp.h
libavcodec/ac3dsp.h
+6
-0
ac3enc_fixed.c
libavcodec/ac3enc_fixed.c
+6
-0
ac3enc_float.c
libavcodec/ac3enc_float.c
+6
-0
ac3enc_template.c
libavcodec/ac3enc_template.c
+7
-12
No files found.
libavcodec/ac3dsp.c
View file @
f507a9fe
...
...
@@ -23,6 +23,7 @@
#include "avcodec.h"
#include "ac3.h"
#include "ac3dsp.h"
#include "mathops.h"
static
void
ac3_exponent_min_c
(
uint8_t
*
exp
,
int
num_reuse_blocks
,
int
nb_coefs
)
{
...
...
@@ -169,6 +170,48 @@ static void ac3_extract_exponents_c(uint8_t *exp, int32_t *coef, int nb_coefs)
}
}
static
void
ac3_sum_square_butterfly_int32_c
(
int64_t
sum
[
4
],
const
int32_t
*
coef0
,
const
int32_t
*
coef1
,
int
len
)
{
int
i
;
sum
[
0
]
=
sum
[
1
]
=
sum
[
2
]
=
sum
[
3
]
=
0
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
int
lt
=
coef0
[
i
];
int
rt
=
coef1
[
i
];
int
md
=
lt
+
rt
;
int
sd
=
lt
-
rt
;
MAC64
(
sum
[
0
],
lt
,
lt
);
MAC64
(
sum
[
1
],
rt
,
rt
);
MAC64
(
sum
[
2
],
md
,
md
);
MAC64
(
sum
[
3
],
sd
,
sd
);
}
}
static
void
ac3_sum_square_butterfly_float_c
(
float
sum
[
4
],
const
float
*
coef0
,
const
float
*
coef1
,
int
len
)
{
int
i
;
sum
[
0
]
=
sum
[
1
]
=
sum
[
2
]
=
sum
[
3
]
=
0
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
float
lt
=
coef0
[
i
];
float
rt
=
coef1
[
i
];
float
md
=
lt
+
rt
;
float
sd
=
lt
-
rt
;
sum
[
0
]
+=
lt
*
lt
;
sum
[
1
]
+=
rt
*
rt
;
sum
[
2
]
+=
md
*
md
;
sum
[
3
]
+=
sd
*
sd
;
}
}
av_cold
void
ff_ac3dsp_init
(
AC3DSPContext
*
c
,
int
bit_exact
)
{
c
->
ac3_exponent_min
=
ac3_exponent_min_c
;
...
...
@@ -180,6 +223,8 @@ av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
c
->
update_bap_counts
=
ac3_update_bap_counts_c
;
c
->
compute_mantissa_size
=
ac3_compute_mantissa_size_c
;
c
->
extract_exponents
=
ac3_extract_exponents_c
;
c
->
sum_square_butterfly_int32
=
ac3_sum_square_butterfly_int32_c
;
c
->
sum_square_butterfly_float
=
ac3_sum_square_butterfly_float_c
;
if
(
ARCH_ARM
)
ff_ac3dsp_init_arm
(
c
,
bit_exact
);
...
...
libavcodec/ac3dsp.h
View file @
f507a9fe
...
...
@@ -125,6 +125,12 @@ typedef struct AC3DSPContext {
int
(
*
compute_mantissa_size
)(
uint16_t
mant_cnt
[
6
][
16
]);
void
(
*
extract_exponents
)(
uint8_t
*
exp
,
int32_t
*
coef
,
int
nb_coefs
);
void
(
*
sum_square_butterfly_int32
)(
int64_t
sum
[
4
],
const
int32_t
*
coef0
,
const
int32_t
*
coef1
,
int
len
);
void
(
*
sum_square_butterfly_float
)(
float
sum
[
4
],
const
float
*
coef0
,
const
float
*
coef1
,
int
len
);
}
AC3DSPContext
;
void
ff_ac3dsp_init
(
AC3DSPContext
*
c
,
int
bit_exact
);
...
...
libavcodec/ac3enc_fixed.c
View file @
f507a9fe
...
...
@@ -103,6 +103,12 @@ static void scale_coefficients(AC3EncodeContext *s)
}
}
static
void
sum_square_butterfly
(
AC3EncodeContext
*
s
,
int64_t
sum
[
4
],
const
int32_t
*
coef0
,
const
int32_t
*
coef1
,
int
len
)
{
s
->
ac3dsp
.
sum_square_butterfly_int32
(
sum
,
coef0
,
coef1
,
len
);
}
/**
* Clip MDCT coefficients to allowable range.
...
...
libavcodec/ac3enc_float.c
View file @
f507a9fe
...
...
@@ -110,6 +110,12 @@ static void scale_coefficients(AC3EncodeContext *s)
chan_size
*
s
->
channels
);
}
static
void
sum_square_butterfly
(
AC3EncodeContext
*
s
,
float
sum
[
4
],
const
float
*
coef0
,
const
float
*
coef1
,
int
len
)
{
s
->
ac3dsp
.
sum_square_butterfly_float
(
sum
,
coef0
,
coef1
,
len
);
}
/**
* Clip MDCT coefficients to allowable range.
...
...
libavcodec/ac3enc_template.c
View file @
f507a9fe
...
...
@@ -43,6 +43,9 @@ static int normalize_samples(AC3EncodeContext *s);
static
void
clip_coefficients
(
DSPContext
*
dsp
,
CoefType
*
coef
,
unsigned
int
len
);
static
void
sum_square_butterfly
(
AC3EncodeContext
*
s
,
CoefSumType
sum
[
4
],
const
CoefType
*
coef0
,
const
CoefType
*
coef1
,
int
len
);
int
AC3_NAME
(
allocate_sample_buffers
)(
AC3EncodeContext
*
s
)
{
...
...
@@ -356,7 +359,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
static
void
compute_rematrixing_strategy
(
AC3EncodeContext
*
s
)
{
int
nb_coefs
;
int
blk
,
bnd
,
i
;
int
blk
,
bnd
;
AC3Block
*
block
,
*
av_uninit
(
block0
);
if
(
s
->
channel_mode
!=
AC3_CHMODE_STEREO
)
...
...
@@ -384,17 +387,9 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
/* calculate calculate sum of squared coeffs for one band in one block */
int
start
=
ff_ac3_rematrix_band_tab
[
bnd
];
int
end
=
FFMIN
(
nb_coefs
,
ff_ac3_rematrix_band_tab
[
bnd
+
1
]);
CoefSumType
sum
[
4
]
=
{
0
,};
for
(
i
=
start
;
i
<
end
;
i
++
)
{
CoefType
lt
=
block
->
mdct_coef
[
1
][
i
];
CoefType
rt
=
block
->
mdct_coef
[
2
][
i
];
CoefType
md
=
lt
+
rt
;
CoefType
sd
=
lt
-
rt
;
MAC_COEF
(
sum
[
0
],
lt
,
lt
);
MAC_COEF
(
sum
[
1
],
rt
,
rt
);
MAC_COEF
(
sum
[
2
],
md
,
md
);
MAC_COEF
(
sum
[
3
],
sd
,
sd
);
}
CoefSumType
sum
[
4
];
sum_square_butterfly
(
s
,
sum
,
block
->
mdct_coef
[
1
]
+
start
,
block
->
mdct_coef
[
2
]
+
start
,
end
-
start
);
/* compare sums to determine if rematrixing will be used for this band */
if
(
FFMIN
(
sum
[
2
],
sum
[
3
])
<
FFMIN
(
sum
[
0
],
sum
[
1
]))
...
...
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