diff options
author | Michael Bradshaw <mbradshaw@sorensonmedia.com> | 2012-01-17 11:57:36 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2012-01-17 11:57:36 +0100 |
commit | a02694c92618fae98e5ce85b0a5eed71988a9d40 (patch) | |
tree | 0e5406c4a50d5ebbe4359cc5152d17081cfc3959 | |
parent | 0abe25aa7bfa017a18832c6d4b0f59e4fd18f7d5 (diff) | |
download | ffmpeg-a02694c92618fae98e5ce85b0a5eed71988a9d40.tar.gz |
libopenjpegenc: Simplify gray encoding.
-rw-r--r-- | libavcodec/libopenjpegenc.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c index 154409db70..b0dca03669 100644 --- a/libavcodec/libopenjpegenc.c +++ b/libavcodec/libopenjpegenc.c @@ -257,7 +257,7 @@ static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, AVFrame *frame, opj int y; int width; int height; - const int numcomps = avctx->pix_fmt == PIX_FMT_YUVA420P ? 4 : 3; + const int numcomps = image->numcomps; for (compno = 0; compno < numcomps; ++compno) { if (image->comps[compno].w > frame->linesize[compno]) { @@ -286,7 +286,7 @@ static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, AVFrame *frame, op int y; int width; int height; - const int numcomps = 3; + const int numcomps = image->numcomps; uint16_t *frame_ptr; for (compno = 0; compno < numcomps; ++compno) { @@ -328,12 +328,6 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf image->y1 = (avctx->height - 1) * ctx->enc_params.subsampling_dy + 1; switch (avctx->pix_fmt) { - case PIX_FMT_GRAY8: - cpyresult = libopenjpeg_copy_packed8(avctx, frame, image, 1); - break; - case PIX_FMT_GRAY16: - cpyresult = libopenjpeg_copy_packed16(avctx, frame, image, 1); - break; case PIX_FMT_RGB24: cpyresult = libopenjpeg_copy_packed8(avctx, frame, image, 3); break; @@ -346,6 +340,7 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf case PIX_FMT_RGBA64: cpyresult = libopenjpeg_copy_packed16(avctx, frame, image, 4); break; + case PIX_FMT_GRAY8: case PIX_FMT_YUV420P: case PIX_FMT_YUV422P: case PIX_FMT_YUV440P: @@ -353,6 +348,7 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf case PIX_FMT_YUVA420P: cpyresult = libopenjpeg_copy_unpacked8(avctx, frame, image); break; + case PIX_FMT_GRAY16: case PIX_FMT_YUV420P9: case PIX_FMT_YUV420P10: case PIX_FMT_YUV420P16: |