From: James Almer <jamrial@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] avcodec/j2kenc: use uint64_t type for the lambda value Date: Sat, 24 Jun 2023 14:12:45 -0300 Message-ID: <20230624171245.740-1-jamrial@gmail.com> (raw) Should fix integer overflows, and improve encoding results. Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/j2kenc.c | 4 ++-- tests/ref/vsynth/vsynth1-jpeg2000-yuva444p16 | 8 ++++---- tests/ref/vsynth/vsynth2-jpeg2000-yuva444p16 | 8 ++++---- tests/ref/vsynth/vsynth3-jpeg2000-yuva444p16 | 8 ++++---- tests/ref/vsynth/vsynth_lena-jpeg2000-yuva444p16 | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c index 2b0c58cff4..5f95b772d1 100644 --- a/libavcodec/j2kenc.c +++ b/libavcodec/j2kenc.c @@ -127,7 +127,7 @@ typedef struct { uint8_t *buf_end; int bit_index; - int64_t lambda; + uint64_t lambda; Jpeg2000CodingStyle codsty; Jpeg2000QuantStyle qntsty; @@ -1348,7 +1348,7 @@ static void makelayers(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile) } } -static int getcut(Jpeg2000Cblk *cblk, int64_t lambda, int dwt_norm) +static int getcut(Jpeg2000Cblk *cblk, uint64_t lambda, int dwt_norm) { int passno, res = 0; for (passno = 0; passno < cblk->npasses; passno++){ diff --git a/tests/ref/vsynth/vsynth1-jpeg2000-yuva444p16 b/tests/ref/vsynth/vsynth1-jpeg2000-yuva444p16 index 363ddc4ffa..f3d3ba8a6c 100644 --- a/tests/ref/vsynth/vsynth1-jpeg2000-yuva444p16 +++ b/tests/ref/vsynth/vsynth1-jpeg2000-yuva444p16 @@ -1,4 +1,4 @@ -9261706cfd4dfd8db38fc9bdafe6bef7 *tests/data/fate/vsynth1-jpeg2000-yuva444p16.avi -12433462 tests/data/fate/vsynth1-jpeg2000-yuva444p16.avi -6bc7131cd19dbb59339bb13a6d53b94d *tests/data/fate/vsynth1-jpeg2000-yuva444p16.out.rawvideo -stddev: 12.97 PSNR: 25.87 MAXDIFF: 169 bytes: 7603200/ 7603200 +4c051562f5ac7c9871e034917326787c *tests/data/fate/vsynth1-jpeg2000-yuva444p16.avi +12502390 tests/data/fate/vsynth1-jpeg2000-yuva444p16.avi +59d53e883f76d41d17c926236ca9d7d2 *tests/data/fate/vsynth1-jpeg2000-yuva444p16.out.rawvideo +stddev: 2.66 PSNR: 39.62 MAXDIFF: 44 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-jpeg2000-yuva444p16 b/tests/ref/vsynth/vsynth2-jpeg2000-yuva444p16 index bec08da307..3cbe5f4ad2 100644 --- a/tests/ref/vsynth/vsynth2-jpeg2000-yuva444p16 +++ b/tests/ref/vsynth/vsynth2-jpeg2000-yuva444p16 @@ -1,4 +1,4 @@ -54063ab98e48b2a079b63643fe26e082 *tests/data/fate/vsynth2-jpeg2000-yuva444p16.avi -11489842 tests/data/fate/vsynth2-jpeg2000-yuva444p16.avi -a4232b2959472f88b5310572456fa900 *tests/data/fate/vsynth2-jpeg2000-yuva444p16.out.rawvideo -stddev: 11.69 PSNR: 26.77 MAXDIFF: 188 bytes: 7603200/ 7603200 +37555b5b00bba2773d5a4212f6c7debd *tests/data/fate/vsynth2-jpeg2000-yuva444p16.avi +11501630 tests/data/fate/vsynth2-jpeg2000-yuva444p16.avi +61be7920a21190d946c22cb2c945ab6f *tests/data/fate/vsynth2-jpeg2000-yuva444p16.out.rawvideo +stddev: 0.53 PSNR: 53.49 MAXDIFF: 13 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth3-jpeg2000-yuva444p16 b/tests/ref/vsynth/vsynth3-jpeg2000-yuva444p16 index dae44f40bd..ce92bf7e43 100644 --- a/tests/ref/vsynth/vsynth3-jpeg2000-yuva444p16 +++ b/tests/ref/vsynth/vsynth3-jpeg2000-yuva444p16 @@ -1,4 +1,4 @@ -afdff47e9c71d912153e59a56afdf2a9 *tests/data/fate/vsynth3-jpeg2000-yuva444p16.avi -194250 tests/data/fate/vsynth3-jpeg2000-yuva444p16.avi -9e0ef11f8c85206a950a919cb679f129 *tests/data/fate/vsynth3-jpeg2000-yuva444p16.out.rawvideo -stddev: 10.72 PSNR: 27.53 MAXDIFF: 82 bytes: 86700/ 86700 +ae5951cee3db63c7c6f81d23b601c0fb *tests/data/fate/vsynth3-jpeg2000-yuva444p16.avi +194668 tests/data/fate/vsynth3-jpeg2000-yuva444p16.avi +d959793c1f0bb86b0fc509d5747e03c7 *tests/data/fate/vsynth3-jpeg2000-yuva444p16.out.rawvideo +stddev: 3.06 PSNR: 38.39 MAXDIFF: 40 bytes: 86700/ 86700 diff --git a/tests/ref/vsynth/vsynth_lena-jpeg2000-yuva444p16 b/tests/ref/vsynth/vsynth_lena-jpeg2000-yuva444p16 index d9e856735b..6dc522bb01 100644 --- a/tests/ref/vsynth/vsynth_lena-jpeg2000-yuva444p16 +++ b/tests/ref/vsynth/vsynth_lena-jpeg2000-yuva444p16 @@ -1,4 +1,4 @@ -e9c56e128cf980db7c8e965d2afc0ea6 *tests/data/fate/vsynth_lena-jpeg2000-yuva444p16.avi -11109882 tests/data/fate/vsynth_lena-jpeg2000-yuva444p16.avi -3e1a4f9ca46c2dd3fd997c01a0dfb130 *tests/data/fate/vsynth_lena-jpeg2000-yuva444p16.out.rawvideo -stddev: 11.67 PSNR: 26.79 MAXDIFF: 150 bytes: 7603200/ 7603200 +fcfb2e4738ad6afd7f9d4e9f92084415 *tests/data/fate/vsynth_lena-jpeg2000-yuva444p16.avi +11123818 tests/data/fate/vsynth_lena-jpeg2000-yuva444p16.avi +62ac96a84eb370e5543582512dbe5d7c *tests/data/fate/vsynth_lena-jpeg2000-yuva444p16.out.rawvideo +stddev: 0.45 PSNR: 54.88 MAXDIFF: 7 bytes: 7603200/ 7603200 -- 2.41.0 _______________________________________________ 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:[~2023-06-24 17:13 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-24 17:12 James Almer [this message] 2023-06-24 17:32 ` Paul B Mahol 2023-06-24 20:11 ` Michael Niedermayer
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=20230624171245.740-1-jamrial@gmail.com \ --to=jamrial@gmail.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