Now when both AVI and QuickTime use pal8 for 1 bpp video, there's no need to keep the monow stuff.

Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 7a6627e283392703a1f90d680cc87761afa452e7 Mon Sep 17 00:00:00 2001
From: Mats Peterson <matsp...@yahoo.com>
Date: Sat, 30 Jan 2016 05:05:03 +0100
Subject: [PATCH] lavc/rawdec: Remove superfluous AV_PIX_FMT_MONOWHITE code

---
 libavcodec/rawdec.c |   24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 3536943..a60e9bf 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -176,18 +176,12 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
 
     if ((avctx->bits_per_coded_sample == 8 || 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->pix_fmt == AV_PIX_FMT_MONOWHITE) &&
+        avctx->pix_fmt == AV_PIX_FMT_PAL8 &&
         (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))) {
         context->is_1_2_4_8_bpp = 1;
-        if (avctx->bits_per_coded_sample == 1 && avctx->pix_fmt == AV_PIX_FMT_MONOWHITE) {
-            int row_bytes = avctx->width / 8 + (avctx->width & 7 ? 1 : 0);
-            context->frame_size = av_image_get_buffer_size(avctx->pix_fmt,
-                                                           FFALIGN(row_bytes, 16) * 8,
-                                                           avctx->height, 1);
-        } else
-            context->frame_size = av_image_get_buffer_size(avctx->pix_fmt,
-                                                           FFALIGN(avctx->width, 16),
-                                                           avctx->height, 1);
+        context->frame_size = av_image_get_buffer_size(avctx->pix_fmt,
+                                                       FFALIGN(avctx->width, 16),
+                                                       avctx->height, 1);
     } else {
         context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16;
         context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width,
@@ -227,14 +221,12 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
     if (context->is_1_2_4_8_bpp) {
         int i, j, row_pix = 0;
         uint8_t *dst = frame->buf[0]->data;
-        buf_size = context->frame_size -
-                (avctx->pix_fmt == AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0);
-        if (avctx->bits_per_coded_sample == 8 || avctx->pix_fmt == AV_PIX_FMT_MONOWHITE) {
-            int pix_per_byte = avctx->pix_fmt == AV_PIX_FMT_MONOWHITE ? 8 : 1;
+        buf_size = context->frame_size - AVPALETTE_SIZE;
+        if (avctx->bits_per_coded_sample == 8) {
             for (i = 0, j = 0; j < buf_size && i<avpkt->size; i++, j++) {
                 dst[j] = buf[i];
-                row_pix += pix_per_byte;
-                if (row_pix >= avctx->width) {
+                row_pix++;
+                if (row_pix == avctx->width) {
                     i += avpkt_stride - (i % avpkt_stride) - 1;
                     j += 16 - (j % 16) - 1;
                     row_pix = 0;
-- 
1.7.10.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to