Commit 8443b270 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/j2kenc: drop dependancy on sizeof(AVFrame)

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 1458f064
...@@ -60,7 +60,7 @@ typedef struct { ...@@ -60,7 +60,7 @@ typedef struct {
typedef struct { typedef struct {
AVCodecContext *avctx; AVCodecContext *avctx;
AVFrame picture; const AVFrame *picture;
int width, height; ///< image width and height int width, height; ///< image width and height
uint8_t cbps[4]; ///< bits per sample in particular components uint8_t cbps[4]; ///< bits per sample in particular components
...@@ -390,18 +390,18 @@ static void copy_frame(Jpeg2000EncoderContext *s) ...@@ -390,18 +390,18 @@ static void copy_frame(Jpeg2000EncoderContext *s)
for (compno = 0; compno < s->ncomponents; compno++){ for (compno = 0; compno < s->ncomponents; compno++){
Jpeg2000Component *comp = tile->comp + compno; Jpeg2000Component *comp = tile->comp + compno;
int *dst = comp->i_data; int *dst = comp->i_data;
line = s->picture.data[compno] line = s->picture->data[compno]
+ comp->coord[1][0] * s->picture.linesize[compno] + comp->coord[1][0] * s->picture->linesize[compno]
+ comp->coord[0][0]; + comp->coord[0][0];
for (y = comp->coord[1][0]; y < comp->coord[1][1]; y++){ for (y = comp->coord[1][0]; y < comp->coord[1][1]; y++){
uint8_t *ptr = line; uint8_t *ptr = line;
for (x = comp->coord[0][0]; x < comp->coord[0][1]; x++) for (x = comp->coord[0][0]; x < comp->coord[0][1]; x++)
*dst++ = *ptr++ - (1 << 7); *dst++ = *ptr++ - (1 << 7);
line += s->picture.linesize[compno]; line += s->picture->linesize[compno];
} }
} }
} else{ } else{
line = s->picture.data[0] + tile->comp[0].coord[1][0] * s->picture.linesize[0] line = s->picture->data[0] + tile->comp[0].coord[1][0] * s->picture->linesize[0]
+ tile->comp[0].coord[0][0] * s->ncomponents; + tile->comp[0].coord[0][0] * s->ncomponents;
i = 0; i = 0;
...@@ -412,7 +412,7 @@ static void copy_frame(Jpeg2000EncoderContext *s) ...@@ -412,7 +412,7 @@ static void copy_frame(Jpeg2000EncoderContext *s)
tile->comp[compno].i_data[i] = *ptr++ - (1 << 7); tile->comp[compno].i_data[i] = *ptr++ - (1 << 7);
} }
} }
line += s->picture.linesize[0]; line += s->picture->linesize[0];
} }
} }
} }
...@@ -927,10 +927,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -927,10 +927,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
s->buf = s->buf_start = pkt->data; s->buf = s->buf_start = pkt->data;
s->buf_end = pkt->data + pkt->size; s->buf_end = pkt->data + pkt->size;
s->picture = *pict; s->picture = pict;
avctx->coded_frame= &s->picture;
s->lambda = s->picture.quality * LAMBDA_SCALE; s->lambda = s->picture->quality * LAMBDA_SCALE;
copy_frame(s); copy_frame(s);
reinit(s); reinit(s);
......
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