* ADPCM codecs
* Copyright (c) 2001-2003 The ffmpeg Project
*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
*
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avcodec.h"
dec_sample = av_clip_int16(dec_sample);\
d = sample - dec_sample;\
ssd = nodes[j]->ssd + d*d;\
+ /* Check for wraparound, skip such samples completely. \
+ * Note, changing ssd to a 64 bit variable would be \
+ * simpler, avoiding this check, but it's slower on \
+ * x86 32 bit at the moment. */\
+ if (ssd < nodes[j]->ssd)\
+ goto next_##NAME;\
/* Collapse any two states with the same previous sample value. \
* One could also distinguish states by step and by 2nd to last
* sample, but the effects of that are negligible.
#if CONFIG_ENCODERS
#define ADPCM_ENCODER(id,name,long_name_) \
-AVCodec name ## _encoder = { \
+AVCodec ff_ ## name ## _encoder = { \
#name, \
AVMEDIA_TYPE_AUDIO, \
id, \
NULL, \
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
+}
#else
#define ADPCM_ENCODER(id,name,long_name_)
#endif
#if CONFIG_DECODERS
#define ADPCM_DECODER(id,name,long_name_) \
-AVCodec name ## _decoder = { \
+AVCodec ff_ ## name ## _decoder = { \
#name, \
AVMEDIA_TYPE_AUDIO, \
id, \
NULL, \
adpcm_decode_frame, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
+}
#else
#define ADPCM_DECODER(id,name,long_name_)
#endif
#define ADPCM_CODEC(id,name,long_name_) \
- ADPCM_ENCODER(id,name,long_name_) ADPCM_DECODER(id,name,long_name_)
+ ADPCM_ENCODER(id,name,long_name_); ADPCM_DECODER(id,name,long_name_)
/* Note: Do not forget to add new entries to the Makefile as well. */
ADPCM_DECODER(CODEC_ID_ADPCM_4XM, adpcm_4xm, "ADPCM 4X Movie");