Mercurial > libavcodec.hg
annotate dsicinav.c @ 8017:cecd3150f82b libavcodec
get_pixels_sse2, ~+12% performance compared to mmx
author | bcoudurier |
---|---|
date | Thu, 09 Oct 2008 18:36:49 +0000 |
parents | 85ab7655ad4d |
children | e9d9d946f213 |
rev | line source |
---|---|
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
1 /* |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
2 * Delphine Software International CIN Audio/Video Decoders |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
3 * Copyright (c) 2006 Gregory Montoir (cyx@users.sourceforge.net) |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
4 * |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
5 * This file is part of FFmpeg. |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
6 * |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
11 * |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
16 * |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
20 */ |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
21 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
22 /** |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
23 * @file dsicinav.c |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
24 * Delphine Software International CIN audio/video decoders |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
25 */ |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
26 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
27 #include "avcodec.h" |
5089 | 28 #include "bytestream.h" |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
29 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
30 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
31 typedef enum CinVideoBitmapIndex { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
32 CIN_CUR_BMP = 0, /* current */ |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
33 CIN_PRE_BMP = 1, /* previous */ |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
34 CIN_INT_BMP = 2 /* intermediate */ |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
35 } CinVideoBitmapIndex; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
36 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
37 typedef struct CinVideoContext { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
38 AVCodecContext *avctx; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
39 AVFrame frame; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
40 unsigned int bitmap_size; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
41 uint32_t palette[256]; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
42 uint8_t *bitmap_table[3]; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
43 } CinVideoContext; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
44 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
45 typedef struct CinAudioContext { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
46 AVCodecContext *avctx; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
47 int initial_decode_frame; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
48 int delta; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
49 } CinAudioContext; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
50 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
51 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
52 /* table defining a geometric sequence with multiplier = 32767 ^ (1 / 128) */ |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
53 static const int16_t cinaudio_delta16_table[256] = { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
54 0, 0, 0, 0, 0, 0, 0, 0, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
55 0, 0, 0, 0, 0, 0, 0, 0, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
56 0, 0, 0, -30210, -27853, -25680, -23677, -21829, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
57 -20126, -18556, -17108, -15774, -14543, -13408, -12362, -11398, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
58 -10508, -9689, -8933, -8236, -7593, -7001, -6455, -5951, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
59 -5487, -5059, -4664, -4300, -3964, -3655, -3370, -3107, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
60 -2865, -2641, -2435, -2245, -2070, -1908, -1759, -1622, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
61 -1495, -1379, -1271, -1172, -1080, -996, -918, -847, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
62 -781, -720, -663, -612, -564, -520, -479, -442, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
63 -407, -376, -346, -319, -294, -271, -250, -230, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
64 -212, -196, -181, -166, -153, -141, -130, -120, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
65 -111, -102, -94, -87, -80, -74, -68, -62, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
66 -58, -53, -49, -45, -41, -38, -35, -32, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
67 -30, -27, -25, -23, -21, -20, -18, -17, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
68 -15, -14, -13, -12, -11, -10, -9, -8, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
69 -7, -6, -5, -4, -3, -2, -1, 0, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
70 0, 1, 2, 3, 4, 5, 6, 7, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
71 8, 9, 10, 11, 12, 13, 14, 15, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
72 17, 18, 20, 21, 23, 25, 27, 30, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
73 32, 35, 38, 41, 45, 49, 53, 58, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
74 62, 68, 74, 80, 87, 94, 102, 111, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
75 120, 130, 141, 153, 166, 181, 196, 212, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
76 230, 250, 271, 294, 319, 346, 376, 407, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
77 442, 479, 520, 564, 612, 663, 720, 781, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
78 847, 918, 996, 1080, 1172, 1271, 1379, 1495, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
79 1622, 1759, 1908, 2070, 2245, 2435, 2641, 2865, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
80 3107, 3370, 3655, 3964, 4300, 4664, 5059, 5487, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
81 5951, 6455, 7001, 7593, 8236, 8933, 9689, 10508, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
82 11398, 12362, 13408, 14543, 15774, 17108, 18556, 20126, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
83 21829, 23677, 25680, 27853, 30210, 0, 0, 0, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
84 0, 0, 0, 0, 0, 0, 0, 0, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
85 0, 0, 0, 0, 0, 0, 0, 0 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
86 }; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
87 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
88 |
6517
48759bfbd073
Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents:
6218
diff
changeset
|
89 static av_cold int cinvideo_decode_init(AVCodecContext *avctx) |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
90 { |
4827 | 91 CinVideoContext *cin = avctx->priv_data; |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
92 unsigned int i; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
93 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
94 cin->avctx = avctx; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
95 avctx->pix_fmt = PIX_FMT_PAL8; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
96 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
97 cin->frame.data[0] = NULL; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
98 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
99 cin->bitmap_size = avctx->width * avctx->height; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
100 for (i = 0; i < 3; ++i) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
101 cin->bitmap_table[i] = av_mallocz(cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
102 if (!cin->bitmap_table[i]) |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
103 av_log(avctx, AV_LOG_ERROR, "Can't allocate bitmap buffers.\n"); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
104 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
105 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
106 return 0; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
107 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
108 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
109 static void cin_apply_delta_data(const unsigned char *src, unsigned char *dst, int size) |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
110 { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
111 while (size--) |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
112 *dst++ += *src++; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
113 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
114 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
115 static int cin_decode_huffman(const unsigned char *src, int src_size, unsigned char *dst, int dst_size) |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
116 { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
117 int b, huff_code = 0; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
118 unsigned char huff_code_table[15]; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
119 unsigned char *dst_cur = dst; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
120 unsigned char *dst_end = dst + dst_size; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
121 const unsigned char *src_end = src + src_size; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
122 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
123 memcpy(huff_code_table, src, 15); src += 15; src_size -= 15; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
124 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
125 while (src < src_end) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
126 huff_code = *src++; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
127 if ((huff_code >> 4) == 15) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
128 b = huff_code << 4; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
129 huff_code = *src++; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
130 *dst_cur++ = b | (huff_code >> 4); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
131 } else |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
132 *dst_cur++ = huff_code_table[huff_code >> 4]; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
133 if (dst_cur >= dst_end) |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
134 break; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
135 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
136 huff_code &= 15; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
137 if (huff_code == 15) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
138 *dst_cur++ = *src++; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
139 } else |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
140 *dst_cur++ = huff_code_table[huff_code]; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
141 if (dst_cur >= dst_end) |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
142 break; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
143 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
144 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
145 return dst_cur - dst; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
146 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
147 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
148 static void cin_decode_lzss(const unsigned char *src, int src_size, unsigned char *dst, int dst_size) |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
149 { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
150 uint16_t cmd; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
151 int i, sz, offset, code; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
152 unsigned char *dst_end = dst + dst_size; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
153 const unsigned char *src_end = src + src_size; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
154 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
155 while (src < src_end && dst < dst_end) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
156 code = *src++; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
157 for (i = 0; i < 8 && src < src_end && dst < dst_end; ++i) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
158 if (code & (1 << i)) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
159 *dst++ = *src++; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
160 } else { |
4364 | 161 cmd = AV_RL16(src); src += 2; |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
162 offset = cmd >> 4; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
163 sz = (cmd & 0xF) + 2; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
164 /* don't use memcpy/memmove here as the decoding routine (ab)uses */ |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
165 /* buffer overlappings to repeat bytes in the destination */ |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
166 sz = FFMIN(sz, dst_end - dst); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
167 while (sz--) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
168 *dst = *(dst - offset - 1); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
169 ++dst; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
170 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
171 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
172 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
173 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
174 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
175 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
176 static void cin_decode_rle(const unsigned char *src, int src_size, unsigned char *dst, int dst_size) |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
177 { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
178 int len, code; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
179 unsigned char *dst_end = dst + dst_size; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
180 const unsigned char *src_end = src + src_size; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
181 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
182 while (src < src_end && dst < dst_end) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
183 code = *src++; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
184 if (code & 0x80) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
185 len = code - 0x7F; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
186 memset(dst, *src++, FFMIN(len, dst_end - dst)); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
187 } else { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
188 len = code + 1; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
189 memcpy(dst, src, FFMIN(len, dst_end - dst)); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
190 src += len; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
191 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
192 dst += len; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
193 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
194 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
195 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
196 static int cinvideo_decode_frame(AVCodecContext *avctx, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
197 void *data, int *data_size, |
6218 | 198 const uint8_t *buf, int buf_size) |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
199 { |
4827 | 200 CinVideoContext *cin = avctx->priv_data; |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
201 int i, y, palette_type, palette_colors_count, bitmap_frame_type, bitmap_frame_size; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
202 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
203 cin->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
204 if (avctx->reget_buffer(avctx, &cin->frame)) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
205 av_log(cin->avctx, AV_LOG_ERROR, "delphinecinvideo: reget_buffer() failed to allocate a frame\n"); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
206 return -1; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
207 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
208 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
209 palette_type = buf[0]; |
5089 | 210 palette_colors_count = AV_RL16(buf+1); |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
211 bitmap_frame_type = buf[3]; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
212 buf += 4; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
213 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
214 bitmap_frame_size = buf_size - 4; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
215 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
216 /* handle palette */ |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
217 if (palette_type == 0) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
218 for (i = 0; i < palette_colors_count; ++i) { |
5089 | 219 cin->palette[i] = bytestream_get_le24(&buf); |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
220 bitmap_frame_size -= 3; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
221 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
222 } else { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
223 for (i = 0; i < palette_colors_count; ++i) { |
5089 | 224 cin->palette[buf[0]] = AV_RL24(buf+1); |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
225 buf += 4; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
226 bitmap_frame_size -= 4; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
227 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
228 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
229 memcpy(cin->frame.data[1], cin->palette, sizeof(cin->palette)); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
230 cin->frame.palette_has_changed = 1; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
231 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
232 /* note: the decoding routines below assumes that surface.width = surface.pitch */ |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
233 switch (bitmap_frame_type) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
234 case 9: |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
235 cin_decode_rle(buf, bitmap_frame_size, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
236 cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
237 break; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
238 case 34: |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
239 cin_decode_rle(buf, bitmap_frame_size, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
240 cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
241 cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP], |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
242 cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
243 break; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
244 case 35: |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
245 cin_decode_huffman(buf, bitmap_frame_size, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
246 cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
247 cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
248 cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
249 break; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
250 case 36: |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
251 bitmap_frame_size = cin_decode_huffman(buf, bitmap_frame_size, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
252 cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
253 cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
254 cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
255 cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP], |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
256 cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
257 break; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
258 case 37: |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
259 cin_decode_huffman(buf, bitmap_frame_size, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
260 cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
261 break; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
262 case 38: |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
263 cin_decode_lzss(buf, bitmap_frame_size, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
264 cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
265 break; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
266 case 39: |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
267 cin_decode_lzss(buf, bitmap_frame_size, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
268 cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
269 cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP], |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
270 cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
271 break; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
272 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
273 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
274 for (y = 0; y < cin->avctx->height; ++y) |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
275 memcpy(cin->frame.data[0] + (cin->avctx->height - 1 - y) * cin->frame.linesize[0], |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
276 cin->bitmap_table[CIN_CUR_BMP] + y * cin->avctx->width, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
277 cin->avctx->width); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
278 |
4120 | 279 FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_table[CIN_PRE_BMP]); |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
280 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
281 *data_size = sizeof(AVFrame); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
282 *(AVFrame *)data = cin->frame; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
283 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
284 return buf_size; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
285 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
286 |
6517
48759bfbd073
Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents:
6218
diff
changeset
|
287 static av_cold int cinvideo_decode_end(AVCodecContext *avctx) |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
288 { |
4827 | 289 CinVideoContext *cin = avctx->priv_data; |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
290 int i; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
291 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
292 if (cin->frame.data[0]) |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
293 avctx->release_buffer(avctx, &cin->frame); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
294 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
295 for (i = 0; i < 3; ++i) |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
296 av_free(cin->bitmap_table[i]); |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
297 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
298 return 0; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
299 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
300 |
6517
48759bfbd073
Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents:
6218
diff
changeset
|
301 static av_cold int cinaudio_decode_init(AVCodecContext *avctx) |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
302 { |
4827 | 303 CinAudioContext *cin = avctx->priv_data; |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
304 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
305 cin->avctx = avctx; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
306 cin->initial_decode_frame = 1; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
307 cin->delta = 0; |
7451
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7040
diff
changeset
|
308 avctx->sample_fmt = SAMPLE_FMT_S16; |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
309 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
310 return 0; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
311 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
312 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
313 static int cinaudio_decode_frame(AVCodecContext *avctx, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
314 void *data, int *data_size, |
6218 | 315 const uint8_t *buf, int buf_size) |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
316 { |
4827 | 317 CinAudioContext *cin = avctx->priv_data; |
6218 | 318 const uint8_t *src = buf; |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
319 int16_t *samples = (int16_t *)data; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
320 |
5696
914ff70e1367
Do not decode more data than output buffer may hold
kostya
parents:
5523
diff
changeset
|
321 buf_size = FFMIN(buf_size, *data_size/2); |
914ff70e1367
Do not decode more data than output buffer may hold
kostya
parents:
5523
diff
changeset
|
322 |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
323 if (cin->initial_decode_frame) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
324 cin->initial_decode_frame = 0; |
4364 | 325 cin->delta = (int16_t)AV_RL16(src); src += 2; |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
326 *samples++ = cin->delta; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
327 buf_size -= 2; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
328 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
329 while (buf_size > 0) { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
330 cin->delta += cinaudio_delta16_table[*src++]; |
5523 | 331 cin->delta = av_clip_int16(cin->delta); |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
332 *samples++ = cin->delta; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
333 --buf_size; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
334 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
335 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
336 *data_size = (uint8_t *)samples - (uint8_t *)data; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
337 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
338 return src - buf; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
339 } |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
340 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
341 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
342 AVCodec dsicinvideo_decoder = { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
343 "dsicinvideo", |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
344 CODEC_TYPE_VIDEO, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
345 CODEC_ID_DSICINVIDEO, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
346 sizeof(CinVideoContext), |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
347 cinvideo_decode_init, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
348 NULL, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
349 cinvideo_decode_end, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
350 cinvideo_decode_frame, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
351 CODEC_CAP_DR1, |
7040
e943e1409077
Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents:
6712
diff
changeset
|
352 .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"), |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
353 }; |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
354 |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
355 AVCodec dsicinaudio_decoder = { |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
356 "dsicinaudio", |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
357 CODEC_TYPE_AUDIO, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
358 CODEC_ID_DSICINAUDIO, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
359 sizeof(CinAudioContext), |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
360 cinaudio_decode_init, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
361 NULL, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
362 NULL, |
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
363 cinaudio_decode_frame, |
7040
e943e1409077
Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents:
6712
diff
changeset
|
364 .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN audio"), |
3997
8ed26e786210
support for Delphine Software .cin files demuxing / audio and video decoding, by Gregory Montoir %cyx A users P sourceforge P net%
bcoudurier
parents:
diff
changeset
|
365 }; |