diff options
| author | Mike Melanson <mike@multimedia.cx> | 2005-04-19 05:16:45 +0000 |
|---|---|---|
| committer | Mike Melanson <mike@multimedia.cx> | 2005-04-19 05:16:45 +0000 |
| commit | 97c50cb77949856573d7f5f5a3c28cb73e61e011 (patch) | |
| tree | 2dbabcbb9009b09d66789498ce1d2451a4b39bc0 /src/libffmpeg/libavcodec/cinepak.c | |
| parent | 19e7199dad84489aa49e3b2dd5c0e45657ec0fb8 (diff) | |
| download | xine-lib-97c50cb77949856573d7f5f5a3c28cb73e61e011.tar.gz xine-lib-97c50cb77949856573d7f5f5a3c28cb73e61e011.tar.bz2 | |
sync to FFmpeg build 4752
CVS patchset: 7463
CVS date: 2005/04/19 05:16:45
Diffstat (limited to 'src/libffmpeg/libavcodec/cinepak.c')
| -rw-r--r-- | src/libffmpeg/libavcodec/cinepak.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/src/libffmpeg/libavcodec/cinepak.c b/src/libffmpeg/libavcodec/cinepak.c index da9a8127f..3c560fdc5 100644 --- a/src/libffmpeg/libavcodec/cinepak.c +++ b/src/libffmpeg/libavcodec/cinepak.c @@ -35,7 +35,6 @@ #include "avcodec.h" #include "dsputil.h" -#define PALETTE_COUNT 256 typedef struct { uint8_t y0, y1, y2, y3; @@ -63,7 +62,6 @@ typedef struct CinepakContext { int width, height; - unsigned char palette[PALETTE_COUNT * 4]; int palette_video; cvid_strip_t strips[MAX_STRIPS]; @@ -177,28 +175,28 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip_t *strip, s->frame.data[2][iv[0]] = codebook->v; } - s->frame.data[0][iy[0] + 2] = codebook->y0; - s->frame.data[0][iy[0] + 3] = codebook->y0; - s->frame.data[0][iy[1] + 2] = codebook->y0; - s->frame.data[0][iy[1] + 3] = codebook->y0; + s->frame.data[0][iy[0] + 2] = codebook->y1; + s->frame.data[0][iy[0] + 3] = codebook->y1; + s->frame.data[0][iy[1] + 2] = codebook->y1; + s->frame.data[0][iy[1] + 3] = codebook->y1; if (!s->palette_video) { s->frame.data[1][iu[0] + 1] = codebook->u; s->frame.data[2][iv[0] + 1] = codebook->v; } - s->frame.data[0][iy[2] + 0] = codebook->y0; - s->frame.data[0][iy[2] + 1] = codebook->y0; - s->frame.data[0][iy[3] + 0] = codebook->y0; - s->frame.data[0][iy[3] + 1] = codebook->y0; + s->frame.data[0][iy[2] + 0] = codebook->y2; + s->frame.data[0][iy[2] + 1] = codebook->y2; + s->frame.data[0][iy[3] + 0] = codebook->y2; + s->frame.data[0][iy[3] + 1] = codebook->y2; if (!s->palette_video) { s->frame.data[1][iu[1]] = codebook->u; s->frame.data[2][iv[1]] = codebook->v; } - s->frame.data[0][iy[2] + 2] = codebook->y0; - s->frame.data[0][iy[2] + 3] = codebook->y0; - s->frame.data[0][iy[3] + 2] = codebook->y0; - s->frame.data[0][iy[3] + 3] = codebook->y0; + s->frame.data[0][iy[2] + 2] = codebook->y3; + s->frame.data[0][iy[2] + 3] = codebook->y3; + s->frame.data[0][iy[3] + 2] = codebook->y3; + s->frame.data[0][iy[3] + 3] = codebook->y3; if (!s->palette_video) { s->frame.data[1][iu[1] + 1] = codebook->u; s->frame.data[2][iv[1] + 1] = codebook->v; @@ -361,22 +359,20 @@ static int cinepak_decode (CinepakContext *s) static int cinepak_decode_init(AVCodecContext *avctx) { CinepakContext *s = (CinepakContext *)avctx->priv_data; -/* - int i; - unsigned char r, g, b; - unsigned char *raw_palette; - unsigned int *palette32; -*/ s->avctx = avctx; s->width = (avctx->width + 3) & ~3; s->height = (avctx->height + 3) & ~3; -// check for paletted data -s->palette_video = 0; - + // check for paletted data + if ((avctx->palctrl == NULL) || (avctx->bits_per_sample == 40)) { + s->palette_video = 0; + avctx->pix_fmt = PIX_FMT_YUV420P; + } else { + s->palette_video = 1; + avctx->pix_fmt = PIX_FMT_PAL8; + } - avctx->pix_fmt = PIX_FMT_YUV420P; avctx->has_b_frames = 0; dsputil_init(&s->dsp, avctx); @@ -404,6 +400,15 @@ static int cinepak_decode_frame(AVCodecContext *avctx, cinepak_decode(s); + if (s->palette_video) { + memcpy (s->frame.data[1], avctx->palctrl->palette, AVPALETTE_SIZE); + if (avctx->palctrl->palette_changed) { + s->frame.palette_has_changed = 1; + avctx->palctrl->palette_changed = 0; + } else + s->frame.palette_has_changed = 0; + } + *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; |
