Commit f1e17304 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/jpeg2000: Remove CBLK limit

This also reduces the amount of memory needed
Fixes Ticket4672

The new code seems slightly faster as well, probably due to better cache usage
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 8c22143e
This diff is collapsed.
...@@ -171,22 +171,22 @@ void ff_jpeg2000_set_significance(Jpeg2000T1Context *t1, int x, int y, ...@@ -171,22 +171,22 @@ void ff_jpeg2000_set_significance(Jpeg2000T1Context *t1, int x, int y,
{ {
x++; x++;
y++; y++;
t1->flags[y][x] |= JPEG2000_T1_SIG; t1->flags[(y) * t1->stride + x] |= JPEG2000_T1_SIG;
if (negative) { if (negative) {
t1->flags[y][x + 1] |= JPEG2000_T1_SIG_W | JPEG2000_T1_SGN_W; t1->flags[(y) * t1->stride + x + 1] |= JPEG2000_T1_SIG_W | JPEG2000_T1_SGN_W;
t1->flags[y][x - 1] |= JPEG2000_T1_SIG_E | JPEG2000_T1_SGN_E; t1->flags[(y) * t1->stride + x - 1] |= JPEG2000_T1_SIG_E | JPEG2000_T1_SGN_E;
t1->flags[y + 1][x] |= JPEG2000_T1_SIG_N | JPEG2000_T1_SGN_N; t1->flags[(y + 1) * t1->stride + x] |= JPEG2000_T1_SIG_N | JPEG2000_T1_SGN_N;
t1->flags[y - 1][x] |= JPEG2000_T1_SIG_S | JPEG2000_T1_SGN_S; t1->flags[(y - 1) * t1->stride + x] |= JPEG2000_T1_SIG_S | JPEG2000_T1_SGN_S;
} else { } else {
t1->flags[y][x + 1] |= JPEG2000_T1_SIG_W; t1->flags[(y) * t1->stride + x + 1] |= JPEG2000_T1_SIG_W;
t1->flags[y][x - 1] |= JPEG2000_T1_SIG_E; t1->flags[(y) * t1->stride + x - 1] |= JPEG2000_T1_SIG_E;
t1->flags[y + 1][x] |= JPEG2000_T1_SIG_N; t1->flags[(y + 1) * t1->stride + x] |= JPEG2000_T1_SIG_N;
t1->flags[y - 1][x] |= JPEG2000_T1_SIG_S; t1->flags[(y - 1) * t1->stride + x] |= JPEG2000_T1_SIG_S;
} }
t1->flags[y + 1][x + 1] |= JPEG2000_T1_SIG_NW; t1->flags[(y + 1) * t1->stride + x + 1] |= JPEG2000_T1_SIG_NW;
t1->flags[y + 1][x - 1] |= JPEG2000_T1_SIG_NE; t1->flags[(y + 1) * t1->stride + x - 1] |= JPEG2000_T1_SIG_NE;
t1->flags[y - 1][x + 1] |= JPEG2000_T1_SIG_SW; t1->flags[(y - 1) * t1->stride + x + 1] |= JPEG2000_T1_SIG_SW;
t1->flags[y - 1][x - 1] |= JPEG2000_T1_SIG_SE; t1->flags[(y - 1) * t1->stride + x - 1] |= JPEG2000_T1_SIG_SE;
} }
static const uint8_t lut_gain[2][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 2 } }; static const uint8_t lut_gain[2][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 2 } };
......
...@@ -67,10 +67,6 @@ enum Jpeg2000Quantsty { // quantization style ...@@ -67,10 +67,6 @@ enum Jpeg2000Quantsty { // quantization style
JPEG2000_QSTY_SE // scalar expounded JPEG2000_QSTY_SE // scalar expounded
}; };
#define JPEG2000_MAX_CBLKW 128
#define JPEG2000_MAX_CBLKH 128
#define JPEG2000_MAX_DECLEVELS 32 #define JPEG2000_MAX_DECLEVELS 32
#define JPEG2000_MAX_RESLEVELS (JPEG2000_MAX_DECLEVELS + 1) #define JPEG2000_MAX_RESLEVELS (JPEG2000_MAX_DECLEVELS + 1)
...@@ -123,9 +119,10 @@ enum Jpeg2000Quantsty { // quantization style ...@@ -123,9 +119,10 @@ enum Jpeg2000Quantsty { // quantization style
#define JPEG2000_PGOD_CPRL 0x04 // Component-position-resolution level-layer progression #define JPEG2000_PGOD_CPRL 0x04 // Component-position-resolution level-layer progression
typedef struct Jpeg2000T1Context { typedef struct Jpeg2000T1Context {
int data[JPEG2000_MAX_CBLKW][JPEG2000_MAX_CBLKH]; int data[6144];
uint16_t flags[JPEG2000_MAX_CBLKW + 2][JPEG2000_MAX_CBLKH + 2]; uint16_t flags[6156];
MqcState mqc; MqcState mqc;
int stride;
} Jpeg2000T1Context; } Jpeg2000T1Context;
typedef struct Jpeg2000TgtNode { typedef struct Jpeg2000TgtNode {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment