Commit ab23a02c authored by Kamil Rytarowski's avatar Kamil Rytarowski Committed by Rémi Denis-Courmont

Rename popcount to vlc_popcount

This removes conflicts with the NetBSD headers and libc.
The conflicts caused fatal build errors.

No functional change intended for other Operating Systems.
Signed-off-by: Rémi Denis-Courmont's avatarRémi Denis-Courmont <remi@remlab.net>
parent 81400320
......@@ -281,7 +281,7 @@ VLC_API void aout_ChannelExtract( void *p_dst, int i_dst_channels, const void *p
/* */
static inline unsigned aout_FormatNbChannels(const audio_sample_format_t *fmt)
{
return popcount(fmt->i_physical_channels);
return vlc_popcount(fmt->i_physical_channels);
}
VLC_API unsigned int aout_BitsPerSample( vlc_fourcc_t i_format ) VLC_USED;
......
......@@ -605,7 +605,7 @@ static inline uint8_t clip_uint8_vlc( int32_t a )
unsigned long: __builtin_ctzl(x), \
unsigned long long: __builtin_ctzll(x))
# define popcount(x) \
# define vlc_popcount(x) \
_Generic((x), \
unsigned char: __builtin_popcount(x), \
signed char: __builtin_popcount((unsigned char)(x)), \
......@@ -647,27 +647,27 @@ VLC_USED static inline int ctz(unsigned long long x)
return __builtin_ctzll(x);
}
VLC_USED static inline int popcount(unsigned char x)
VLC_USED static inline int vlc_popcount(unsigned char x)
{
return __builtin_popcount(x);
}
VLC_USED static inline int popcount(unsigned short x)
VLC_USED static inline int vlc_popcount(unsigned short x)
{
return __builtin_popcount(x);
}
VLC_USED static inline int popcount(unsigned x)
VLC_USED static inline int vlc_popcount(unsigned x)
{
return __builtin_popcount(x);
}
VLC_USED static inline int popcount(unsigned long x)
VLC_USED static inline int vlc_popcount(unsigned long x)
{
return __builtin_popcountl(x);
}
VLC_USED static inline int popcount(unsigned long long x)
VLC_USED static inline int vlc_popcount(unsigned long long x)
{
return __builtin_popcountll(x);
}
......@@ -745,7 +745,7 @@ VLC_USED static inline int ctz(unsigned long long x)
return i;
}
VLC_USED static inline int popcount(unsigned long long x)
VLC_USED static inline int vlc_popcount(unsigned long long x)
{
int count = 0;
while (x)
......@@ -764,18 +764,18 @@ VLC_USED static inline int popcount(unsigned long long x)
*
* \return The count of non-zero bits.
*/
# define popcount(x) \
# define vlc_popcount(x) \
_Generic((x), \
unsigned char: popcount(x), \
signed char: popcount((unsigned char)(x)), \
unsigned short: popcount(x), \
signed short: popcount((unsigned short)(x)), \
unsigned int: popcount(x), \
signed int: popcount((unsigned int)(x)), \
unsigned long: popcount(x), \
signed long: popcount((unsigned long)(x)), \
unsigned long long: popcount(x), \
signed long long: popcount(x))
unsigned char: vlc_popcount(x), \
signed char: vlc_popcount((unsigned char)(x)), \
unsigned short: vlc_popcount(x), \
signed short: vlc_popcount((unsigned short)(x)), \
unsigned int: vlc_popcount(x), \
signed int: vlc_popcount((unsigned int)(x)), \
unsigned long: vlc_popcount(x), \
signed long: vlc_popcount((unsigned long)(x)), \
unsigned long long: vlc_popcount(x), \
signed long long: vlc_popcount(x))
# endif
/**
......
......@@ -143,7 +143,7 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
if (wfe->dwChannelMask & SPEAKER_LOW_FREQUENCY)
fmt->i_physical_channels |= AOUT_CHAN_LFE;
assert(popcount(wfe->dwChannelMask) == wf->nChannels);
assert(vlc_popcount(wfe->dwChannelMask) == wf->nChannels);
if (IsEqualIID(&wfe->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM))
{
......
......@@ -321,7 +321,7 @@ static int OpenFilter( vlc_object_t *p_this )
}
i_output_physical = CanonicaliseChannels( i_output_physical );
unsigned i_channels = popcount(i_output_physical);
unsigned i_channels = vlc_popcount(i_output_physical);
/* condense out_channels */
uint8_t out_ch_sorted[ AOUT_CHAN_MAX ];
......
......@@ -242,8 +242,8 @@ static unsigned SetupChannels (vlc_object_t *obj, snd_pcm_t *pcm,
if (chans == -1)
continue;
unsigned score = (popcount (chans & *mask) << 8)
| (255 - popcount (chans));
unsigned score = (vlc_popcount (chans & *mask) << 8)
| (255 - vlc_popcount (chans));
if (score > best_score)
{
best_offset = p - maps;
......@@ -469,7 +469,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
sys->chans_to_reorder = SetupChannels (VLC_OBJECT(aout), pcm, &map,
sys->chans_table);
fmt->i_physical_channels = map;
channels = popcount (map);
channels = vlc_popcount (map);
}
else
{
......
......@@ -517,7 +517,7 @@ static HRESULT CreateDSBufferPCM( vlc_object_t *obj, aout_stream_sys_t *sys,
int i_rate, bool b_probe )
{
HRESULT hr;
unsigned i_nb_channels = popcount( i_channels );
unsigned i_nb_channels = vlc_popcount( i_channels );
if( var_GetBool( obj, "directx-audio-float32" ) )
{
......
......@@ -533,7 +533,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
b_reorder = aout_CheckChannelReorder( pi_faad_channels_positions, NULL,
p_dec->fmt_out.audio.i_physical_channels, pi_neworder_table );
p_dec->fmt_out.audio.i_channels = popcount(p_dec->fmt_out.audio.i_physical_channels);
p_dec->fmt_out.audio.i_channels = vlc_popcount(p_dec->fmt_out.audio.i_physical_channels);
}
if( !decoder_UpdateAudioFormat( p_dec ) && p_dec->fmt_out.audio.i_channels > 0 )
......@@ -549,7 +549,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
if ( p_dec->fmt_out.audio.channel_type == AUDIO_CHANNEL_TYPE_BITMAP )
{
/* Don't kill speakers if some weird mapping does not gets 1:1 */
if( popcount(p_dec->fmt_out.audio.i_physical_channels) != frame.channels )
if( vlc_popcount(p_dec->fmt_out.audio.i_physical_channels) != frame.channels )
memset( p_out->p_buffer, 0, p_out->i_buffer );
}
......
......@@ -340,7 +340,7 @@ static void DecoderMetadataCallback( const FLAC__StreamDecoder *decoder,
{
char *endptr = (char *) &comment->entry[34] + comment->length;
const uint32_t i_wfxmask = strtoul( (char *) &comment->entry[34], &endptr, 16 );
const unsigned i_wfxchannels = popcount( i_wfxmask );
const unsigned i_wfxchannels = vlc_popcount( i_wfxmask );
if( i_wfxchannels > 0 && i_wfxchannels <= AOUT_CHAN_MAX )
{
/* Create the vlc bitmap from wfx channels */
......@@ -356,7 +356,7 @@ static void DecoderMetadataCallback( const FLAC__StreamDecoder *decoder,
}
}
/* Check if we have the 1 to 1 mapping */
if( popcount(i_vlcmask) != i_wfxchannels )
if( vlc_popcount(i_vlcmask) != i_wfxchannels )
{
msg_Warn( p_dec, "Unsupported channel mask %x", i_wfxmask );
return;
......
......@@ -544,7 +544,7 @@ void BuildPMT( dvbpsi_t *p_dvbpsi, vlc_object_t *p_object,
else if( p_stream->fmt->i_codec == VLC_CODEC_DTS )
{
/* DTS registration descriptor (ETSI TS 101 154 Annex F) */
if(popcount(p_stream->fmt->audio.i_bytes_per_frame) == 1)
if(vlc_popcount(p_stream->fmt->audio.i_bytes_per_frame) == 1)
{
uint8_t i_ver = ctz( p_stream->fmt->audio.i_bytes_per_frame >> 8 );
if(i_ver > 0 && i_ver < 4)
......
......@@ -163,7 +163,7 @@ static inline int vlc_a52_header_ParseAc3( vlc_a52_header_t *p_header,
if( i_lfeon )
p_header->i_channels_conf |= AOUT_CHAN_LFE;
p_header->i_channels = popcount(p_header->i_channels_conf);
p_header->i_channels = vlc_popcount(p_header->i_channels_conf);
const unsigned i_rate_shift = VLC_CLIP(i_bsid, 8, 11) - 8;
p_header->i_bitrate = (pi_frmsizcod_bitrates[i_frmsizcod >> 1] * 1000)
......@@ -223,7 +223,7 @@ static inline int vlc_a52_header_ParseEac3( vlc_a52_header_t *p_header,
p_header->i_chan_mode |= AOUT_CHANMODE_DUALMONO;
if( i_lfeon )
p_header->i_channels_conf |= AOUT_CHAN_LFE;
p_header->i_channels = popcount( p_header->i_channels_conf );
p_header->i_channels = vlc_popcount( p_header->i_channels_conf );
p_header->i_bitrate = 8 * p_header->i_size * p_header->i_rate
/ (p_header->i_blocks_per_sync_frame * 256);
p_header->i_samples = p_header->i_blocks_per_sync_frame * 256;
......
......@@ -105,7 +105,7 @@ static block_t *GetOutBuffer( decoder_t *p_dec )
p_dec->fmt_out.audio.i_chan_mode = p_sys->dts.i_chan_mode;
p_dec->fmt_out.audio.i_physical_channels = p_sys->dts.i_physical_channels;
p_dec->fmt_out.audio.i_channels =
popcount( p_dec->fmt_out.audio.i_physical_channels );
vlc_popcount( p_dec->fmt_out.audio.i_physical_channels );
p_dec->fmt_out.i_bitrate = p_sys->dts.i_bitrate;
......
......@@ -266,7 +266,7 @@ static inline void hxxx_iterator_init( hxxx_iterator_ctx_t *p_ctx, const uint8_t
{
p_ctx->p_head = p_data;
p_ctx->p_tail = p_data + i_data;
if( popcount(i_nal_length_size) == 1 && i_nal_length_size <= 4 )
if( vlc_popcount(i_nal_length_size) == 1 && i_nal_length_size <= 4 )
p_ctx->i_nal_length_size = i_nal_length_size;
else
p_ctx->i_nal_length_size = 0;
......
......@@ -141,7 +141,7 @@ static vlc_fourcc_t ParseFormat (vlc_object_t *obj,
switch (f->num_planes)
{
case 1:
switch (popcount (f->red_mask | f->green_mask | f->blue_mask))
switch (vlc_popcount (f->red_mask | f->green_mask | f->blue_mask))
{
case 24:
if (f->bpp == 32 && f->depth == 32)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment