diff options
author | Michael Bradshaw <mjbshaw@gmail.com> | 2013-01-31 16:03:58 -0700 |
---|---|---|
committer | Michael Bradshaw <mjbshaw@gmail.com> | 2013-01-31 16:03:58 -0700 |
commit | 28f36dce3e5c6be6b7f208362fca3531ed3cb50d (patch) | |
tree | 964b237ba9005f99728099de92a95becf07397e8 | |
parent | c58c67398d03ba7386feb179695165f94ca2b6f2 (diff) | |
download | ffmpeg-28f36dce3e5c6be6b7f208362fca3531ed3cb50d.tar.gz |
libopenjpegenc: simplify switch statement
Signed-off-by: Michael Bradshaw <mjbshaw@gmail.com>
-rw-r--r-- | libavcodec/libopenjpegenc.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c index 51a60165eb..2bbbae902a 100644 --- a/libavcodec/libopenjpegenc.c +++ b/libavcodec/libopenjpegenc.c @@ -377,15 +377,6 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, cpyresult = libopenjpeg_copy_packed16(avctx, frame, image); break; case AV_PIX_FMT_GBR24P: - gbrframe = *frame; - gbrframe.data[0] = frame->data[2]; // swap to be rgb - gbrframe.data[1] = frame->data[0]; - gbrframe.data[2] = frame->data[1]; - gbrframe.linesize[0] = frame->linesize[2]; - gbrframe.linesize[1] = frame->linesize[0]; - gbrframe.linesize[2] = frame->linesize[1]; - cpyresult = libopenjpeg_copy_unpacked8(avctx, &gbrframe, image); - break; case AV_PIX_FMT_GBRP9: case AV_PIX_FMT_GBRP10: case AV_PIX_FMT_GBRP12: @@ -398,7 +389,11 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, gbrframe.linesize[0] = frame->linesize[2]; gbrframe.linesize[1] = frame->linesize[0]; gbrframe.linesize[2] = frame->linesize[1]; - cpyresult = libopenjpeg_copy_unpacked16(avctx, &gbrframe, image); + if (avctx->pix_fmt == AV_PIX_FMT_GBR24P) { + cpyresult = libopenjpeg_copy_unpacked8(avctx, &gbrframe, image); + } else { + cpyresult = libopenjpeg_copy_unpacked16(avctx, &gbrframe, image); + } break; case AV_PIX_FMT_GRAY8: case AV_PIX_FMT_YUV410P: |