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

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

Issue 3384002: ffmpeg source update for sep 09 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: Created 10 years, 3 months 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 * Westwood SNDx codecs 2 * Westwood SNDx codecs
3 * Copyright (c) 2005 Konstantin Shishkov 3 * Copyright (c) 2005 Konstantin Shishkov
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.
11 * 11 *
12 * FFmpeg is distributed in the hope that it will be useful, 12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details. 15 * Lesser General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Lesser General Public 17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software 18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */ 20 */
21 21
22 #include <stdint.h>
22 #include "libavutil/intreadwrite.h" 23 #include "libavutil/intreadwrite.h"
23 #include "avcodec.h" 24 #include "avcodec.h"
24 25
25 /** 26 /**
26 * @file 27 * @file
27 * Westwood SNDx codecs. 28 * Westwood SNDx codecs.
28 * 29 *
29 * Reference documents about VQA format and its audio codecs 30 * Reference documents about VQA format and its audio codecs
30 * can be found here: 31 * can be found here:
31 * http://www.multimedia.cx 32 * http://www.multimedia.cx
32 */ 33 */
33 34
34 static const char ws_adpcm_2bit[] = { -2, -1, 0, 1}; 35 static const int8_t ws_adpcm_2bit[] = { -2, -1, 0, 1};
35 static const char ws_adpcm_4bit[] = { 36 static const int8_t ws_adpcm_4bit[] = {
36 -9, -8, -6, -5, -4, -3, -2, -1, 37 -9, -8, -6, -5, -4, -3, -2, -1,
37 0, 1, 2, 3, 4, 5, 6, 8 }; 38 0, 1, 2, 3, 4, 5, 6, 8 };
38 39
39 #define CLIP8(a) if(a>127)a=127;if(a<-128)a=-128; 40 #define CLIP8(a) if(a>127)a=127;if(a<-128)a=-128;
40 41
41 static av_cold int ws_snd_decode_init(AVCodecContext * avctx) 42 static av_cold int ws_snd_decode_init(AVCodecContext * avctx)
42 { 43 {
43 // WSSNDContext *c = avctx->priv_data; 44 // WSSNDContext *c = avctx->priv_data;
44 45
45 avctx->sample_fmt = SAMPLE_FMT_S16; 46 avctx->sample_fmt = SAMPLE_FMT_S16;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 CLIP8(sample); 114 CLIP8(sample);
114 *samples++ = sample << 8; 115 *samples++ = sample << 8;
115 sample += ws_adpcm_4bit[code >> 4]; 116 sample += ws_adpcm_4bit[code >> 4];
116 CLIP8(sample); 117 CLIP8(sample);
117 *samples++ = sample << 8; 118 *samples++ = sample << 8;
118 out_size -= 2; 119 out_size -= 2;
119 } 120 }
120 break; 121 break;
121 case 2: /* no compression */ 122 case 2: /* no compression */
122 if (count & 0x20) { /* big delta */ 123 if (count & 0x20) { /* big delta */
123 char t; 124 int8_t t;
124 t = count; 125 t = count;
125 t <<= 3; 126 t <<= 3;
126 sample += t >> 3; 127 sample += t >> 3;
127 *samples++ = sample << 8; 128 *samples++ = sample << 8;
128 out_size--; 129 out_size--;
129 } else { /* copy */ 130 } else { /* copy */
130 for (count++; count > 0; count--) { 131 for (count++; count > 0; count--) {
131 *samples++ = (*buf++ - 0x80) << 8; 132 *samples++ = (*buf++ - 0x80) << 8;
132 out_size--; 133 out_size--;
133 } 134 }
(...skipping 15 matching lines...) Expand all
149 "ws_snd1", 150 "ws_snd1",
150 AVMEDIA_TYPE_AUDIO, 151 AVMEDIA_TYPE_AUDIO,
151 CODEC_ID_WESTWOOD_SND1, 152 CODEC_ID_WESTWOOD_SND1,
152 0, 153 0,
153 ws_snd_decode_init, 154 ws_snd_decode_init,
154 NULL, 155 NULL,
155 NULL, 156 NULL,
156 ws_snd_decode_frame, 157 ws_snd_decode_frame,
157 .long_name = NULL_IF_CONFIG_SMALL("Westwood Audio (SND1)"), 158 .long_name = NULL_IF_CONFIG_SMALL("Westwood Audio (SND1)"),
158 }; 159 };
OLDNEW
« no previous file with comments | « source/patched-ffmpeg-mt/libavcodec/wmavoice.c ('k') | source/patched-ffmpeg-mt/libavcodec/x86/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698