@@ -469,8 +469,8 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length)
bitstream_size);
if (!f->bitstream_buffer)
return AVERROR(ENOMEM);
- f->bbdsp.bswap_buf(f->bitstream_buffer, (const uint32_t *) (buf + extra),
- bitstream_size / 4);
+ f->bbdsp.bswap32_buf(f->bitstream_buffer, (const uint32_t *) (buf + extra),
+ bitstream_size / 4);
init_get_bits(&f->gb, f->bitstream_buffer, 8 * bitstream_size);
wordstream_offset = extra + bitstream_size;
@@ -813,8 +813,8 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
prestream_size);
if (!f->bitstream_buffer)
return AVERROR(ENOMEM);
- f->bbdsp.bswap_buf(f->bitstream_buffer, (const uint32_t *) prestream,
- prestream_size / 4);
+ f->bbdsp.bswap32_buf(f->bitstream_buffer, (const uint32_t *) prestream,
+ prestream_size / 4);
init_get_bits(&f->pre_gb, f->bitstream_buffer, 8 * prestream_size);
f->last_dc = 0 * 128 * 8 * 8;
@@ -1899,9 +1899,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
sample++)
*dest++ = av_bswap16(src[sample]);
} else {
- ctx->bdsp.bswap_buf((uint32_t *) ctx->crc_buffer,
- (uint32_t *) frame->data[0],
- ctx->cur_frame_length * channels);
+ ctx->bdsp.bswap32_buf((uint32_t *) ctx->crc_buffer,
+ (uint32_t *) frame->data[0],
+ ctx->cur_frame_length * channels);
}
crc_source = ctx->crc_buffer;
} else {
@@ -1499,8 +1499,8 @@ static int ape_decode_frame(AVCodecContext *avctx, AVFrame *frame,
av_fast_padded_malloc(&s->data, &s->data_size, buf_size);
if (!s->data)
return AVERROR(ENOMEM);
- s->bdsp.bswap_buf((uint32_t *) s->data, (const uint32_t *) buf,
- buf_size >> 2);
+ s->bdsp.bswap32_buf((uint32_t *) s->data, (const uint32_t *) buf,
+ buf_size >> 2);
memset(s->data + (buf_size & ~3), 0, buf_size & 3);
s->ptr = s->data;
s->data_end = s->data + buf_size;
@@ -253,8 +253,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
if (!a->bitstream_buffer)
return AVERROR(ENOMEM);
- c->bbdsp.bswap_buf((uint32_t *) a->bitstream_buffer,
- (const uint32_t *) buf, buf_size / 4);
+ c->bbdsp.bswap32_buf((uint32_t *) a->bitstream_buffer,
+ (const uint32_t *) buf, buf_size / 4);
ret = init_get_bits8(&a->gb, a->bitstream_buffer, buf_size);
} else {
ret = init_get_bits8_le(&a->gb, buf, buf_size);
@@ -309,8 +309,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
size = (put_bytes_output(&a->pb) + 3) / 4;
if (avctx->codec_id == AV_CODEC_ID_ASV1) {
- c->bbdsp.bswap_buf((uint32_t *) pkt->data,
- (uint32_t *) pkt->data, size);
+ c->bbdsp.bswap32_buf((uint32_t *) pkt->data,
+ (uint32_t *) pkt->data, size);
}
pkt->size = size * 4;
@@ -22,11 +22,11 @@
#include "libavutil/bswap.h"
#include "bswapdsp.h"
-static void bswap_buf(uint32_t *dst, const uint32_t *src, int w)
+static void bswap32_buf(uint32_t *dst, const uint32_t *src, int len)
{
int i;
- for (i = 0; i + 8 <= w; i += 8) {
+ for (i = 0; i + 8 <= len; i += 8) {
dst[i + 0] = av_bswap32(src[i + 0]);
dst[i + 1] = av_bswap32(src[i + 1]);
dst[i + 2] = av_bswap32(src[i + 2]);
@@ -36,7 +36,7 @@ static void bswap_buf(uint32_t *dst, const uint32_t *src, int w)
dst[i + 6] = av_bswap32(src[i + 6]);
dst[i + 7] = av_bswap32(src[i + 7]);
}
- for (; i < w; i++)
+ for (; i < len; i++)
dst[i + 0] = av_bswap32(src[i + 0]);
}
@@ -48,7 +48,7 @@ static void bswap16_buf(uint16_t *dst, const uint16_t *src, int len)
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
{
- c->bswap_buf = bswap_buf;
+ c->bswap32_buf = bswap32_buf;
c->bswap16_buf = bswap16_buf;
#if ARCH_RISCV
@@ -22,7 +22,7 @@
#include <stdint.h>
typedef struct BswapDSPContext {
- void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w);
+ void (*bswap32_buf)(uint32_t *dst, const uint32_t *src, int len);
void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len);
} BswapDSPContext;
@@ -148,8 +148,8 @@ static int tqi_decode_frame(AVCodecContext *avctx, AVFrame *frame,
buf_end - buf);
if (!t->bitstream_buf)
return AVERROR(ENOMEM);
- t->bsdsp.bswap_buf(t->bitstream_buf, (const uint32_t *) buf,
- (buf_end - buf) / 4);
+ t->bsdsp.bswap32_buf(t->bitstream_buf, (const uint32_t *) buf,
+ (buf_end - buf) / 4);
init_get_bits(&t->gb, t->bitstream_buf, 8 * (buf_end - buf));
t->last_dc[0] =
@@ -106,8 +106,8 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,
/* we have built Huffman table and are ready to decode plane */
/* convert bits so they may be used by standard bitreader */
- s->bdsp.bswap_buf((uint32_t *) s->tmpbuf,
- (const uint32_t *) src, size >> 2);
+ s->bdsp.bswap32_buf((uint32_t *) s->tmpbuf,
+ (const uint32_t *) src, size >> 2);
if ((ret = init_get_bits8(&gb, s->tmpbuf, size)) < 0)
return ret;
@@ -1239,8 +1239,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
if (!s->bitstream_buffer)
return AVERROR(ENOMEM);
- s->bdsp.bswap_buf((uint32_t *) s->bitstream_buffer,
- (const uint32_t *) buf, buf_size / 4);
+ s->bdsp.bswap32_buf((uint32_t *) s->bitstream_buffer,
+ (const uint32_t *) buf, buf_size / 4);
if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0)
return ret;
@@ -1282,8 +1282,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
return AVERROR_INVALIDDATA;
y_offset = height - (slice + 1) * slice_height;
- s->bdsp.bswap_buf((uint32_t *)s->bitstream_buffer,
- (const uint32_t *)(buf + slice_offset), slice_size / 4);
+ s->bdsp.bswap32_buf((uint32_t *)s->bitstream_buffer,
+ (const uint32_t *)(buf + slice_offset), slice_size / 4);
} else {
y_offset = 0;
slice_offset = 0;
@@ -1018,7 +1018,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
avctx->stats_out[0] = '\0';
if (!(s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT)) {
flush_put_bits(&s->pb);
- s->bdsp.bswap_buf((uint32_t *) pkt->data, (uint32_t *) pkt->data, size);
+ s->bdsp.bswap32_buf((uint32_t *) pkt->data, (uint32_t *) pkt->data, size);
}
s->picture_number++;
@@ -368,9 +368,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (!s->bitstream)
return AVERROR(ENOMEM);
- s->bdsp.bswap_buf((uint32_t *)s->bitstream,
- (uint32_t *)avpkt->data,
- (avpkt->size + 3) >> 2);
+ s->bdsp.bswap32_buf((uint32_t *)s->bitstream,
+ (uint32_t *)avpkt->data,
+ (avpkt->size + 3) >> 2);
if ((ret = init_get_bits8(gb, s->bitstream, FFALIGN(avpkt->size, 4))) < 0)
return ret;
@@ -411,9 +411,9 @@ static int mimic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if (!ctx->swap_buf)
return AVERROR(ENOMEM);
- ctx->bbdsp.bswap_buf(ctx->swap_buf,
- (const uint32_t *) (buf + MIMIC_HEADER_SIZE),
- swap_buf_size >> 2);
+ ctx->bbdsp.bswap32_buf(ctx->swap_buf,
+ (const uint32_t *) (buf + MIMIC_HEADER_SIZE),
+ swap_buf_size >> 2);
init_get_bits(&ctx->gb, ctx->swap_buf, swap_buf_size << 3);
res = decode(ctx, quality, num_coeffs, !is_pframe);
@@ -294,8 +294,8 @@ static int mp_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
av_fast_padded_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size);
if (!mp->bswapbuf)
return AVERROR(ENOMEM);
- mp->bdsp.bswap_buf((uint32_t *) mp->bswapbuf, (const uint32_t *) buf,
- buf_size / 4);
+ mp->bdsp.bswap32_buf((uint32_t *) mp->bswapbuf, (const uint32_t *) buf,
+ buf_size / 4);
if (buf_size & 3)
memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3);
init_get_bits(&gb, mp->bswapbuf, buf_size * 8);
@@ -93,7 +93,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx)
av_lfg_init(&c->rnd, 0xDEADBEEF);
ff_bswapdsp_init(&c->bdsp);
ff_mpadsp_init(&c->mpadsp);
- c->bdsp.bswap_buf((uint32_t *) buf, (const uint32_t *) avctx->extradata, 4);
+ c->bdsp.bswap32_buf((uint32_t *) buf, (const uint32_t *) avctx->extradata, 4);
init_get_bits(&gb, buf, 128);
c->IS = get_bits1(&gb);
@@ -211,7 +211,7 @@ static int mpc7_decode_frame(AVCodecContext *avctx, AVFrame *frame,
av_fast_padded_malloc(&c->bits, &c->buf_size, buf_size);
if (!c->bits)
return AVERROR(ENOMEM);
- c->bdsp.bswap_buf((uint32_t *) c->bits, (const uint32_t *) buf,
+ c->bdsp.bswap32_buf((uint32_t *) c->bits, (const uint32_t *) buf,
buf_size >> 2);
if ((ret = init_get_bits8(&gb, c->bits, buf_size)) < 0)
return ret;
@@ -321,7 +321,7 @@ static int raw_decode(AVCodecContext *avctx, AVFrame *frame,
if (swap == 16)
context->bbdsp.bswap16_buf(context->bitstream_buf, (const uint16_t*)buf, buf_size / 2);
else if (swap == 32)
- context->bbdsp.bswap_buf(context->bitstream_buf, (const uint32_t*)buf, buf_size / 4);
+ context->bbdsp.bswap32_buf(context->bitstream_buf, (const uint32_t*)buf, buf_size / 4);
else
return AVERROR_INVALIDDATA;
buf = context->bitstream_buf;
@@ -35,11 +35,11 @@ av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)
#if (__riscv_xlen >= 64)
if (cpu_flags & AV_CPU_FLAG_RVB_BASIC)
- c->bswap_buf = ff_bswap32_buf_rvb;
+ c->bswap32_buf = ff_bswap32_buf_rvb;
#endif
#if HAVE_RVV
if (cpu_flags & AV_CPU_FLAG_RVV_I32) {
- c->bswap_buf = ff_bswap32_buf_rvv;
+ c->bswap32_buf = ff_bswap32_buf_rvv;
c->bswap16_buf = ff_bswap16_buf_rvv;
}
#endif
@@ -907,8 +907,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if ((ret = ff_reget_buffer(avctx, p, 0)) < 0)
return ret;
- l->bdsp.bswap_buf((uint32_t *) l->buffer, (const uint32_t *) buf,
- buf_size >> 2);
+ l->bdsp.bswap32_buf((uint32_t *) l->buffer, (const uint32_t *) buf,
+ buf_size >> 2);
if ((ret = tm2_read_header(l, l->buffer)) < 0) {
return ret;
@@ -82,7 +82,7 @@ static void truespeech_read_frame(TSContext *dec, const uint8_t *input)
{
GetBitContext gb;
- dec->bdsp.bswap_buf((uint32_t *) dec->buffer, (const uint32_t *) input, 8);
+ dec->bdsp.bswap32_buf((uint32_t *) dec->buffer, (const uint32_t *) input, 8);
init_get_bits(&gb, dec->buffer, 32 * 8);
dec->vector[7] = ts_codebook[7][get_bits(&gb, 3)];
@@ -150,9 +150,9 @@ static int decode_plane10(UtvideoContext *c, int plane_no,
}
memset(c->slice_bits + slice_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
- c->bdsp.bswap_buf((uint32_t *) c->slice_bits,
- (uint32_t *)(src + slice_data_start + c->slices * 4),
- (slice_data_end - slice_data_start + 3) >> 2);
+ c->bdsp.bswap32_buf((uint32_t *) c->slice_bits,
+ (uint32_t *)(src + slice_data_start + c->slices * 4),
+ (slice_data_end - slice_data_start + 3) >> 2);
init_get_bits(&gb, c->slice_bits, slice_size * 8);
prev = 0x200;
@@ -311,9 +311,9 @@ static int decode_plane(UtvideoContext *c, int plane_no,
}
memset(c->slice_bits + slice_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
- c->bdsp.bswap_buf((uint32_t *) c->slice_bits,
- (uint32_t *)(src + slice_data_start + c->slices * 4),
- (slice_data_end - slice_data_start + 3) >> 2);
+ c->bdsp.bswap32_buf((uint32_t *) c->slice_bits,
+ (uint32_t *)(src + slice_data_start + c->slices * 4),
+ (slice_data_end - slice_data_start + 3) >> 2);
init_get_bits(&gb, c->slice_bits, slice_size * 8);
prev = 0x80;
@@ -490,9 +490,9 @@ static int encode_plane(AVCodecContext *avctx, const uint8_t *src,
slice_len = offset - slice_len;
/* Byteswap the written huffman codes */
- c->bdsp.bswap_buf((uint32_t *) c->slice_bits,
- (uint32_t *) c->slice_bits,
- slice_len >> 2);
+ c->bdsp.bswap32_buf((uint32_t *) c->slice_bits,
+ (uint32_t *) c->slice_bits,
+ slice_len >> 2);
/* Write the offset to the stream */
bytestream2_put_le32(pb, offset);
@@ -97,7 +97,7 @@ SECTION .text
add r0, 16
%endmacro
-; void ff_bswap_buf(uint32_t *dst, const uint32_t *src, int w);
+; void ff_.bswap32_buf(uint32_t *dst, const uint32_t *src, int w);
%macro BSWAP32_BUF 0
%if cpuflag(ssse3)||cpuflag(avx2)
cglobal bswap32_buf, 3,4,3
@@ -32,9 +32,9 @@ av_cold void ff_bswapdsp_init_x86(BswapDSPContext *c)
int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_SSE2(cpu_flags))
- c->bswap_buf = ff_bswap32_buf_sse2;
+ c->bswap32_buf = ff_bswap32_buf_sse2;
if (EXTERNAL_SSSE3(cpu_flags))
- c->bswap_buf = ff_bswap32_buf_ssse3;
+ c->bswap32_buf = ff_bswap32_buf_ssse3;
if (EXTERNAL_AVX2_FAST(cpu_flags))
- c->bswap_buf = ff_bswap32_buf_avx2;
+ c->bswap32_buf = ff_bswap32_buf_avx2;
}
@@ -311,9 +311,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
memcpy(s->buffer, avpkt->data + toffset, boffset - toffset);
memset(s->buffer + boffset - toffset, 0, AV_INPUT_BUFFER_PADDING_SIZE);
- s->bdsp.bswap_buf((uint32_t *) s->buffer,
- (uint32_t *) s->buffer,
- (boffset - toffset + 3) >> 2);
+ s->bdsp.bswap32_buf((uint32_t *) s->buffer,
+ (uint32_t *) s->buffer,
+ (boffset - toffset + 3) >> 2);
if ((ret = init_get_bits8(&gb, s->buffer, boffset - toffset)) < 0)
return ret;
@@ -332,9 +332,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
memcpy(s->buffer, avpkt->data + boffset, avpkt->size - boffset);
memset(s->buffer + avpkt->size - boffset, 0, AV_INPUT_BUFFER_PADDING_SIZE);
- s->bdsp.bswap_buf((uint32_t *) s->buffer,
- (uint32_t *) s->buffer,
- (avpkt->size - boffset) >> 2);
+ s->bdsp.bswap32_buf((uint32_t *) s->buffer,
+ (uint32_t *) s->buffer,
+ (avpkt->size - boffset) >> 2);
if ((ret = init_get_bits8(&gb, s->buffer, avpkt->size - boffset)) < 0)
return ret;
@@ -67,7 +67,7 @@ void checkasm_check_bswapdsp(void)
ff_bswapdsp_init(&h);
- if (check_func(h.bswap_buf, "bswap_buf"))
+ if (check_func(h.bswap32_buf, "bswap32_buf"))
check_bswap(uint32_t);
if (check_func(h.bswap16_buf, "bswap16_buf"))
From: Mark Reid <mindmark@gmail.com> --- libavcodec/4xm.c | 8 ++++---- libavcodec/alsdec.c | 6 +++--- libavcodec/apedec.c | 4 ++-- libavcodec/asvdec.c | 4 ++-- libavcodec/asvenc.c | 4 ++-- libavcodec/bswapdsp.c | 8 ++++---- libavcodec/bswapdsp.h | 2 +- libavcodec/eatqi.c | 4 ++-- libavcodec/fraps.c | 4 ++-- libavcodec/huffyuvdec.c | 8 ++++---- libavcodec/huffyuvenc.c | 2 +- libavcodec/imm4.c | 6 +++--- libavcodec/mimic.c | 6 +++--- libavcodec/motionpixels.c | 4 ++-- libavcodec/mpc7.c | 4 ++-- libavcodec/rawdec.c | 2 +- libavcodec/riscv/bswapdsp_init.c | 4 ++-- libavcodec/truemotion2.c | 4 ++-- libavcodec/truespeech.c | 2 +- libavcodec/utvideodec.c | 12 ++++++------ libavcodec/utvideoenc.c | 6 +++--- libavcodec/x86/bswapdsp.asm | 2 +- libavcodec/x86/bswapdsp_init.c | 6 +++--- libavcodec/ylc.c | 12 ++++++------ tests/checkasm/bswapdsp.c | 2 +- 25 files changed, 63 insertions(+), 63 deletions(-)