typedef struct {
AVCodecContext *avctx;
- AVFrame *picture;
+ AVFrame picture;
int width, height; ///< image width and height
uint8_t cbps[4]; ///< bits per sample in particular components
// SGcod
bytestream_put_byte(&s->buf, 0); // progression level
bytestream_put_be16(&s->buf, 1); // num of layers
- bytestream_put_byte(&s->buf, 0); // multiple component transformation
+ if(s->avctx->pix_fmt == PIX_FMT_YUV444P){
+ bytestream_put_byte(&s->buf, 2); // ICT
+ }else{
+ bytestream_put_byte(&s->buf, 0); // unspecified
+ }
// SPcod
bytestream_put_byte(&s->buf, codsty->nreslevels - 1); // num of decomp. levels
bytestream_put_byte(&s->buf, codsty->log2_cblk_width-2); // cblk width
uint8_t *psotptr;
if (s->buf_end - s->buf < 12)
- return -1;
+ return NULL;
bytestream_put_be16(&s->buf, J2K_SOT);
bytestream_put_be16(&s->buf, 10); // Lsot
for (compno = 0; compno < s->ncomponents; compno++){
J2kComponent *comp = tile->comp + compno;
int *dst = comp->data;
- line = s->picture->data[compno]
- + comp->coord[1][0] * s->picture->linesize[compno]
+ line = s->picture.data[compno]
+ + comp->coord[1][0] * s->picture.linesize[compno]
+ comp->coord[0][0];
for (y = comp->coord[1][0]; y < comp->coord[1][1]; y++){
uint8_t *ptr = line;
for (x = comp->coord[0][0]; x < comp->coord[0][1]; x++)
*dst++ = *ptr++ - (1 << 7);
- line += s->picture->linesize[compno];
+ line += s->picture.linesize[compno];
}
}
} 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;
i = 0;
tile->comp[compno].data[i] = *ptr++ - (1 << 7);
}
}
- line += s->picture->linesize[0];
+ line += s->picture.linesize[0];
}
}
}
s->buf = s->buf_start = buf;
s->buf_end = buf + buf_size;
- s->picture = data;
+ s->picture = *(AVFrame*)data;
+ avctx->coded_frame= &s->picture;
- s->lambda = s->picture->quality * LAMBDA_SCALE;
+ s->lambda = s->picture.quality * LAMBDA_SCALE;
copy_frame(s);
reinit(s);
for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){
uint8_t *psotptr;
- if ((psotptr = put_sot(s, tileno)) < 0)
- return psotptr;
+ if (!(psotptr = put_sot(s, tileno)))
+ return -1;
if (s->buf_end - s->buf < 2)
return -1;
bytestream_put_be16(&s->buf, J2K_SOD);
encode_frame,
j2kenc_destroy,
.capabilities= CODEC_CAP_EXPERIMENTAL,
+ .long_name = NULL_IF_CONFIG_SMALL("JPEG 2000"),
.pix_fmts =
- (enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_RGB24,
+ (enum PixelFormat[]) {PIX_FMT_RGB24, PIX_FMT_YUV444P, PIX_FMT_GRAY8,
+/* PIX_FMT_YUV420P,
PIX_FMT_YUV422P, PIX_FMT_YUV444P,
- PIX_FMT_YUV410P, PIX_FMT_YUV411P,
+ PIX_FMT_YUV410P, PIX_FMT_YUV411P,*/
-1}
};