On 1/8/2017 10:14 AM, Steinar H. Gunderson wrote: > Allows more codecs than mpeg12video to make use of it. Rename to > av_bitswap_32() > because it's a public symbol now.
mathops.h is not a public header. You can keep the bitswap_32() name or use ff_bitswap_32() instead. Also, when moving code in general we expect a patch that makes use of said code as part of a set. > --- > libavcodec/bitstream.c | 14 +++----------- > libavcodec/mathops.h | 8 ++++++++ > 2 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c > index 6c8dca1d85..5d37430540 100644 > --- a/libavcodec/bitstream.c > +++ b/libavcodec/bitstream.c > @@ -128,14 +128,6 @@ static int alloc_table(VLC *vlc, int size, int > use_static) > return index; > } > > -static av_always_inline uint32_t bitswap_32(uint32_t x) > -{ > - return (uint32_t)ff_reverse[ x & 0xFF] << 24 | > - (uint32_t)ff_reverse[(x >> 8) & 0xFF] << 16 | > - (uint32_t)ff_reverse[(x >> 16) & 0xFF] << 8 | > - (uint32_t)ff_reverse[ x >> 24]; > -} > - > typedef struct VLCcode { > uint8_t bits; > uint16_t symbol; > @@ -192,7 +184,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int > nb_codes, > nb = 1 << (table_nb_bits - n); > inc = 1; > if (flags & INIT_VLC_LE) { > - j = bitswap_32(code); > + j = av_bitswap_32(code); > inc = 1 << n; > } > for (k = 0; k < nb; k++) { > @@ -225,7 +217,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int > nb_codes, > subtable_bits = FFMAX(subtable_bits, n); > } > subtable_bits = FFMIN(subtable_bits, table_nb_bits); > - j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - > table_nb_bits) : code_prefix; > + j = (flags & INIT_VLC_LE) ? av_bitswap_32(code_prefix) >> (32 - > table_nb_bits) : code_prefix; > table[j][1] = -subtable_bits; > ff_dlog(NULL, "%4x: n=%d (subtable)\n", > j, codes[i].bits + table_nb_bits); > @@ -325,7 +317,7 @@ int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int > nb_codes, > return -1; \ > } \ > if (flags & INIT_VLC_LE) \ > - buf[j].code = bitswap_32(buf[j].code); \ > + buf[j].code = av_bitswap_32(buf[j].code); \ > else \ > buf[j].code <<= 32 - buf[j].bits; \ > if (symbols) \ > diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h > index 5168dc2ce0..65dc8f21f1 100644 > --- a/libavcodec/mathops.h > +++ b/libavcodec/mathops.h > @@ -249,4 +249,12 @@ static inline int8_t ff_u8_to_s8(uint8_t a) > return b.s8; > } > > +static av_always_inline uint32_t av_bitswap_32(uint32_t x) > +{ > + return (uint32_t)ff_reverse[ x & 0xFF] << 24 | > + (uint32_t)ff_reverse[(x >> 8) & 0xFF] << 16 | > + (uint32_t)ff_reverse[(x >> 16) & 0xFF] << 8 | > + (uint32_t)ff_reverse[ x >> 24]; > +} > + > #endif /* AVCODEC_MATHOPS_H */ > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel