[FFmpeg-devel] [PATCH]lavc/ljpegenc: Remove BGRA encoding

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Sep 11 11:29:22 CEST 2015


Hi!

BGRA encoding for ljpeg has never worked: The resulting file 
is BGR24.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/Changelog b/Changelog
index d538c42..40431c9 100644
--- a/Changelog
+++ b/Changelog
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
 version <next>:
 - DXV decoding
 - extrastereo filter
+- Removed broken BGRA encoding from ljpeg encoder
 
 
 version 2.8:
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
index 8968145..15c8d72 100644
--- a/libavcodec/ljpegenc.c
+++ b/libavcodec/ljpegenc.c
@@ -221,7 +221,6 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     int ret, header_bits;
 
     if(    avctx->pix_fmt == AV_PIX_FMT_BGR0
-        || avctx->pix_fmt == AV_PIX_FMT_BGRA
         || avctx->pix_fmt == AV_PIX_FMT_BGR24)
         max_pkt_size += width * height * 3 * 4;
     else {
@@ -240,7 +239,6 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     header_bits = put_bits_count(&pb);
 
     if(    avctx->pix_fmt == AV_PIX_FMT_BGR0
-        || avctx->pix_fmt == AV_PIX_FMT_BGRA
         || avctx->pix_fmt == AV_PIX_FMT_BGR24)
         ret = ljpeg_encode_bgr(avctx, &pb, pict);
     else
@@ -328,7 +326,7 @@ AVCodec ff_ljpeg_encoder = {
     .close          = ljpeg_encode_close,
     .capabilities   = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
     .pix_fmts       = (const enum AVPixelFormat[]){
-        AV_PIX_FMT_BGR24   , AV_PIX_FMT_BGRA    , AV_PIX_FMT_BGR0,
+        AV_PIX_FMT_BGR24   , AV_PIX_FMT_BGR0,
         AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P,
         AV_PIX_FMT_YUV420P , AV_PIX_FMT_YUV444P , AV_PIX_FMT_YUV422P,
         AV_PIX_FMT_NONE},
diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
index 64e1425..944a507 100644
--- a/libavcodec/mjpegenc_common.c
+++ b/libavcodec/mjpegenc_common.c
@@ -167,7 +167,6 @@ void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[3], int vsample[3
                                      &chroma_v_shift);
     if (avctx->codec->id == AV_CODEC_ID_LJPEG &&
         (   avctx->pix_fmt == AV_PIX_FMT_BGR0
-         || avctx->pix_fmt == AV_PIX_FMT_BGRA
          || avctx->pix_fmt == AV_PIX_FMT_BGR24)) {
         vsample[0] = hsample[0] =
         vsample[1] = hsample[1] =
@@ -216,7 +215,6 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
 
     put_bits(pb, 16, 17);
     if (lossless && (  avctx->pix_fmt == AV_PIX_FMT_BGR0
-                    || avctx->pix_fmt == AV_PIX_FMT_BGRA
                     || avctx->pix_fmt == AV_PIX_FMT_BGR24))
         put_bits(pb, 8, 9); /* 9 bits/component RCT */
     else
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 24ebaae..3c18e5b 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  57
 #define LIBAVCODEC_VERSION_MINOR   1
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \


More information about the ffmpeg-devel mailing list