Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
a654d779
Commit
a654d779
authored
May 08, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a52: remove redumdant data
The channels count can trivially be computed with popcount().
parent
1e88a96b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
37 deletions
+23
-37
modules/codec/a52.h
modules/codec/a52.h
+23
-37
No files found.
modules/codec/a52.h
View file @
a654d779
...
...
@@ -29,12 +29,6 @@
#include <vlc_bits.h>
typedef
struct
{
unsigned
int
i_count
;
unsigned
int
i_configuration
;
}
vlc_a52_acmod_t
;
/**
* Minimum AC3 header size that vlc_a52_header_Parse needs.
*/
...
...
@@ -66,7 +60,7 @@ typedef struct
*/
static
inline
int
vlc_a52_header_ParseAc3
(
vlc_a52_header_t
*
p_header
,
const
uint8_t
*
p_buf
,
const
vlc_a52_acmod
_t
*
p_acmod
)
const
uint32
_t
*
p_acmod
)
{
static
const
uint8_t
pi_halfrate
[
12
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
2
,
3
};
static
const
unsigned
int
pi_bitrate
[]
=
{
32
,
40
,
48
,
56
,
64
,
80
,
96
,
112
,
...
...
@@ -81,23 +75,15 @@ static inline int vlc_a52_header_ParseAc3( vlc_a52_header_t *p_header,
/* acmod, dsurmod and lfeon */
const
unsigned
i_acmod
=
p_buf
[
6
]
>>
5
;
if
(
(
p_buf
[
6
]
&
0xf8
)
==
0x50
)
{
/* Dolby surround = stereo + Dolby */
p_header
->
i_channels
=
2
;
p_header
->
i_channels_conf
=
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
|
AOUT_CHAN_DOLBYSTEREO
;
}
p_header
->
i_channels_conf
=
AOUT_CHANS_STEREO
|
AOUT_CHAN_DOLBYSTEREO
;
else
{
p_header
->
i_channels
=
p_acmod
[
i_acmod
].
i_count
;
p_header
->
i_channels_conf
=
p_acmod
[
i_acmod
].
i_configuration
;
}
p_header
->
i_channels_conf
=
p_acmod
[
i_acmod
];
if
(
p_buf
[
6
]
&
pi_lfeon
[
i_acmod
]
)
{
p_header
->
i_channels
++
;
p_header
->
i_channels_conf
|=
AOUT_CHAN_LFE
;
}
p_header
->
i_channels
=
popcount
(
p_header
->
i_channels_conf
&
AOUT_CHAN_PHYSMASK
);
const
unsigned
i_frmsizecod
=
p_buf
[
4
]
&
63
;
if
(
i_frmsizecod
>=
38
)
...
...
@@ -133,7 +119,7 @@ static inline int vlc_a52_header_ParseAc3( vlc_a52_header_t *p_header,
*/
static
inline
int
vlc_a52_header_ParseEac3
(
vlc_a52_header_t
*
p_header
,
const
uint8_t
*
p_buf
,
const
vlc_a52_acmod
_t
*
p_acmod
)
const
uint32
_t
*
p_acmod
)
{
static
const
unsigned
pi_samplerate
[
3
]
=
{
48000
,
44100
,
32000
};
unsigned
i_numblkscod
;
...
...
@@ -169,9 +155,13 @@ static inline int vlc_a52_header_ParseEac3( vlc_a52_header_t *p_header,
const
unsigned
i_acmod
=
bs_read
(
&
s
,
3
);
const
unsigned
i_lfeon
=
bs_read1
(
&
s
);
p_header
->
i_channels
=
p_acmod
[
i_acmod
].
i_count
+
i_lfeon
;
p_header
->
i_channels_conf
=
p_acmod
[
i_acmod
].
i_configuration
|
(
i_lfeon
?
AOUT_CHAN_LFE
:
0
);
p_header
->
i_bitrate
=
8
*
p_header
->
i_size
*
(
p_header
->
i_rate
)
/
(
i_numblkscod
*
256
);
p_header
->
i_channels_conf
=
p_acmod
[
i_acmod
];
if
(
i_lfeon
)
p_header
->
i_channels_conf
|=
AOUT_CHAN_LFE
;
p_header
->
i_channels
=
popcount
(
p_header
->
i_channels_conf
&
AOUT_CHAN_PHYSMASK
);
p_header
->
i_bitrate
=
8
*
p_header
->
i_size
*
(
p_header
->
i_rate
)
/
(
i_numblkscod
*
256
);
p_header
->
i_samples
=
i_numblkscod
*
256
;
p_header
->
b_eac3
=
true
;
...
...
@@ -187,18 +177,15 @@ static inline int vlc_a52_header_ParseEac3( vlc_a52_header_t *p_header,
static
inline
int
vlc_a52_header_Parse
(
vlc_a52_header_t
*
p_header
,
const
uint8_t
*
p_buffer
,
int
i_buffer
)
{
static
const
vlc_a52_acmod_t
p_acmod
[
8
]
=
{
{
2
,
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
|
AOUT_CHAN_DUALMONO
},
/* Dual-channel 1+1 */
{
1
,
AOUT_CHAN_CENTER
},
/* Mono 1/0 */
{
2
,
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
},
/* Stereo 2/0 */
{
3
,
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
|
AOUT_CHAN_CENTER
},
/* 3F 3/0 */
{
3
,
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
|
AOUT_CHAN_REARCENTER
},
/* 2F1R 2/1 */
{
4
,
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
|
AOUT_CHAN_CENTER
|
AOUT_CHAN_REARCENTER
},
/* 3F1R 3/1 */
{
4
,
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
|
AOUT_CHAN_REARLEFT
|
AOUT_CHAN_REARRIGHT
},
/* 2F2R 2/2 */
{
5
,
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
|
AOUT_CHAN_CENTER
|
AOUT_CHAN_REARLEFT
|
AOUT_CHAN_REARRIGHT
},
/* 3F2R 3/2 */
static
const
uint32_t
p_acmod
[
8
]
=
{
AOUT_CHANS_2_0
|
AOUT_CHAN_DUALMONO
,
AOUT_CHAN_CENTER
,
AOUT_CHANS_2_0
,
AOUT_CHANS_3_0
,
AOUT_CHANS_FRONT
|
AOUT_CHAN_REARCENTER
,
/* 2F1R */
AOUT_CHANS_FRONT
|
AOUT_CHANS_CENTER
,
/* 3F1R */
AOUT_CHANS_4_0
,
AOUT_CHANS_5_0
,
};
if
(
i_buffer
<
VLC_A52_HEADER_SIZE
)
...
...
@@ -227,4 +214,3 @@ static inline int vlc_a52_header_Parse( vlc_a52_header_t *p_header,
}
#endif
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