Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
978d581b
Commit
978d581b
authored
Nov 11, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shrink channel reordering tables to 9-10 bytes (from 36-40 bytes)
parent
784b1bd3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
49 additions
and
51 deletions
+49
-51
include/vlc_aout.h
include/vlc_aout.h
+2
-2
modules/audio_filter/converter/a52tofloat32.c
modules/audio_filter/converter/a52tofloat32.c
+2
-2
modules/audio_filter/converter/dtstofloat32.c
modules/audio_filter/converter/dtstofloat32.c
+2
-2
modules/audio_output/directx.c
modules/audio_output/directx.c
+7
-10
modules/audio_output/waveout.c
modules/audio_output/waveout.c
+7
-10
modules/codec/opus.c
modules/codec/opus.c
+2
-1
modules/codec/vorbis.c
modules/codec/vorbis.c
+6
-3
modules/demux/wav.c
modules/demux/wav.c
+7
-7
modules/mux/wav.c
modules/mux/wav.c
+8
-8
src/audio_output/common.c
src/audio_output/common.c
+6
-6
No files found.
include/vlc_aout.h
View file @
978d581b
...
...
@@ -179,8 +179,8 @@ static const uint32_t pi_vlc_chan_order_wg4[] =
* internal (WG4) order is requested.
*/
VLC_API
unsigned
aout_CheckChannelReorder
(
const
uint32_t
*
,
const
uint32_t
*
,
uint32_t
mask
,
in
t
*
table
);
VLC_API
void
aout_ChannelReorder
(
void
*
,
size_t
,
unsigned
,
const
in
t
*
,
unsigned
);
uint32_t
mask
,
uint8_
t
*
table
);
VLC_API
void
aout_ChannelReorder
(
void
*
,
size_t
,
unsigned
,
const
uint8_
t
*
,
unsigned
);
/**
* This fonction will compute the extraction parameter into pi_selection to go
...
...
modules/audio_filter/converter/a52tofloat32.c
View file @
978d581b
...
...
@@ -73,7 +73,7 @@ struct filter_sys_t
bool
b_dontwarn
;
int
i_nb_channels
;
/* number of float32 per sample */
in
t
pi_chan_table
[
AOUT_CHAN_MAX
];
/* channel reordering */
uint8_
t
pi_chan_table
[
AOUT_CHAN_MAX
];
/* channel reordering */
};
/*****************************************************************************
...
...
@@ -223,7 +223,7 @@ static int Open( vlc_object_t *p_this, filter_sys_t *p_sys,
* Interleave: helper function to interleave channels
*****************************************************************************/
static
void
Interleave
(
sample_t
*
p_out
,
const
sample_t
*
p_in
,
int
i_nb_channels
,
in
t
*
pi_chan_table
)
int
i_nb_channels
,
uint8_
t
*
pi_chan_table
)
{
/* We do not only have to interleave, but also reorder the channels */
...
...
modules/audio_filter/converter/dtstofloat32.c
View file @
978d581b
...
...
@@ -66,7 +66,7 @@ struct filter_sys_t
bool
b_dontwarn
;
int
i_nb_channels
;
/* number of float32 per sample */
in
t
pi_chan_table
[
AOUT_CHAN_MAX
];
/* channel reordering */
uint8_
t
pi_chan_table
[
AOUT_CHAN_MAX
];
/* channel reordering */
};
/*****************************************************************************
...
...
@@ -185,7 +185,7 @@ static int Open( vlc_object_t *p_this, filter_sys_t *p_sys,
* Interleave: helper function to interleave channels
*****************************************************************************/
static
void
Interleave
(
float
*
p_out
,
const
float
*
p_in
,
int
i_nb_channels
,
in
t
*
pi_chan_table
)
uint8_
t
*
pi_chan_table
)
{
/* We do not only have to interleave, but also reorder the channels. */
...
...
modules/audio_output/directx.c
View file @
978d581b
...
...
@@ -83,8 +83,8 @@ struct aout_sys_t
int
i_speaker_setup
;
/* Speaker setup override */
bool
b_chan_reorder
;
/* do we need channel reordering */
int
pi_
chan_table
[
AOUT_CHAN_MAX
];
uint8_t
chans_to_reorder
;
/* do we need channel reordering */
uint8_t
chan_table
[
AOUT_CHAN_MAX
];
uint32_t
i_channel_mask
;
uint32_t
i_bits_per_sample
;
uint32_t
i_channels
;
...
...
@@ -785,12 +785,11 @@ static int CreateDSBuffer( audio_output_t *p_aout, int i_format,
p_aout
->
sys
->
i_frame_size
=
i_bytes_per_frame
;
p_aout
->
sys
->
i_channel_mask
=
waveformat
.
dwChannelMask
;
p_aout
->
sys
->
b_chan
_reorder
=
p_aout
->
sys
->
chans_to
_reorder
=
aout_CheckChannelReorder
(
pi_channels_in
,
pi_channels_out
,
waveformat
.
dwChannelMask
,
p_aout
->
sys
->
pi_chan_table
);
if
(
p_aout
->
sys
->
b_chan_reorder
)
p_aout
->
sys
->
chan_table
);
if
(
p_aout
->
sys
->
chans_to_reorder
)
{
msg_Dbg
(
p_aout
,
"channel reordering needed"
);
}
...
...
@@ -900,13 +899,11 @@ static int FillBuffer( audio_output_t *p_aout, int i_frame, block_t *p_buffer )
}
else
{
if
(
p_sys
->
b_chan_reorder
)
{
if
(
p_sys
->
chans_to_reorder
)
/* Do the channel reordering here */
aout_ChannelReorder
(
p_buffer
->
p_buffer
,
p_buffer
->
i_buffer
,
p_sys
->
i_channels
,
p_sys
->
pi_
chan_table
,
p_sys
->
chans_to_reorder
,
p_sys
->
chan_table
,
p_sys
->
i_bits_per_sample
);
}
memcpy
(
p_write_position
,
p_buffer
->
p_buffer
,
l_bytes1
);
block_Release
(
p_buffer
);
...
...
modules/audio_output/waveout.c
View file @
978d581b
...
...
@@ -119,8 +119,8 @@ struct aout_sys_t
bool
soft_mute
;
};
bool
b_chan
_reorder
;
/* do we need channel reordering */
int
pi_
chan_table
[
AOUT_CHAN_MAX
];
uint8_t
chans_to
_reorder
;
/* do we need channel reordering */
uint8_t
chan_table
[
AOUT_CHAN_MAX
];
};
#include "volume.h"
...
...
@@ -657,15 +657,12 @@ static int OpenWaveOut( audio_output_t *p_aout, uint32_t i_device_id, int i_form
return
VLC_EGENERIC
;
}
p_aout
->
sys
->
b_chan
_reorder
=
p_aout
->
sys
->
chans_to
_reorder
=
aout_CheckChannelReorder
(
pi_channels_in
,
pi_channels_out
,
waveformat
.
dwChannelMask
,
p_aout
->
sys
->
pi_chan_table
);
if
(
p_aout
->
sys
->
b_chan_reorder
)
{
p_aout
->
sys
->
chan_table
);
if
(
p_aout
->
sys
->
chans_to_reorder
)
msg_Dbg
(
p_aout
,
"channel reordering needed"
);
}
return
VLC_SUCCESS
;
...
...
@@ -924,12 +921,12 @@ static void* WaveOutThread( void *data )
}
/* Do the channel reordering */
if
(
p_buffer
&&
p_sys
->
b_chan
_reorder
)
if
(
p_buffer
&&
p_sys
->
chans_to
_reorder
)
{
aout_ChannelReorder
(
p_buffer
->
p_buffer
,
p_buffer
->
i_buffer
,
p_sys
->
waveformat
.
Format
.
nChannels
,
p_sys
->
pi_
chan_table
,
p_sys
->
chan_table
,
p_sys
->
waveformat
.
Format
.
wBitsPerSample
);
}
...
...
modules/codec/opus.c
View file @
978d581b
...
...
@@ -263,7 +263,6 @@ end:
static
int
ProcessInitialHeader
(
decoder_t
*
p_dec
,
ogg_packet
*
p_oggpacket
)
{
int
err
;
int
pi_chan_table
[
AOUT_CHAN_MAX
];
unsigned
char
new_stream_map
[
8
];
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
...
...
@@ -296,6 +295,8 @@ static int ProcessInitialHeader( decoder_t *p_dec, ogg_packet *p_oggpacket )
static
const
uint32_t
*
pi_ch
[
6
]
=
{
pi_3channels_in
,
pi_4channels_in
,
pi_5channels_in
,
pi_6channels_in
,
pi_7channels_in
,
pi_8channels_in
};
uint8_t
pi_chan_table
[
AOUT_CHAN_MAX
];
aout_CheckChannelReorder
(
pi_ch
[
p_header
->
channels
-
3
],
NULL
,
p_dec
->
fmt_out
.
audio
.
i_physical_channels
,
pi_chan_table
);
...
...
modules/codec/vorbis.c
View file @
978d581b
...
...
@@ -88,7 +88,7 @@ struct decoder_sys_t
/*
** Channel reordering
*/
in
t
pi_chan_table
[
AOUT_CHAN_MAX
];
uint8_
t
pi_chan_table
[
AOUT_CHAN_MAX
];
};
static
const
int
pi_channels_maps
[
9
]
=
...
...
@@ -658,12 +658,15 @@ static void ConfigureChannelOrder(int *pi_chan_table, int i_channels, uint32_t i
}
}
uint8_t
tab
[
AOUT_CHAN_MAX
];
if
(
b_decode
)
aout_CheckChannelReorder
(
pi_channels_in
,
NULL
,
i_channel_mask
,
pi_chan_table
);
i_channel_mask
,
tab
);
else
aout_CheckChannelReorder
(
NULL
,
pi_channels_in
,
i_channel_mask
,
pi_chan_table
);
i_channel_mask
,
tab
);
for
(
int
i
=
0
;
i
<
i_channels
;
i
++
)
pi_chan_table
[
i
]
=
tab
[
i
];
}
/*****************************************************************************
...
...
modules/demux/wav.c
View file @
978d581b
...
...
@@ -69,8 +69,8 @@ struct demux_sys_t
date_t
pts
;
uint32_t
i_channel_mask
;
bool
b_chan_reorder
;
/* do we need channel reordering */
in
t
pi_chan_table
[
AOUT_CHAN_MAX
];
uint8_t
i_chans_to_reorder
;
/* do we need channel reordering */
uint8_
t
pi_chan_table
[
AOUT_CHAN_MAX
];
};
static
int
ChunkFind
(
demux_t
*
,
const
char
*
,
unsigned
int
*
);
...
...
@@ -123,7 +123,7 @@ static int Open( vlc_object_t * p_this )
return
VLC_ENOMEM
;
p_sys
->
p_es
=
NULL
;
p_sys
->
b_chan_reorder
=
false
;
p_sys
->
i_chans_to_reorder
=
0
;
p_sys
->
i_channel_mask
=
0
;
/* skip riff header */
...
...
@@ -270,13 +270,13 @@ static int Open( vlc_object_t * p_this )
if
(
p_sys
->
fmt
.
i_codec
==
VLC_FOURCC
(
'a'
,
'r'
,
'a'
,
'w'
)
||
p_sys
->
fmt
.
i_codec
==
VLC_FOURCC
(
'p'
,
'c'
,
'm'
,
' '
)
||
p_sys
->
fmt
.
i_codec
==
VLC_FOURCC
(
'a'
,
'f'
,
'l'
,
't'
)
)
p_sys
->
b_chan
_reorder
=
p_sys
->
i_chans_to
_reorder
=
aout_CheckChannelReorder
(
pi_channels_in
,
NULL
,
p_sys
->
i_channel_mask
,
p_sys
->
pi_chan_table
);
msg_Dbg
(
p_demux
,
"channel mask: %x, reordering: %
i
"
,
p_sys
->
i_channel_mask
,
(
int
)
p_sys
->
b_chan
_reorder
);
msg_Dbg
(
p_demux
,
"channel mask: %x, reordering: %
u
"
,
p_sys
->
i_channel_mask
,
p_sys
->
i_chans_to
_reorder
);
}
p_sys
->
fmt
.
audio
.
i_physical_channels
=
...
...
@@ -427,7 +427,7 @@ static int Demux( demux_t *p_demux )
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
p_block
->
i_pts
);
/* Do the channel reordering */
if
(
p_sys
->
b_chan
_reorder
)
if
(
p_sys
->
i_chans_to
_reorder
)
aout_ChannelReorder
(
p_block
->
p_buffer
,
p_block
->
i_buffer
,
p_sys
->
fmt
.
audio
.
i_channels
,
p_sys
->
pi_chan_table
,
...
...
modules/mux/wav.c
View file @
978d581b
...
...
@@ -75,8 +75,8 @@ struct sout_mux_sys_t
uint32_t
waveheader2
[
2
];
uint32_t
i_channel_mask
;
bool
b_chan_reorder
;
/* do we need channel reordering */
in
t
pi_chan_table
[
AOUT_CHAN_MAX
];
uint8_t
i_chans_to_reorder
;
/* do we need channel reordering */
uint8_
t
pi_chan_table
[
AOUT_CHAN_MAX
];
};
static
const
uint32_t
pi_channels_in
[]
=
...
...
@@ -111,7 +111,7 @@ static int Open( vlc_object_t *p_this )
p_sys
->
b_header
=
true
;
p_sys
->
i_data
=
0
;
p_sys
->
b_chan
_reorder
=
0
;
p_sys
->
i_chans_to
_reorder
=
0
;
return
VLC_SUCCESS
;
}
...
...
@@ -185,13 +185,13 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
if
(
p_input
->
p_fmt
->
audio
.
i_physical_channels
&
pi_vlc_chan_order_wg4
[
i
])
p_sys
->
i_channel_mask
|=
pi_channels_in
[
i
];
p_sys
->
b_chan
_reorder
=
p_sys
->
i_chans_to
_reorder
=
aout_CheckChannelReorder
(
pi_channels_in
,
pi_channels_out
,
p_sys
->
i_channel_mask
,
p_sys
->
pi_chan_table
);
msg_Dbg
(
p_mux
,
"channel mask: %x, reordering: %
i
"
,
p_sys
->
i_channel_mask
,
(
int
)
p_sys
->
b_chan
_reorder
);
msg_Dbg
(
p_mux
,
"channel mask: %x, reordering: %
u
"
,
p_sys
->
i_channel_mask
,
p_sys
->
i_chans_to
_reorder
);
}
fourcc_to_wf_tag
(
p_input
->
p_fmt
->
i_codec
,
&
i_format
);
...
...
@@ -290,9 +290,9 @@ static int Mux( sout_mux_t *p_mux )
p_sys
->
i_data
+=
p_block
->
i_buffer
;
/* Do the channel reordering */
if
(
p_sys
->
b_chan
_reorder
)
if
(
p_sys
->
i_chans_to
_reorder
)
aout_ChannelReorder
(
p_block
->
p_buffer
,
p_block
->
i_buffer
,
p_
input
->
p_fmt
->
audio
.
i_channels
,
p_
sys
->
i_chans_to_reorder
,
p_sys
->
pi_chan_table
,
p_input
->
p_fmt
->
audio
.
i_bitspersample
);
...
...
src/audio_output/common.c
View file @
978d581b
...
...
@@ -243,7 +243,7 @@ void aout_FormatsPrint( vlc_object_t *obj, const char * psz_text,
*****************************************************************************/
unsigned
aout_CheckChannelReorder
(
const
uint32_t
*
chans_in
,
const
uint32_t
*
chans_out
,
uint32_t
mask
,
in
t
*
restrict
table
)
uint32_t
mask
,
uint8_
t
*
restrict
table
)
{
unsigned
channels
=
0
;
...
...
@@ -276,7 +276,7 @@ unsigned aout_CheckChannelReorder( const uint32_t *chans_in,
* aout_ChannelReorder :
*****************************************************************************/
void
aout_ChannelReorder
(
void
*
ptr
,
size_t
bytes
,
unsigned
channels
,
const
int
*
pi_chan
_table
,
unsigned
bits_per_sample
)
const
uint8_t
*
chans
_table
,
unsigned
bits_per_sample
)
{
size_t
samples
=
bytes
/
(
channels
*
(
bits_per_sample
>>
3
));
...
...
@@ -293,7 +293,7 @@ void aout_ChannelReorder( void *ptr, size_t bytes, unsigned channels,
uint32_t
tmp
[
AOUT_CHAN_MAX
];
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
tmp
[
pi_chan
_table
[
j
]]
=
buf
[
j
];
tmp
[
chans
_table
[
j
]]
=
buf
[
j
];
memcpy
(
buf
,
tmp
,
4
*
channels
);
buf
+=
channels
;
...
...
@@ -310,7 +310,7 @@ void aout_ChannelReorder( void *ptr, size_t bytes, unsigned channels,
uint16_t
tmp
[
AOUT_CHAN_MAX
];
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
tmp
[
pi_chan
_table
[
j
]]
=
buf
[
j
];
tmp
[
chans
_table
[
j
]]
=
buf
[
j
];
memcpy
(
buf
,
tmp
,
2
*
channels
);
buf
+=
channels
;
...
...
@@ -327,7 +327,7 @@ void aout_ChannelReorder( void *ptr, size_t bytes, unsigned channels,
uint8_t
tmp
[
AOUT_CHAN_MAX
];
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
tmp
[
pi_chan
_table
[
j
]]
=
buf
[
j
];
tmp
[
chans
_table
[
j
]]
=
buf
[
j
];
memcpy
(
buf
,
tmp
,
channels
);
buf
+=
channels
;
...
...
@@ -344,7 +344,7 @@ void aout_ChannelReorder( void *ptr, size_t bytes, unsigned channels,
uint8_t
tmp
[
3
*
AOUT_CHAN_MAX
];
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
memcpy
(
tmp
+
(
3
*
pi_chan
_table
[
j
]),
buf
+
(
3
*
j
),
3
);
memcpy
(
tmp
+
(
3
*
chans
_table
[
j
]),
buf
+
(
3
*
j
),
3
);
memcpy
(
buf
,
tmp
,
3
*
channels
);
buf
+=
3
*
channels
;
...
...
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