* [FFmpeg-devel] [PATCH] avcodec/j2kenc: use uint64_t type for the lambda value
@ 2023-06-24 17:12 James Almer
2023-06-24 17:32 ` Paul B Mahol
2023-06-24 20:11 ` Michael Niedermayer
0 siblings, 2 replies; 3+ messages in thread
From: James Almer @ 2023-06-24 17:12 UTC (permalink / raw)
To: ffmpeg-devel
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/j2kenc: use uint64_t type for the lambda value
2023-06-24 17:12 [FFmpeg-devel] [PATCH] avcodec/j2kenc: use uint64_t type for the lambda value James Almer
@ 2023-06-24 17:32 ` Paul B Mahol
2023-06-24 20:11 ` Michael Niedermayer
1 sibling, 0 replies; 3+ messages in thread
From: Paul B Mahol @ 2023-06-24 17:32 UTC (permalink / raw)
To: FFmpeg development discussions and patches
LGTM
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/j2kenc: use uint64_t type for the lambda value
2023-06-24 17:12 [FFmpeg-devel] [PATCH] avcodec/j2kenc: use uint64_t type for the lambda value James Almer
2023-06-24 17:32 ` Paul B Mahol
@ 2023-06-24 20:11 ` Michael Niedermayer
1 sibling, 0 replies; 3+ messages in thread
From: Michael Niedermayer @ 2023-06-24 20:11 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 953 bytes --]
On Sat, Jun 24, 2023 at 02:12:45PM -0300, James Almer wrote:
> 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(-)
LGTM
have you checked that unsigned 64bit will not overflow too ?
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-24 20:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-24 17:12 [FFmpeg-devel] [PATCH] avcodec/j2kenc: use uint64_t type for the lambda value James Almer
2023-06-24 17:32 ` Paul B Mahol
2023-06-24 20:11 ` Michael Niedermayer
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