Re: [FFmpeg-devel] [PATCH] lavc/rawdec: Use AV_PIX_FMT_PAL8 for 1-bit raw QuickTime video
On 01/16/2016 12:10 PM, Michael Niedermayer wrote: do you have a file that this fixes ? I do have a file, *now*. I've added a palette with blue color to a raw 1-bit QuickTime file just to have something to work on. https://drive.google.com/open?id=0B3_pEBoLs0faSDhIMWdmeFJtcDg ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/rawdec: Use AV_PIX_FMT_PAL8 for 1-bit raw QuickTime video
On 01/16/2016 12:24 PM, Mats Peterson wrote: Could it have something to do with the "linesize_align" variable that is 4 by default? I have no idea. I suppose since the width of both these files is an odd value, there has to be some alignment to even boundaries. I'll try various values of linesize_align. Mats ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/rawdec: Use AV_PIX_FMT_PAL8 for 1-bit raw QuickTime video
On 01/16/2016 12:10 PM, Michael Niedermayer wrote: breaks https://trac.ffmpeg.org/raw-attachment/ticket/823/1bpp.mov and https://trac.ffmpeg.org/raw-attachment/ticket/823/1bpp_129.mov do you have a file that this fixes ? Could it have something to do with the "linesize_align" variable that is 4 by default? I have no idea. Mats ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/rawdec: Use AV_PIX_FMT_PAL8 for 1-bit raw QuickTime video
On 01/16/2016 12:10 PM, Michael Niedermayer wrote: breaks https://trac.ffmpeg.org/raw-attachment/ticket/823/1bpp.mov and https://trac.ffmpeg.org/raw-attachment/ticket/823/1bpp_129.mov do you have a file that this fixes ? Interesting. Well, I don't have a file that gets "fixed" in any way, but I do have a 1 bpp raw file that works OK here: https://drive.google.com/open?id=0B3_pEBoLs0fabm83dG5YLUsybDA ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/rawdec: Use AV_PIX_FMT_PAL8 for 1-bit raw QuickTime video
On Wed, Jan 13, 2016 at 01:42:24PM +0100, Mats Peterson wrote: > Match the use of AV_PIX_FMT_PAL8 for 1-bit QuickTime Animation in > lavc/qtrle. To reiterate, 1-bit video is not necessary black & white in > QuickTime, merely bi-level. The two colors can be any color. The palette, > either included in the sample description, or the default Macintosh > palette (black & white for 1-bit video) will be set in lavf/qtpalette. > See the QuickTime File Format Specification for details. > > Mats > raw.c|4 ++-- > rawdec.c | 28 > 2 files changed, 22 insertions(+), 10 deletions(-) > de416185ecb440201cd8235d6e8dbb01b733aec9 > 0001-lavf-rawdec-Use-AV_PIX_FMT_PAL8-for-1-bit-QuickTime-.patch > From d1f62ac4a51329eff0c12fbab19ac8f22329d791 Mon Sep 17 00:00:00 2001 > From: Mats Peterson > Date: Wed, 13 Jan 2016 13:29:13 +0100 > Subject: [PATCH] lavc/rawdec: Use AV_PIX_FMT_PAL8 for 1-bit raw QuickTime > video > > Match the use of AV_PIX_FMT_PAL8 for 1-bit QuickTime Animation in > lavc/qtrle. To reiterate, 1-bit video is not necessary black & white in > QuickTime, merely bi-level. The two colors can be any color. The palette, > either included in the sample description, or the default Macintosh > palette (black & white for 1-bit video) will be set in lavf/qtpalette. > See the QuickTime File Format Specification for details. breaks https://trac.ffmpeg.org/raw-attachment/ticket/823/1bpp.mov and https://trac.ffmpeg.org/raw-attachment/ticket/823/1bpp_129.mov do you have a file that this fixes ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No human being will ever know the Truth, for even if they happen to say it by chance, they would not even known they had done so. -- Xenophanes signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/rawdec: Use AV_PIX_FMT_PAL8 for 1-bit raw QuickTime video
On 01/13/2016 01:42 PM, Mats Peterson wrote: Match the use of AV_PIX_FMT_PAL8 for 1-bit QuickTime Animation in lavc/qtrle. To reiterate, 1-bit video is not necessary black & white in QuickTime, merely bi-level. The two colors can be any color. The palette, either included in the sample description, or the default Macintosh palette (black & white for 1-bit video) will be set in lavf/qtpalette. See the QuickTime File Format Specification for details. Mats ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ping ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/rawdec: Use AV_PIX_FMT_PAL8 for 1-bit raw QuickTime video
Match the use of AV_PIX_FMT_PAL8 for 1-bit QuickTime Animation in lavc/qtrle. To reiterate, 1-bit video is not necessary black & white in QuickTime, merely bi-level. The two colors can be any color. The palette, either included in the sample description, or the default Macintosh palette (black & white for 1-bit video) will be set in lavf/qtpalette. See the QuickTime File Format Specification for details. Mats >From d1f62ac4a51329eff0c12fbab19ac8f22329d791 Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Wed, 13 Jan 2016 13:29:13 +0100 Subject: [PATCH] lavc/rawdec: Use AV_PIX_FMT_PAL8 for 1-bit raw QuickTime video Match the use of AV_PIX_FMT_PAL8 for 1-bit QuickTime Animation in lavc/qtrle. To reiterate, 1-bit video is not necessary black & white in QuickTime, merely bi-level. The two colors can be any color. The palette, either included in the sample description, or the default Macintosh palette (black & white for 1-bit video) will be set in lavf/qtpalette. See the QuickTime File Format Specification for details. --- libavcodec/raw.c|4 ++-- libavcodec/rawdec.c | 28 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/libavcodec/raw.c b/libavcodec/raw.c index 62ad338..fee56ee 100644 --- a/libavcodec/raw.c +++ b/libavcodec/raw.c @@ -254,13 +254,13 @@ const PixelFormatTag avpriv_pix_fmt_bps_avi[] = { }; const PixelFormatTag avpriv_pix_fmt_bps_mov[] = { -{ AV_PIX_FMT_MONOWHITE, 1 }, +{ AV_PIX_FMT_PAL8, 1 }, { AV_PIX_FMT_PAL8, 2 }, { AV_PIX_FMT_PAL8, 4 }, { AV_PIX_FMT_PAL8, 8 }, { AV_PIX_FMT_RGB555BE, 16 }, { AV_PIX_FMT_RGB24,24 }, { AV_PIX_FMT_ARGB, 32 }, -{ AV_PIX_FMT_MONOWHITE,33 }, +{ AV_PIX_FMT_PAL8, 33 }, { AV_PIX_FMT_NONE, 0 }, }; diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 50cee39..b509b65 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -41,7 +41,7 @@ typedef struct RawVideoContext { AVBufferRef *palette; int frame_size; /* size of the frame in bytes */ int flip; -int is_2_4_bpp; // 2 or 4 bpp raw in avi/mov +int is_1_2_4_bpp; // 1 bpp raw in mov, and 2 or 4 bpp raw in avi/mov int is_yuv2; int is_lt_16bpp; // 16bpp pixfmt and bits_per_coded_sample < 16 int tff; @@ -159,10 +159,11 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, AVFrame *frame = data; -if ((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) && +if ((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2 +|| avctx->bits_per_coded_sample == 1) && avctx->pix_fmt == AV_PIX_FMT_PAL8 && (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))) { -context->is_2_4_bpp = 1; +context->is_1_2_4_bpp = 1; context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(avctx->width, 16), avctx->height, 1); @@ -174,7 +175,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, if (context->frame_size < 0) return context->frame_size; -need_copy = !avpkt->buf || context->is_2_4_bpp || context->is_yuv2 || context->is_lt_16bpp; +need_copy = !avpkt->buf || context->is_1_2_4_bpp || context->is_yuv2 || context->is_lt_16bpp; frame->pict_type= AV_PICTURE_TYPE_I; frame->key_frame= 1; @@ -201,8 +202,8 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, if (!frame->buf[0]) return AVERROR(ENOMEM); -//2bpp and 4bpp raw in avi and mov (yes this is ugly ...) -if (context->is_2_4_bpp) { +// 1 bpp raw in mov, and 2 or 4 bpp raw in avi/mov +if (context->is_1_2_4_bpp) { int i; uint8_t *dst = frame->buf[0]->data; buf_size = context->frame_size - AVPALETTE_SIZE; @@ -212,8 +213,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, dst[2 * i + 1] = buf[i] & 15; } linesize_align = 8; -} else { -av_assert0(avctx->bits_per_coded_sample == 2); +} else if (avctx->bits_per_coded_sample == 2) { for (i = 0; 4 * i + 3 < buf_size && isize; i++) { dst[4 * i + 0] = buf[i] >> 6; dst[4 * i + 1] = buf[i] >> 4 & 3; @@ -221,6 +221,18 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, dst[4 * i + 3] = buf[i] & 3; } linesize_align = 16; +} else { +av_assert0(avctx->bits_per_coded_sample == 1); +for (i = 0; 8 * i + 7 < buf_size && isize; i++) { +dst[8 * i + 0] = buf[i] >> 7 & 1; +dst[8 * i + 1] = buf[i] >> 6 & 1; +dst[8 * i + 2] = buf[i] >> 5 & 1; +dst[8