From df42dd73235c4d89be44a088cb9fb30d27260cf6 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 19 Jan 2012 23:13:48 +0100 Subject: [PATCH] Support gray8a encoding with libopenjpeg. Reviewed-by: Michael Bradshaw Reviewed-by: Paul B Mahol --- libavcodec/libopenjpegenc.c | 7 ++++++- libavcodec/version.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c index 188dbb9ac4..ad47611c52 100644 --- a/libavcodec/libopenjpegenc.c +++ b/libavcodec/libopenjpegenc.c @@ -69,6 +69,10 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p color_space = CLRSPC_GRAY; numcomps = 1; break; + case PIX_FMT_GRAY8A: + color_space = CLRSPC_GRAY; + numcomps = 2; + break; case PIX_FMT_GRAY16: color_space = CLRSPC_GRAY; numcomps = 1; @@ -328,6 +332,7 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf switch (avctx->pix_fmt) { case PIX_FMT_RGB24: case PIX_FMT_RGBA: + case PIX_FMT_GRAY8A: cpyresult = libopenjpeg_copy_packed8(avctx, frame, image); break; case PIX_FMT_RGB48: @@ -411,7 +416,7 @@ AVCodec ff_libopenjpeg_encoder = { .close = libopenjpeg_encode_close, .capabilities = 0, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24,PIX_FMT_RGBA,PIX_FMT_RGB48,PIX_FMT_RGBA64, - PIX_FMT_GRAY8,PIX_FMT_GRAY16, + PIX_FMT_GRAY8,PIX_FMT_GRAY8A,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 75cae12605..5125916fe1 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -22,7 +22,7 @@ #define LIBAVCODEC_VERSION_MAJOR 53 #define LIBAVCODEC_VERSION_MINOR 57 -#define LIBAVCODEC_VERSION_MICRO 104 +#define LIBAVCODEC_VERSION_MICRO 105 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \