From 33b2d8257dcf62daf519ad8fb990fcad929313a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 7 Jan 2016 23:44:00 +0100 Subject: [PATCH] lavu: rename and move ff_parity to av_parity av_popcount is not defined in intmath.h. Found-by: jamrial --- libavcodec/ccaption_dec.c | 4 ++-- libavcodec/g729dec.c | 2 +- libavutil/common.h | 12 ++++++++++++ libavutil/intmath.h | 12 ------------ libavutil/version.h | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c index bdfe35f..310f25e 100644 --- a/libavcodec/ccaption_dec.c +++ b/libavcodec/ccaption_dec.c @@ -202,10 +202,10 @@ static int validate_cc_data_pair(uint8_t *cc_data_pair) // if EIA-608 data then verify parity. if (cc_type==0 || cc_type==1) { - if (!ff_parity(cc_data_pair[2])) { + if (!av_parity(cc_data_pair[2])) { return AVERROR_INVALIDDATA; } - if (!ff_parity(cc_data_pair[1])) { + if (!av_parity(cc_data_pair[1])) { cc_data_pair[1]=0x7F; } } diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c index 7265883..2e1bf18 100644 --- a/libavcodec/g729dec.c +++ b/libavcodec/g729dec.c @@ -472,7 +472,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, ac_index = get_bits(&gb, format->ac_index_bits[i]); if(!i && format->parity_bit) - bad_pitch = ff_parity(ac_index >> 2) == get_bits1(&gb); + bad_pitch = av_parity(ac_index >> 2) == get_bits1(&gb); fc_indexes = get_bits(&gb, format->fc_indexes_bits); pulses_signs = get_bits(&gb, format->fc_signs_bits); gc_1st_index = get_bits(&gb, format->gc_1st_index_bits); diff --git a/libavutil/common.h b/libavutil/common.h index 9ac04da..58f76f4 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -331,6 +331,15 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x) return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32)); } +static av_always_inline av_const int av_parity_c(uint32_t v) +{ +#if HAVE_PARITY + return __builtin_parity(v); +#else + return av_popcount(v) & 1; +#endif +} + #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) #define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) @@ -517,3 +526,6 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x) #ifndef av_popcount64 # define av_popcount64 av_popcount64_c #endif +#ifndef av_parity +# define av_parity av_parity_c +#endif diff --git a/libavutil/intmath.h b/libavutil/intmath.h index 17c4f1b..82193a6 100644 --- a/libavutil/intmath.h +++ b/libavutil/intmath.h @@ -153,18 +153,6 @@ static av_always_inline av_const unsigned ff_clz_c(unsigned x) } #endif -#ifndef ff_parity -#define ff_parity ff_parity_c -static av_always_inline av_const int ff_parity_c(uint32_t v) -{ -#if HAVE_PARITY - return __builtin_parity(v); -#else - return av_popcount(v) & 1; -#endif -} -#endif - /** * @} */ diff --git a/libavutil/version.h b/libavutil/version.h index 9ffa7a8..a99b50e 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -64,7 +64,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 55 -#define LIBAVUTIL_VERSION_MINOR 12 +#define LIBAVUTIL_VERSION_MINOR 13 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.6.4