You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-11 14:30:22 +02:00
jpeg2000: Update pixel format support
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
committed by
Luca Barbato
parent
db13e02c6f
commit
33e665a6ab
@ -235,15 +235,6 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
|||||||
s->avctx->height = ff_jpeg2000_ceildivpow2(s->height - s->image_offset_y,
|
s->avctx->height = ff_jpeg2000_ceildivpow2(s->height - s->image_offset_y,
|
||||||
s->reduction_factor);
|
s->reduction_factor);
|
||||||
|
|
||||||
switch (s->avctx->profile) {
|
|
||||||
case FF_PROFILE_JPEG2000_DCINEMA_2K:
|
|
||||||
case FF_PROFILE_JPEG2000_DCINEMA_4K:
|
|
||||||
/* XYZ color-space for digital cinema profiles */
|
|
||||||
s->avctx->pix_fmt = AV_PIX_FMT_XYZ12;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* For other profiles selects color-space according number of
|
|
||||||
* components and bit depth precision. */
|
|
||||||
switch (s->ncomponents) {
|
switch (s->ncomponents) {
|
||||||
case 1:
|
case 1:
|
||||||
if (s->precision > 8)
|
if (s->precision > 8)
|
||||||
@ -252,21 +243,28 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
|||||||
s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
|
s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
switch (s->avctx->profile) {
|
||||||
|
case FF_PROFILE_JPEG2000_DCINEMA_2K:
|
||||||
|
case FF_PROFILE_JPEG2000_DCINEMA_4K:
|
||||||
|
/* XYZ color-space for digital cinema profiles */
|
||||||
|
s->avctx->pix_fmt = AV_PIX_FMT_XYZ12;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
if (s->precision > 8)
|
if (s->precision > 8)
|
||||||
s->avctx->pix_fmt = AV_PIX_FMT_RGB48;
|
s->avctx->pix_fmt = AV_PIX_FMT_RGB48;
|
||||||
else
|
else
|
||||||
s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
|
s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
s->avctx->pix_fmt = AV_PIX_FMT_BGRA;
|
s->avctx->pix_fmt = AV_PIX_FMT_RGBA;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* pixel format can not be identified */
|
/* pixel format can not be identified */
|
||||||
s->avctx->pix_fmt = AV_PIX_FMT_NONE;
|
s->avctx->pix_fmt = AV_PIX_FMT_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1135,11 +1133,6 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
|||||||
if (tile->codsty[0].mct)
|
if (tile->codsty[0].mct)
|
||||||
mct_decode(s, tile);
|
mct_decode(s, tile);
|
||||||
|
|
||||||
if (s->avctx->pix_fmt == AV_PIX_FMT_BGRA) { // RGBA -> BGRA
|
|
||||||
FFSWAP(float *, tile->comp[0].f_data, tile->comp[2].f_data);
|
|
||||||
FFSWAP(int *, tile->comp[0].i_data, tile->comp[2].i_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s->precision <= 8) {
|
if (s->precision <= 8) {
|
||||||
for (compno = 0; compno < s->ncomponents; compno++) {
|
for (compno = 0; compno < s->ncomponents; compno++) {
|
||||||
Jpeg2000Component *comp = tile->comp + compno;
|
Jpeg2000Component *comp = tile->comp + compno;
|
||||||
@ -1443,8 +1436,5 @@ AVCodec ff_jpeg2000_decoder = {
|
|||||||
.init_static_data = jpeg2000_init_static_data,
|
.init_static_data = jpeg2000_init_static_data,
|
||||||
.decode = jpeg2000_decode_frame,
|
.decode = jpeg2000_decode_frame,
|
||||||
.priv_class = &class,
|
.priv_class = &class,
|
||||||
.pix_fmts = (enum AVPixelFormat[]) { AV_PIX_FMT_XYZ12,
|
|
||||||
AV_PIX_FMT_GRAY8,
|
|
||||||
-1 },
|
|
||||||
.profiles = NULL_IF_CONFIG_SMALL(profiles)
|
.profiles = NULL_IF_CONFIG_SMALL(profiles)
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user