aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2023-06-24 14:11:57 -0300
committerJames Almer <jamrial@gmail.com>2023-06-24 14:39:04 -0300
commit10f1bbfe117e990a6fe56c03085966fa0c0f0f2e (patch)
tree7da093a5434235ef08d4ecce54e79d052f1f532f /libavcodec
parent35af1695a9ad6f950e03efd156b99898b94dd57c (diff)
downloadffmpeg-10f1bbfe117e990a6fe56c03085966fa0c0f0f2e.tar.gz
avcodec/j2kenc: use uint64_t type for the lambda value
Should fix integer overflows, and improve encoding results. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/j2kenc.c4
1 files changed, 2 insertions, 2 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++){