From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH] avcodec/tiff: Use ff_tget_long() where appropriate Date: Tue, 12 Mar 2024 15:49:45 +0100 Message-ID: <AS8P250MB0744F93F5B5C282DEE0673DC8F2B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw) No need to use the generic ff_tget() when we know the type. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/tiff.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 8f278bfd12..3238b208d8 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1269,8 +1269,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) value = ff_tget(&s->gb, type, s->le); break; case TIFF_RATIONAL: - value = ff_tget(&s->gb, TIFF_LONG, s->le); - value2 = ff_tget(&s->gb, TIFF_LONG, s->le); + value = ff_tget_long(&s->gb, s->le); + value2 = ff_tget_long(&s->gb, s->le); if (!value2) { av_log(s->avctx, AV_LOG_WARNING, "Invalid denominator in rational\n"); value2 = 1; @@ -1437,7 +1437,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) if (count == 1) s->sub_ifd = value; else if (count > 1) - s->sub_ifd = ff_tget(&s->gb, TIFF_LONG, s->le); /** Only get the first SubIFD */ + s->sub_ifd = ff_tget_long(&s->gb, s->le); /** Only get the first SubIFD */ break; case TIFF_GRAY_RESPONSE_CURVE: case DNG_LINEARIZATION_TABLE: @@ -1453,8 +1453,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) s->black_level[0] = value / (float)value2; for (int i = 0; i < count && count > 1; i++) { if (type == TIFF_RATIONAL) { - value = ff_tget(&s->gb, TIFF_LONG, s->le); - value2 = ff_tget(&s->gb, TIFF_LONG, s->le); + value = ff_tget_long(&s->gb, s->le); + value2 = ff_tget_long(&s->gb, s->le); if (!value2) { av_log(s->avctx, AV_LOG_WARNING, "Invalid denominator\n"); value2 = 1; @@ -1462,8 +1462,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) s->black_level[i] = value / (float)value2; } else if (type == TIFF_SRATIONAL) { - int value = ff_tget(&s->gb, TIFF_LONG, s->le); - int value2 = ff_tget(&s->gb, TIFF_LONG, s->le); + int value = ff_tget_long(&s->gb, s->le); + int value2 = ff_tget_long(&s->gb, s->le); if (!value2) { av_log(s->avctx, AV_LOG_WARNING, "Invalid denominator\n"); value2 = 1; @@ -1740,7 +1740,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) // need to seek back to re-read the page number bytestream2_seek(&s->gb, -count * sizeof(uint16_t), SEEK_CUR); // read the page number - s->cur_page = ff_tget(&s->gb, TIFF_SHORT, s->le); + s->cur_page = ff_tget_short(&s->gb, s->le); // get back to where we were before the previous seek bytestream2_seek(&s->gb, count * sizeof(uint16_t) - sizeof(uint16_t), SEEK_CUR); break; @@ -1766,8 +1766,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) break; for (int i = 0; i < 3; i++) { - value = ff_tget(&s->gb, TIFF_LONG, s->le); - value2 = ff_tget(&s->gb, TIFF_LONG, s->le); + value = ff_tget_long(&s->gb, s->le); + value2 = ff_tget_long(&s->gb, s->le); if (!value2) { av_log(s->avctx, AV_LOG_WARNING, "Invalid denominator\n"); value2 = 1; @@ -1781,8 +1781,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) break; for (int i = 0; i < 3; i++) { - value = ff_tget(&s->gb, TIFF_LONG, s->le); - value2 = ff_tget(&s->gb, TIFF_LONG, s->le); + value = ff_tget_long(&s->gb, s->le); + value2 = ff_tget_long(&s->gb, s->le); if (!value2) { av_log(s->avctx, AV_LOG_WARNING, "Invalid denominator\n"); value2 = 1; @@ -1796,8 +1796,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) break; for (int i = 0; i < 2; i++) { - value = ff_tget(&s->gb, TIFF_LONG, s->le); - value2 = ff_tget(&s->gb, TIFF_LONG, s->le); + value = ff_tget_long(&s->gb, s->le); + value2 = ff_tget_long(&s->gb, s->le); if (!value2) { av_log(s->avctx, AV_LOG_WARNING, "Invalid denominator\n"); value2 = 1; @@ -1814,8 +1814,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) case DNG_COLOR_MATRIX2: for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - int value = ff_tget(&s->gb, TIFF_LONG, s->le); - int value2 = ff_tget(&s->gb, TIFF_LONG, s->le); + int value = ff_tget_long(&s->gb, s->le); + int value2 = ff_tget_long(&s->gb, s->le); if (!value2) { av_log(s->avctx, AV_LOG_WARNING, "Invalid denominator\n"); value2 = 1; @@ -1829,8 +1829,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) case DNG_CAMERA_CALIBRATION2: for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - int value = ff_tget(&s->gb, TIFF_LONG, s->le); - int value2 = ff_tget(&s->gb, TIFF_LONG, s->le); + int value = ff_tget_long(&s->gb, s->le); + int value2 = ff_tget_long(&s->gb, s->le); if (!value2) { av_log(s->avctx, AV_LOG_WARNING, "Invalid denominator\n"); value2 = 1; -- 2.40.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2024-03-12 14:50 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-12 14:49 Andreas Rheinhardt [this message] 2024-03-12 16:53 ` Stefano Sabatini
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=AS8P250MB0744F93F5B5C282DEE0673DC8F2B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \ --to=andreas.rheinhardt@outlook.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git