Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: source/patched-ffmpeg-mt/libavcodec/xan.c

Issue 4533003: patched ffmpeg nov 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Wing Commander/Xan Video Decoder 2 * Wing Commander/Xan Video Decoder
3 * Copyright (C) 2003 the ffmpeg project 3 * Copyright (C) 2003 the ffmpeg project
4 * 4 *
5 * This file is part of FFmpeg. 5 * This file is part of FFmpeg.
6 * 6 *
7 * FFmpeg is free software; you can redistribute it and/or 7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version. 10 * version 2.1 of the License, or (at your option) any later version.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 static av_cold int xan_decode_init(AVCodecContext *avctx) 62 static av_cold int xan_decode_init(AVCodecContext *avctx)
63 { 63 {
64 XanContext *s = avctx->priv_data; 64 XanContext *s = avctx->priv_data;
65 65
66 s->avctx = avctx; 66 s->avctx = avctx;
67 s->frame_size = 0; 67 s->frame_size = 0;
68 68
69 if ((avctx->codec->id == CODEC_ID_XAN_WC3) && 69 if ((avctx->codec->id == CODEC_ID_XAN_WC3) &&
70 (s->avctx->palctrl == NULL)) { 70 (s->avctx->palctrl == NULL)) {
71 av_log(avctx, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n"); 71 av_log(avctx, AV_LOG_ERROR, "palette expected\n");
72 return -1; 72 return AVERROR(EINVAL);
73 } 73 }
74 74
75 avctx->pix_fmt = PIX_FMT_PAL8; 75 avctx->pix_fmt = PIX_FMT_PAL8;
76 76
77 s->buffer1_size = avctx->width * avctx->height; 77 s->buffer1_size = avctx->width * avctx->height;
78 s->buffer1 = av_malloc(s->buffer1_size); 78 s->buffer1 = av_malloc(s->buffer1_size);
79 if (!s->buffer1) 79 if (!s->buffer1)
80 return -1; 80 return AVERROR(ENOMEM);
81 s->buffer2_size = avctx->width * avctx->height; 81 s->buffer2_size = avctx->width * avctx->height;
82 s->buffer2 = av_malloc(s->buffer2_size + 130); 82 s->buffer2 = av_malloc(s->buffer2_size + 130);
83 if (!s->buffer2) { 83 if (!s->buffer2) {
84 av_freep(&s->buffer1); 84 av_freep(&s->buffer1);
85 return -1; 85 return AVERROR(ENOMEM);
86 } 86 }
87 87
88 return 0; 88 return 0;
89 } 89 }
90 90
91 static int xan_huffman_decode(unsigned char *dest, const unsigned char *src, 91 static int xan_huffman_decode(unsigned char *dest, const unsigned char *src,
92 int dest_len) 92 int dest_len)
93 { 93 {
94 unsigned char byte = *src++; 94 unsigned char byte = *src++;
95 unsigned char ival = byte + 0x16; 95 unsigned char ival = byte + 0x16;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 } 352 }
353 353
354 static void xan_wc4_decode_frame(XanContext *s) { 354 static void xan_wc4_decode_frame(XanContext *s) {
355 } 355 }
356 356
357 static int xan_decode_frame(AVCodecContext *avctx, 357 static int xan_decode_frame(AVCodecContext *avctx,
358 void *data, int *data_size, 358 void *data, int *data_size,
359 AVPacket *avpkt) 359 AVPacket *avpkt)
360 { 360 {
361 const uint8_t *buf = avpkt->data; 361 const uint8_t *buf = avpkt->data;
362 int buf_size = avpkt->size; 362 int ret, buf_size = avpkt->size;
363 XanContext *s = avctx->priv_data; 363 XanContext *s = avctx->priv_data;
364 AVPaletteControl *palette_control = avctx->palctrl; 364 AVPaletteControl *palette_control = avctx->palctrl;
365 365
366 if (avctx->get_buffer(avctx, &s->current_frame)) { 366 if ((ret = avctx->get_buffer(avctx, &s->current_frame))) {
367 av_log(s->avctx, AV_LOG_ERROR, " Xan Video: get_buffer() failed\n"); 367 av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
368 return -1; 368 return ret;
369 } 369 }
370 s->current_frame.reference = 3; 370 s->current_frame.reference = 3;
371 371
372 if (!s->frame_size) 372 if (!s->frame_size)
373 s->frame_size = s->current_frame.linesize[0] * s->avctx->height; 373 s->frame_size = s->current_frame.linesize[0] * s->avctx->height;
374 374
375 palette_control->palette_changed = 0; 375 palette_control->palette_changed = 0;
376 memcpy(s->current_frame.data[1], palette_control->palette, 376 memcpy(s->current_frame.data[1], palette_control->palette,
377 AVPALETTE_SIZE); 377 AVPALETTE_SIZE);
378 s->current_frame.palette_has_changed = 1; 378 s->current_frame.palette_has_changed = 1;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 CODEC_ID_XAN_WC4, 435 CODEC_ID_XAN_WC4,
436 sizeof(XanContext), 436 sizeof(XanContext),
437 xan_decode_init, 437 xan_decode_init,
438 NULL, 438 NULL,
439 xan_decode_end, 439 xan_decode_end,
440 xan_decode_frame, 440 xan_decode_frame,
441 CODEC_CAP_DR1, 441 CODEC_CAP_DR1,
442 .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"), 442 .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"),
443 }; 443 };
444 */ 444 */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698