aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2014-03-11 20:09:07 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-03-15 02:42:11 +0100
commit3caa6a5a5744e2fafaa51fd6c3cecf4008695c48 (patch)
tree08bcf1c1ff3387622ca21c69362d335592cc44f2
parentbf08665e2ededcb62eaa03d2faf8d39311a8275a (diff)
downloadffmpeg-3caa6a5a5744e2fafaa51fd6c3cecf4008695c48.tar.gz
Revert "Allow stream-copying grayscale mov files."
This reverts commit 691dec62011fe9993809fbc793126b40cac0c584. The commit did not fix ticket #3215, it was fixed one commit earlier. The revert may break other use-cases but they should be fixed differently, the offending commit introduced too many problems. Fixes ticket #3377. Fixes ticket #3378. (cherry picked from commit 54bbe3e2a645b4f7b36efac2bca331d3be98592a) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/8bps.c2
-rw-r--r--libavcodec/msrle.c2
-rw-r--r--libavcodec/rawdec.c8
-rw-r--r--libavformat/mov.c1
4 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c
index 1709368c65..d01ef924c7 100644
--- a/libavcodec/8bps.c
+++ b/libavcodec/8bps.c
@@ -119,7 +119,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
}
}
- if ((avctx->bits_per_coded_sample & 0x1f) <= 8) {
+ if (avctx->bits_per_coded_sample <= 8) {
const uint8_t *pal = av_packet_get_side_data(avpkt,
AV_PKT_DATA_PALETTE,
NULL);
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
index ad04ce8984..750e54ae99 100644
--- a/libavcodec/msrle.c
+++ b/libavcodec/msrle.c
@@ -55,7 +55,7 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
- switch (avctx->bits_per_coded_sample & 0x1f) {
+ switch (avctx->bits_per_coded_sample) {
case 1:
avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
break;
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 1a63f9e5cc..444cf8ed5d 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -109,7 +109,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
if ( avctx->codec_tag == MKTAG('r','a','w',' ')
|| avctx->codec_tag == MKTAG('N','O','1','6'))
avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_mov,
- avctx->bits_per_coded_sample & 0x1f);
+ avctx->bits_per_coded_sample);
else if (avctx->codec_tag == MKTAG('W', 'R', 'A', 'W'))
avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_avi,
avctx->bits_per_coded_sample);
@@ -135,7 +135,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
memset(context->palette->data, 0, AVPALETTE_SIZE);
}
- if (((avctx->bits_per_coded_sample & 0x1f) == 4 || (avctx->bits_per_coded_sample & 0x1f) == 2) &&
+ if ((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) &&
avctx->pix_fmt == AV_PIX_FMT_PAL8 &&
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))) {
context->is_2_4_bpp = 1;
@@ -209,14 +209,14 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
int i;
uint8_t *dst = frame->buf[0]->data;
buf_size = context->frame_size - AVPALETTE_SIZE;
- if ((avctx->bits_per_coded_sample & 0x1f) == 4) {
+ if (avctx->bits_per_coded_sample == 4) {
for (i = 0; 2 * i + 1 < buf_size && i<avpkt->size; i++) {
dst[2 * i + 0] = buf[i] >> 4;
dst[2 * i + 1] = buf[i] & 15;
}
linesize_align = 8;
} else {
- av_assert0((avctx->bits_per_coded_sample & 0x1f) == 2);
+ av_assert0(avctx->bits_per_coded_sample == 2);
for (i = 0; 4 * i + 3 < buf_size && i<avpkt->size; i++) {
dst[4 * i + 0] = buf[i] >> 6;
dst[4 * i + 1] = buf[i] >> 4 & 3;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index c14e3c15e5..3434d4f100 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1330,6 +1330,7 @@ static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb,
if (color_greyscale) {
int color_index, color_dec;
/* compute the greyscale palette */
+ st->codec->bits_per_coded_sample = color_depth;
color_count = 1 << color_depth;
color_index = 255;
color_dec = 256 / (color_count - 1);