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
fce33f9e
Commit
fce33f9e
authored
Aug 05, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ac3enc: restructure coupling coordinate reuse calculation
parent
c3d63262
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
21 deletions
+27
-21
ac3enc_template.c
libavcodec/ac3enc_template.c
+27
-21
No files found.
libavcodec/ac3enc_template.c
View file @
fce33f9e
...
...
@@ -202,33 +202,29 @@ static void apply_channel_coupling(AC3EncodeContext *s)
bnd
++
;
}
/* calculate coupling coordinates for all blocks for all channels */
for
(
blk
=
0
;
blk
<
s
->
num_blocks
;
blk
++
)
{
AC3Block
*
block
=
&
s
->
blocks
[
blk
];
if
(
!
block
->
cpl_in_use
)
continue
;
for
(
ch
=
1
;
ch
<=
s
->
fbw_channels
;
ch
++
)
{
if
(
!
block
->
channel_in_cpl
[
ch
])
continue
;
for
(
bnd
=
0
;
bnd
<
s
->
num_cpl_bands
;
bnd
++
)
{
cpl_coords
[
blk
][
ch
][
bnd
]
=
calc_cpl_coord
(
energy
[
blk
][
ch
][
bnd
],
energy
[
blk
][
CPL_CH
][
bnd
]);
}
}
}
/* determine which blocks to send new coupling coordinates for */
for
(
blk
=
0
;
blk
<
s
->
num_blocks
;
blk
++
)
{
AC3Block
*
block
=
&
s
->
blocks
[
blk
];
AC3Block
*
block0
=
blk
?
&
s
->
blocks
[
blk
-
1
]
:
NULL
;
CoefSumType
coord_diff
[
AC3_MAX_CHANNELS
]
=
{
0
,};
memset
(
block
->
new_cpl_coords
,
0
,
sizeof
(
block
->
new_cpl_coords
));
if
(
block
->
cpl_in_use
)
{
/* calculate coupling coordinates for all blocks and calculate the
average difference between coordinates in successive blocks */
for
(
ch
=
1
;
ch
<=
s
->
fbw_channels
;
ch
++
)
{
if
(
!
block
->
channel_in_cpl
[
ch
])
continue
;
for
(
bnd
=
0
;
bnd
<
s
->
num_cpl_bands
;
bnd
++
)
{
cpl_coords
[
blk
][
ch
][
bnd
]
=
calc_cpl_coord
(
energy
[
blk
][
ch
][
bnd
],
energy
[
blk
][
CPL_CH
][
bnd
]);
if
(
blk
>
0
&&
block0
->
cpl_in_use
&&
block0
->
channel_in_cpl
[
ch
])
{
coord_diff
[
ch
]
+=
fabs
(
cpl_coords
[
blk
-
1
][
ch
][
bnd
]
-
cpl_coords
[
blk
][
ch
][
bnd
]);
}
}
coord_diff
[
ch
]
/=
s
->
num_cpl_bands
;
}
/* send new coordinates if this is the first block, if previous
* block did not use coupling but this block does, the channels
* using coupling has changed from the previous block, or the
...
...
@@ -239,9 +235,19 @@ static void apply_channel_coupling(AC3EncodeContext *s)
block
->
new_cpl_coords
[
ch
]
=
1
;
}
else
{
for
(
ch
=
1
;
ch
<=
s
->
fbw_channels
;
ch
++
)
{
if
((
block
->
channel_in_cpl
[
ch
]
&&
!
block0
->
channel_in_cpl
[
ch
])
||
(
block
->
channel_in_cpl
[
ch
]
&&
coord_diff
[
ch
]
>
0
.
03
))
{
if
(
!
block
->
channel_in_cpl
[
ch
])
continue
;
if
(
!
block0
->
channel_in_cpl
[
ch
])
{
block
->
new_cpl_coords
[
ch
]
=
1
;
}
else
{
CoefSumType
coord_diff
=
0
;
for
(
bnd
=
0
;
bnd
<
s
->
num_cpl_bands
;
bnd
++
)
{
coord_diff
+=
fabs
(
cpl_coords
[
blk
-
1
][
ch
][
bnd
]
-
cpl_coords
[
blk
][
ch
][
bnd
]);
}
coord_diff
/=
s
->
num_cpl_bands
;
if
(
coord_diff
>
0
.
03
)
block
->
new_cpl_coords
[
ch
]
=
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