diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-04-12 19:58:16 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-04-13 00:36:57 +0200 |
commit | cc0a4fa6304ce0f608a058dc80e3e1f5d7bcfe6a (patch) | |
tree | a899834a88862832f6dbe1d330fa8e1a76a9a1f5 /libavcodec/vbnenc.c | |
parent | 300dd79c3d764a5d38b914bb0f36ba195422068e (diff) | |
download | ffmpeg-cc0a4fa6304ce0f608a058dc80e3e1f5d7bcfe6a.tar.gz |
avcodec/vbn(dec|enc): Avoid always-false checks
Do this by switching to bytestream2_(get|put)_le32u() from
bytestream2_(get|put)_le32(); it has after all already been checked
that the packet contains at least a full header, making all
the implicit checks in bytestream2_(get|put)_le32() dead code.
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/vbnenc.c')
-rw-r--r-- | libavcodec/vbnenc.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libavcodec/vbnenc.c b/libavcodec/vbnenc.c index 03d36ccc86..ec04566a32 100644 --- a/libavcodec/vbnenc.c +++ b/libavcodec/vbnenc.c @@ -97,18 +97,18 @@ static int vbn_encode(AVCodecContext *avctx, AVPacket *pkt, memset(pkt->data, 0, VBN_HEADER_SIZE); bytestream2_init_writer(pb, pkt->data, pkt_size); - bytestream2_put_le32(pb, VBN_MAGIC); - bytestream2_put_le32(pb, VBN_MAJOR); - bytestream2_put_le32(pb, VBN_MINOR); - bytestream2_put_le32(pb, frame->width); - bytestream2_put_le32(pb, frame->height); - bytestream2_put_le32(pb, frame->format == AV_PIX_FMT_RGBA ? 4 : 3); - bytestream2_put_le32(pb, ctx->format); - bytestream2_put_le32(pb, frame->format == AV_PIX_FMT_RGBA ? VBN_PIX_RGBA : VBN_PIX_RGB); - bytestream2_put_le32(pb, 0); // mipmaps - bytestream2_put_le32(pb, pkt_size - VBN_HEADER_SIZE); + bytestream2_put_le32u(pb, VBN_MAGIC); + bytestream2_put_le32u(pb, VBN_MAJOR); + bytestream2_put_le32u(pb, VBN_MINOR); + bytestream2_put_le32u(pb, frame->width); + bytestream2_put_le32u(pb, frame->height); + bytestream2_put_le32u(pb, frame->format == AV_PIX_FMT_RGBA ? 4 : 3); + bytestream2_put_le32u(pb, ctx->format); + bytestream2_put_le32u(pb, frame->format == AV_PIX_FMT_RGBA ? VBN_PIX_RGBA : VBN_PIX_RGB); + bytestream2_put_le32u(pb, 0); // mipmaps + bytestream2_put_le32u(pb, pkt_size - VBN_HEADER_SIZE); bytestream2_seek_p(pb, 64, SEEK_SET); - bytestream2_put_le32(pb, pkt_size - VBN_HEADER_SIZE); + bytestream2_put_le32u(pb, pkt_size - VBN_HEADER_SIZE); if (ctx->format == VBN_FORMAT_DXT1 || ctx->format == VBN_FORMAT_DXT5) { ctx->enc.frame_data.in = (frame->height - 1) * frame->linesize[0] + frame->data[0]; |