diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2012-01-14 01:31:53 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2012-01-14 01:31:53 +0100 |
commit | ffd1017fb89e3fcb4853e2803b05e3d1847916c4 (patch) | |
tree | 1af47dad3c818c18f28c2447e18fa45e99190b2e /libavcodec | |
parent | 89fc7e36c7cb5db22ab9c0ab26fa3018410fd235 (diff) | |
download | ffmpeg-ffd1017fb89e3fcb4853e2803b05e3d1847916c4.tar.gz |
Gray16 encoding with libopenjpeg.
Reviewed-by: Michael Bradshaw
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libopenjpegenc.c | 13 | ||||
-rw-r--r-- | libavcodec/version.h | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c index c07eccd8d8..9faa0f0517 100644 --- a/libavcodec/libopenjpegenc.c +++ b/libavcodec/libopenjpegenc.c @@ -69,6 +69,11 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p color_space = CLRSPC_GRAY; numcomps = 1; break; + case PIX_FMT_GRAY16: + color_space = CLRSPC_GRAY; + numcomps = 1; + bpp = 16; + break; case PIX_FMT_RGB24: color_space = CLRSPC_SRGB; numcomps = 3; @@ -219,7 +224,7 @@ static int libopenjpeg_copy_rgb16(AVCodecContext *avctx, AVFrame *frame, opj_ima int y; uint16_t *frame_ptr = (uint16_t*)frame->data[0]; - av_assert0(numcomps == 3); + av_assert0(numcomps == 1 || numcomps == 3); for (compno = 0; compno < numcomps; ++compno) { if (image->comps[compno].w > frame->linesize[0] / numcomps) { @@ -317,6 +322,9 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf case PIX_FMT_GRAY8: cpyresult = libopenjpeg_copy_rgba(avctx, frame, image, 1); break; + case PIX_FMT_GRAY16: + cpyresult = libopenjpeg_copy_rgb16(avctx, frame, image, 1); + break; case PIX_FMT_RGB24: cpyresult = libopenjpeg_copy_rgba(avctx, frame, image, 3); break; @@ -400,7 +408,8 @@ AVCodec ff_libopenjpeg_encoder = { .encode = libopenjpeg_encode_frame, .close = libopenjpeg_encode_close, .capabilities = 0, - .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24,PIX_FMT_RGBA,PIX_FMT_RGB48,PIX_FMT_GRAY8, + .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24,PIX_FMT_RGBA,PIX_FMT_RGB48, + PIX_FMT_GRAY8,PIX_FMT_GRAY16, PIX_FMT_YUV420P,PIX_FMT_YUV422P,PIX_FMT_YUVA420P, PIX_FMT_YUV440P,PIX_FMT_YUV444P, PIX_FMT_YUV420P9,PIX_FMT_YUV422P9,PIX_FMT_YUV444P9, diff --git a/libavcodec/version.h b/libavcodec/version.h index 6bde95c033..af4353ff36 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -22,7 +22,7 @@ #define LIBAVCODEC_VERSION_MAJOR 53 #define LIBAVCODEC_VERSION_MINOR 55 -#define LIBAVCODEC_VERSION_MICRO 103 +#define LIBAVCODEC_VERSION_MICRO 104 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ |