Allow stream-copying grayscale mov files.

This reverts 0de2157f / r12272.
Fixes ticket #3215.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/51/head
Carl Eugen Hoyos 11 years ago committed by Michael Niedermayer
parent d63e994361
commit 691dec6201
  1. 2
      libavcodec/8bps.c
  2. 2
      libavcodec/msrle.c
  3. 8
      libavcodec/rawdec.c
  4. 1
      libavformat/mov.c

@ -119,7 +119,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
} }
} }
if (avctx->bits_per_coded_sample <= 8) { if ((avctx->bits_per_coded_sample & 0x1f) <= 8) {
const uint8_t *pal = av_packet_get_side_data(avpkt, const uint8_t *pal = av_packet_get_side_data(avpkt,
AV_PKT_DATA_PALETTE, AV_PKT_DATA_PALETTE,
NULL); NULL);

@ -54,7 +54,7 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx)
s->avctx = avctx; s->avctx = avctx;
switch (avctx->bits_per_coded_sample) { switch (avctx->bits_per_coded_sample & 0x1f) {
case 1: case 1:
avctx->pix_fmt = AV_PIX_FMT_MONOWHITE; avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
break; break;

@ -108,7 +108,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
if ( avctx->codec_tag == MKTAG('r','a','w',' ') if ( avctx->codec_tag == MKTAG('r','a','w',' ')
|| avctx->codec_tag == MKTAG('N','O','1','6')) || avctx->codec_tag == MKTAG('N','O','1','6'))
avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_mov, avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_mov,
avctx->bits_per_coded_sample); avctx->bits_per_coded_sample & 0x1f);
else if (avctx->codec_tag == MKTAG('W', 'R', 'A', 'W')) else if (avctx->codec_tag == MKTAG('W', 'R', 'A', 'W'))
avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_avi, avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_avi,
avctx->bits_per_coded_sample); avctx->bits_per_coded_sample);
@ -134,7 +134,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
memset(context->palette->data, 0, AVPALETTE_SIZE); memset(context->palette->data, 0, AVPALETTE_SIZE);
} }
if ((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) && if (((avctx->bits_per_coded_sample & 0x1f) == 4 || (avctx->bits_per_coded_sample & 0x1f) == 2) &&
avctx->pix_fmt == AV_PIX_FMT_PAL8 && avctx->pix_fmt == AV_PIX_FMT_PAL8 &&
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))) { (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))) {
context->is_2_4_bpp = 1; context->is_2_4_bpp = 1;
@ -207,14 +207,14 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
int i; int i;
uint8_t *dst = frame->buf[0]->data; uint8_t *dst = frame->buf[0]->data;
buf_size = context->frame_size - AVPALETTE_SIZE; buf_size = context->frame_size - AVPALETTE_SIZE;
if (avctx->bits_per_coded_sample == 4) { if ((avctx->bits_per_coded_sample & 0x1f) == 4) {
for (i = 0; 2 * i + 1 < buf_size && i<avpkt->size; i++) { for (i = 0; 2 * i + 1 < buf_size && i<avpkt->size; i++) {
dst[2 * i + 0] = buf[i] >> 4; dst[2 * i + 0] = buf[i] >> 4;
dst[2 * i + 1] = buf[i] & 15; dst[2 * i + 1] = buf[i] & 15;
} }
linesize_align = 8; linesize_align = 8;
} else { } else {
av_assert0(avctx->bits_per_coded_sample == 2); av_assert0((avctx->bits_per_coded_sample & 0x1f) == 2);
for (i = 0; 4 * i + 3 < buf_size && i<avpkt->size; i++) { for (i = 0; 4 * i + 3 < buf_size && i<avpkt->size; i++) {
dst[4 * i + 0] = buf[i] >> 6; dst[4 * i + 0] = buf[i] >> 6;
dst[4 * i + 1] = buf[i] >> 4 & 3; dst[4 * i + 1] = buf[i] >> 4 & 3;

@ -1327,7 +1327,6 @@ static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb,
if (color_greyscale) { if (color_greyscale) {
int color_index, color_dec; int color_index, color_dec;
/* compute the greyscale palette */ /* compute the greyscale palette */
st->codec->bits_per_coded_sample = color_depth;
color_count = 1 << color_depth; color_count = 1 << color_depth;
color_index = 255; color_index = 255;
color_dec = 256 / (color_count - 1); color_dec = 256 / (color_count - 1);

Loading…
Cancel
Save