Update of /cvsroot/xine/xine-lib/src/libffmpeg/libavcodec In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7131/src/libffmpeg/libavcodec Modified Files: Makefile.am avcodec.h bitstream.c bitstream.h cinepak.c cyuv.c dsputil.c dsputil.h dv.c flac.c flicvideo.c golomb.h h263.c h263dec.c h264.c imgresample.c indeo2.c mdec.c mjpeg.c motion_est.c motion_est_template.c mpeg12.c mpegaudio.h mpegaudiodec.c mpegvideo.c mpegvideo.h msmpeg4.c parser.c pcm.c qpeg.c qtrle.c rangecoder.c raw.c roqvideo.c rv10.c snow.c svq1.c ulti.c utils.c vmdav.c vp3.c vp3dsp.c wmv2.c xan.c Added Files: opt.h qdm2.c qdm2data.h Removed Files: common.h rational.c rational.h Log Message: big ffmpeg update it is likely to break, so please keep both pieces --- NEW FILE: opt.h --- #ifndef AVOPT_H #define AVOPT_H /** * @file opt.h * AVOptions */ enum AVOptionType{ FF_OPT_TYPE_FLAGS, FF_OPT_TYPE_INT, FF_OPT_TYPE_INT64, FF_OPT_TYPE_DOUBLE, FF_OPT_TYPE_FLOAT, FF_OPT_TYPE_STRING, FF_OPT_TYPE_RATIONAL, FF_OPT_TYPE_CONST=128, }; /** * AVOption. */ typedef struct AVOption { const char *name; /** * short English text help. * @fixme what about other languages */ const char *help; int offset; ///< offset to context structure where the parsed value should be stored enum AVOptionType type; double default_val; double min; double max; int flags; #define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding #define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding #define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... #define AV_OPT_FLAG_AUDIO_PARAM 8 #define AV_OPT_FLAG_VIDEO_PARAM 16 #define AV_OPT_FLAG_SUBTITLE_PARAM 32 //FIXME think about enc-audio, ... style flags const char *unit; } AVOption; AVOption *av_set_string(void *obj, const char *name, const char *val); AVOption *av_set_double(void *obj, const char *name, double n); AVOption *av_set_q(void *obj, const char *name, AVRational n); AVOption *av_set_int(void *obj, const char *name, int64_t n); double av_get_double(void *obj, const char *name, AVOption **o_out); AVRational av_get_q(void *obj, const char *name, AVOption **o_out); int64_t av_get_int(void *obj, const char *name, AVOption **o_out); const char *av_get_string(void *obj, const char *name, AVOption **o_out, char *buf, int buf_len); AVOption *av_next_option(void *obj, AVOption *last); int av_opt_show(void *obj, void *av_log_obj); #endif --- NEW FILE: qdm2.c --- /* * QDM2 compatible decoder * Copyright (c) 2003 Ewald Snel * Copyright (c) 2005 Benjamin Larsson * Copyright (c) 2005 Alex Beregszaszi * Copyright (c) 2005 Roberto Togni * * This library 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 of the License, or (at your option) any later version. * * This library 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 this library; if not, write to the Free Software [...2000 lines suppressed...] qdm2_decode(s, buf, data); // reading only when next superblock found if (s->sub_packet == 0) { return s->checksum_size; } return 0; } AVCodec qdm2_decoder = { .name = "qdm2", .type = CODEC_TYPE_AUDIO, .id = CODEC_ID_QDM2, .priv_data_size = sizeof(QDM2Context), .init = qdm2_decode_init, .close = qdm2_decode_close, .decode = qdm2_decode_frame, }; --- NEW FILE: qdm2data.h --- /* * QDM2 compatible decoder * Copyright (c) 2003 Ewald Snel * Copyright (c) 2005 Benjamin Larsson * Copyright (c) 2005 Alex Beregszaszi * Copyright (c) 2005 Roberto Togni * * This library 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 of the License, or (at your option) any later version. * * This library 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 this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /** * @file qdm2data.h * Various QDM2 tables. */ #ifndef QDM2DATA_H #define QDM2DATA_H /** VLC TABLES **/ /* values in this table range from -1..23; adjust retrieved value by -1 */ static uint16_t vlc_tab_level_huffcodes[24] = { 0x037c, 0x0004, 0x003c, 0x004c, 0x003a, 0x002c, 0x001c, 0x001a, 0x0024, 0x0014, 0x0001, 0x0002, 0x0000, 0x0003, 0x0007, 0x0005, 0x0006, 0x0008, 0x0009, 0x000a, 0x000c, 0x00fc, 0x007c, 0x017c }; static uint8_t vlc_tab_level_huffbits[24] = { 10, 6, 7, 7, 6, 6, 6, 6, 6, 5, 4, 4, 4, 3, 3, 3, 3, 4, 4, 5, 7, 8, 9, 10 }; /* values in this table range from -1..36; adjust retrieved value by -1 */ static uint16_t vlc_tab_diff_huffcodes[37] = { 0x1c57, 0x0004, 0x0000, 0x0001, 0x0003, 0x0002, 0x000f, 0x000e, 0x0007, 0x0016, 0x0037, 0x0027, 0x0026, 0x0066, 0x0006, 0x0097, 0x0046, 0x01c6, 0x0017, 0x0786, 0x0086, 0x0257, 0x00d7, 0x0357, 0x00c6, 0x0386, 0x0186, 0x0000, 0x0157, 0x0c57, 0x0057, 0x0000, 0x0b86, 0x0000, 0x1457, 0x0000, 0x0457 }; static uint8_t vlc_tab_diff_huffbits[37] = { 13, 3, 3, 2, 3, 3, 4, 4, 6, 5, 6, 6, 7, 7, 8, 8, 8, 9, 8, 11, 9, 10, 8, 10, 9, 12, 10, 0, 10, 13, 11, 0, 12, 0, 13, 0, 13 }; /* values in this table range from -1..5; adjust retrieved value by -1 */ static uint8_t vlc_tab_run_huffcodes[6] = { 0x1f, 0x00, 0x01, 0x03, 0x07, 0x0f }; static uint8_t vlc_tab_run_huffbits[6] = { 5, 1, 2, 3, 4, 5 }; /* values in this table range from -1..19; adjust retrieved value by -1 */ static uint16_t vlc_tab_tone_level_idx_hi1_huffcodes[20] = { 0x5714, 0x000c, 0x0002, 0x0001, 0x0000, 0x0004, 0x0034, 0x0054, 0x0094, 0x0014, 0x0114, 0x0214, 0x0314, 0x0614, 0x0e14, 0x0f14, 0x2714, 0x0714, 0x1714, 0x3714 }; static uint8_t vlc_tab_tone_level_idx_hi1_huffbits[20] = { 15, 4, 2, 1, 3, 5, 6, 7, 8, 10, 10, 11, 11, 12, 12, 12, 14, 14, 15, 14 }; /* values in this table range from -1..23; adjust retrieved value by -1 */ static uint16_t vlc_tab_tone_level_idx_mid_huffcodes[24] = { 0x0fea, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03ea, 0x00ea, 0x002a, 0x001a, 0x0006, 0x0001, 0x0000, 0x0002, 0x000a, 0x006a, 0x01ea, 0x07ea }; static uint8_t vlc_tab_tone_level_idx_mid_huffbits[24] = { 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 9, 7, 5, 3, 1, 2, 4, 6, 8, 10, 12 }; /* values in this table range from -1..23; adjust retrieved value by -1 */ static uint16_t vlc_tab_tone_level_idx_hi2_huffcodes[24] = { 0x0664, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0064, 0x00e4, 0x00a4, 0x0068, 0x0004, 0x0008, 0x0014, 0x0018, 0x0000, 0x0001, 0x0002, 0x0003, 0x000c, 0x0028, 0x0024, 0x0164, 0x0000, 0x0264 }; static uint8_t vlc_tab_tone_level_idx_hi2_huffbits[24] = { 11, 0, 0, 0, 0, 0, 10, 8, 8, 7, 6, 6, 5, 5, 4, 2, 2, 2, 4, 7, 8, 9, 0, 11 }; /* values in this table range from -1..8; adjust retrieved value by -1 */ static uint8_t vlc_tab_type30_huffcodes[9] = { 0x3c, 0x06, 0x00, 0x01, 0x03, 0x02, 0x04, 0x0c, 0x1c }; static uint8_t vlc_tab_type30_huffbits[9] = { 6, 3, 3, 2, 2, 3, 4, 5, 6 }; /* values in this table range from -1..9; adjust retrieved value by -1 */ static uint8_t vlc_tab_type34_huffcodes[10] = { 0x18, 0x00, 0x01, 0x04, 0x05, 0x07, 0x03, 0x02, 0x06, 0x08 }; static uint8_t vlc_tab_type34_huffbits[10] = { 5, 4, 3, 3, 3, 3, 3, 3, 3, 5 }; /* values in this table range from -1..22; adjust retrieved value by -1 */ static uint16_t vlc_tab_fft_tone_offset_0_huffcodes[23] = { 0x038e, 0x0001, 0x0000, 0x0022, 0x000a, 0x0006, 0x0012, 0x0002, 0x001e, 0x003e, 0x0056, 0x0016, 0x000e, 0x0032, 0x0072, 0x0042, 0x008e, 0x004e, 0x00f2, 0x002e, 0x0036, 0x00c2, 0x018e }; static uint8_t vlc_tab_fft_tone_offset_0_huffbits[23] = { 10, 1, 2, 6, 4, 5, 6, 7, 6, 6, 7, 7, 8, 7, 8, 8, 9, 7, 8, 6, 6, 8, 10 }; /* values in this table range from -1..27; adjust retrieved value by -1 */ static uint16_t vlc_tab_fft_tone_offset_1_huffcodes[28] = { 0x07a4, 0x0001, 0x0020, 0x0012, 0x001c, 0x0008, 0x0006, 0x0010, 0x0000, 0x0014, 0x0004, 0x0032, 0x0070, 0x000c, 0x0002, 0x003a, 0x001a, 0x002c, 0x002a, 0x0022, 0x0024, 0x000a, 0x0064, 0x0030, 0x0062, 0x00a4, 0x01a4, 0x03a4 }; static uint8_t vlc_tab_fft_tone_offset_1_huffbits[28] = { 11, 1, 6, 6, 5, 4, 3, 6, 6, 5, 6, 6, 7, 6, 6, 6, 6, 6, 6, 7, 8, 6, 7, 7, 7, 9, 10, 11 }; /* values in this table range from -1..31; adjust retrieved value by -1 */ static uint16_t vlc_tab_fft_tone_offset_2_huffcodes[32] = { 0x1760, 0x0001, 0x0000, 0x0082, 0x000c, 0x0006, 0x0003, 0x0007, 0x0008, 0x0004, 0x0010, 0x0012, 0x0022, 0x001a, 0x0000, 0x0020, 0x000a, 0x0040, 0x004a, 0x006a, 0x002a, 0x0042, 0x0002, 0x0060, 0x00aa, 0x00e0, 0x00c2, 0x01c2, 0x0160, 0x0360, 0x0760, 0x0f60 }; static uint8_t vlc_tab_fft_tone_offset_2_huffbits[32] = { 13, 2, 0, 8, 4, 3, 3, 3, 4, 4, 5, 5, 6, 5, 7, 7, 7, 7, 7, 7, 8, 8, 8, 9, 8, 8, 9, 9, 10, 11, 13, 12 }; /* values in this table range from -1..34; adjust retrieved value by -1 */ static uint16_t vlc_tab_fft_tone_offset_3_huffcodes[35] = { 0x33ea, 0x0005, 0x0000, 0x000c, 0x0000, 0x0006, 0x0003, 0x0008, 0x0002, 0x0001, 0x0004, 0x0007, 0x001a, 0x000f, 0x001c, 0x002c, 0x000a, 0x001d, 0x002d, 0x002a, 0x000d, 0x004c, 0x008c, 0x006a, 0x00cd, 0x004d, 0x00ea, 0x020c, 0x030c, 0x010c, 0x01ea, 0x07ea, 0x0bea, 0x03ea, 0x13ea }; static uint8_t vlc_tab_fft_tone_offset_3_huffbits[35] = { 14, 4, 0, 10, 4, 3, 3, 4, 4, 3, 4, 4, 5, 4, 5, 6, 6, 5, 6, 7, 7, 7, 8, 8, 8, 8, 9, 10, 10, 10, 10, 11, 12, 13, 14 }; /* values in this table range from -1..37; adjust retrieved value by -1 */ static uint16_t vlc_tab_fft_tone_offset_4_huffcodes[38] = { 0x5282, 0x0016, 0x0000, 0x0136, 0x0004, 0x0000, 0x0007, 0x000a, 0x000e, 0x0003, 0x0001, 0x000d, 0x0006, 0x0009, 0x0012, 0x0005, 0x0025, 0x0022, 0x0015, 0x0002, 0x0076, 0x0035, 0x0042, 0x00c2, 0x0182, 0x00b6, 0x0036, 0x03c2, 0x0482, 0x01c2, 0x0682, 0x0882, 0x0a82, 0x0082, 0x0282, 0x1282, 0x3282, 0x2282 }; static uint8_t vlc_tab_fft_tone_offset_4_huffbits[38] = { 15, 6, 0, 9, 3, 3, 3, 4, 4, 3, 4, 4, 5, 4, 5, 6, 6, 6, 6, 8, 7, 6, 8, 9, 9, 8, 9, 10, 11, 10, 11, 12, 12, 12, 14, 15, 14, 14 }; /** FFT TABLES **/ /* values in this table range from -1..27; adjust retrieved value by -1 */ static uint16_t fft_level_exp_alt_huffcodes[28] = { 0x1ec6, 0x0006, 0x00c2, 0x0142, 0x0242, 0x0246, 0x00c6, 0x0046, 0x0042, 0x0146, 0x00a2, 0x0062, 0x0026, 0x0016, 0x000e, 0x0005, 0x0004, 0x0003, 0x0000, 0x0001, 0x000a, 0x0012, 0x0002, 0x0022, 0x01c6, 0x02c6, 0x06c6, 0x0ec6 }; static uint8_t fft_level_exp_alt_huffbits[28] = { 13, 7, 8, 9, 10, 10, 10, 10, 10, 9, 8, 7, 6, 5, 4, 3, 3, 2, 3, 3, 4, 5, 7, 8, 9, 11, 12, 13 }; /* values in this table range from -1..19; adjust retrieved value by -1 */ static uint16_t fft_level_exp_huffcodes[20] = { 0x0f24, 0x0001, 0x0002, 0x0000, 0x0006, 0x0005, 0x0007, 0x000c, 0x000b, 0x0014, 0x0013, 0x0004, 0x0003, 0x0023, 0x0064, 0x00a4, 0x0024, 0x0124, 0x0324, 0x0724 }; static uint8_t fft_level_exp_huffbits[20] = { 12, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 8, 9, 10, 11, 12 }; /* values in this table range from -1..6; adjust retrieved value by -1 */ static uint8_t fft_stereo_exp_huffcodes[7] = { 0x3e, 0x01, 0x00, 0x02, 0x06, 0x0e, 0x1e }; static uint8_t fft_stereo_exp_huffbits[7] = { 6, 1, 2, 3, 4, 5, 6 }; /* values in this table range from -1..8; adjust retrieved value by -1 */ static uint8_t fft_stereo_phase_huffcodes[9] = { 0x35, 0x02, 0x00, 0x01, 0x0d, 0x15, 0x05, 0x09, 0x03 }; static uint8_t fft_stereo_phase_huffbits[9] = { 6, 2, 2, 4, 4, 6, 5, 4, 2 }; static const int fft_cutoff_index_table[4][2] = { { 1, 2 }, {-1, 0 }, {-1,-2 }, { 0, 0 } }; static const int16_t fft_level_index_table[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, }; static uint8_t last_coeff[3] = { 4, 7, 10 }; static uint8_t coeff_per_sb_for_avg[3][30] = { { 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, { 0, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }, { 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9 } }; static uint32_t dequant_table[3][10][30] = { { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 256, 256, 205, 154, 102, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 51, 102, 154, 205, 256, 238, 219, 201, 183, 165, 146, 128, 110, 91, 73, 55, 37, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 18, 37, 55, 73, 91, 110, 128, 146, 165, 183, 201, 219, 238, 256, 228, 199, 171, 142, 114, 85, 57, 28 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 85, 171, 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 85, 171, 256, 219, 183, 146, 110, 73, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 73, 110, 146, 183, 219, 256, 228, 199, 171, 142, 114, 85, 57, 28, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 57, 85, 114, 142, 171, 199, 228, 256, 213, 171, 128, 85, 43 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 256, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 85, 171, 256, 192, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 128, 192, 256, 205, 154, 102, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 102, 154, 205, 256, 213, 171, 128, 85, 43, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 85, 128, 171, 213, 256, 213, 171, 128, 85, 43 } } }; static uint8_t coeff_per_sb_for_dequant[3][30] = { { 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, { 0, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6 }, { 0, 1, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9 } }; /* first index is subband, 2nd index is 0, 1 or 3 (2 is unused) */ static int8_t tone_level_idx_offset_table[30][4] = { { -50, -50, 0, -50 }, { -50, -50, 0, -50 }, { -50, -9, 0, -19 }, { -16, -6, 0, -12 }, { -11, -4, 0, -8 }, { -8, -3, 0, -6 }, { -7, -3, 0, -5 }, { -6, -2, 0, -4 }, { -5, -2, 0, -3 }, { -4, -1, 0, -3 }, { -4, -1, 0, -2 }, { -3, -1, 0, -2 }, { -3, -1, 0, -2 }, { -3, -1, 0, -2 }, { -2, -1, 0, -1 }, { -2, -1, 0, -1 }, { -2, -1, 0, -1 }, { -2, 0, 0, -1 }, { -2, 0, 0, -1 }, { -1, 0, 0, -1 }, { -1, 0, 0, -1 }, { -1, 0, 0, -1 }, { -1, 0, 0, -1 }, { -1, 0, 0, -1 }, { -1, 0, 0, -1 }, { -1, 0, 0, -1 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 } }; /* all my samples have 1st index 0 or 1 */ /* second index is subband, only indexes 0-29 seem to be used */ static int8_t coding_method_table[5][30] = { { 34, 30, 24, 24, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 }, { 34, 30, 24, 24, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 }, { 34, 30, 30, 30, 24, 24, 16, 16, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 }, { 34, 34, 30, 30, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10, 10 }, { 34, 34, 30, 30, 30, 30, 30, 30, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 }, }; static const int vlc_stage3_values[60] = { 0, 1, 2, 3, 4, 6, 8, 10, 12, 16, 20, 24, 28, 36, 44, 52, 60, 76, 92, 108, 124, 156, 188, 220, 252, 316, 380, 444, 508, 636, 764, 892, 1020, 1276, 1532, 1788, 2044, 2556, 3068, 3580, 4092, 5116, 6140, 7164, 8188, 10236, 12284, 14332, 16380, 20476, 24572, 28668, 32764, 40956, 49148, 57340, 65532, 81916, 98300,114684 }; static const float fft_tone_sample_table[4][16][5] = { { { .0100000000f,-.0037037037f,-.0020000000f,-.0069444444f,-.0018416207f }, { .0416666667f, .0000000000f, .0000000000f,-.0208333333f,-.0123456791f }, { .1250000000f, .0558035709f, .0330687836f,-.0164473690f,-.0097465888f }, { .1562500000f, .0625000000f, .0370370370f,-.0062500000f,-.0037037037f }, { .1996007860f, .0781250000f, .0462962948f, .0022727272f, .0013468013f }, { .2000000000f, .0625000000f, .0370370373f, .0208333333f, .0074074073f }, { .2127659619f, .0555555556f, .0329218097f, .0208333333f, .0123456791f }, { .2173913121f, .0473484844f, .0280583613f, .0347222239f, .0205761325f }, { .2173913121f, .0347222239f, .0205761325f, .0473484844f, .0280583613f }, { .2127659619f, .0208333333f, .0123456791f, .0555555556f, .0329218097f }, { .2000000000f, .0208333333f, .0074074073f, .0625000000f, .0370370370f }, { .1996007860f, .0022727272f, .0013468013f, .0781250000f, .0462962948f }, { .1562500000f,-.0062500000f,-.0037037037f, .0625000000f, .0370370370f }, { .1250000000f,-.0164473690f,-.0097465888f, .0558035709f, .0330687836f }, { .0416666667f,-.0208333333f,-.0123456791f, .0000000000f, .0000000000f }, { .0100000000f,-.0069444444f,-.0018416207f,-.0037037037f,-.0020000000f } }, { { .0050000000f,-.0200000000f, .0125000000f,-.3030303030f, .0020000000f }, { .1041666642f, .0400000000f,-.0250000000f, .0333333333f,-.0200000000f }, { .1250000000f, .0100000000f, .0142857144f,-.0500000007f,-.0200000000f }, { .1562500000f,-.0006250000f,-.00049382716f,-.000625000f,-.00049382716f }, { .1562500000f,-.0006250000f,-.00049382716f,-.000625000f,-.00049382716f }, { .1250000000f,-.0500000000f,-.0200000000f, .0100000000f, .0142857144f }, { .1041666667f, .0333333333f,-.0200000000f, .0400000000f,-.0250000000f }, { .0050000000f,-.3030303030f, .0020000001f,-.0200000000f, .0125000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } }, { { .1428571492f, .1250000000f,-.0285714287f,-.0357142873f, .0208333333f }, { .1818181818f, .0588235296f, .0333333333f, .0212765951f, .0100000000f }, { .1818181818f, .0212765951f, .0100000000f, .0588235296f, .0333333333f }, { .1428571492f,-.0357142873f, .0208333333f, .1250000000f,-.0285714287f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } }, { { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f }, { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } } }; static const float fft_tone_level_table[2][64] = { { /* pow ~ (i > 46) ? 0 : (((((i & 1) ? 431 : 304) << (i >> 1))) / 1024.0); */ 0.17677669f, 0.42677650f, 0.60355347f, 0.85355347f, 1.20710683f, 1.68359375f, 2.37500000f, 3.36718750f, 4.75000000f, 6.73437500f, 9.50000000f, 13.4687500f, 19.0000000f, 26.9375000f, 38.0000000f, 53.8750000f, 76.0000000f, 107.750000f, 152.000000f, 215.500000f, 304.000000f, 431.000000f, 608.000000f, 862.000000f, 1216.00000f, 1724.00000f, 2432.00000f, 3448.00000f, 4864.00000f, 6896.00000f, 9728.00000f, 13792.0000f, 19456.0000f, 27584.0000f, 38912.0000f, 55168.0000f, 77824.0000f, 110336.000f, 155648.000f, 220672.000f, 311296.000f, 441344.000f, 622592.000f, 882688.000f, 1245184.00f, 1765376.00f, 2490368.00f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, }, { /* pow = (i > 45) ? 0 : ((((i & 1) ? 431 : 304) << (i >> 1)) / 512.0); */ 0.59375000f, 0.84179688f, 1.18750000f, 1.68359375f, 2.37500000f, 3.36718750f, 4.75000000f, 6.73437500f, 9.50000000f, 13.4687500f, 19.0000000f, 26.9375000f, 38.0000000f, 53.8750000f, 76.0000000f, 107.750000f, 152.000000f, 215.500000f, 304.000000f, 431.000000f, 608.000000f, 862.000000f, 1216.00000f, 1724.00000f, 2432.00000f, 3448.00000f, 4864.00000f, 6896.00000f, 9728.00000f, 13792.0000f, 19456.0000f, 27584.0000f, 38912.0000f, 55168.0000f, 77824.0000f, 110336.000f, 155648.000f, 220672.000f, 311296.000f, 441344.000f, 622592.000f, 882688.000f, 1245184.00f, 1765376.00f, 2490368.00f, 3530752.00f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f } }; static const float fft_tone_envelope_table[4][31] = { { .009607375f, .038060248f, .084265202f, .146446645f, .222214907f, .308658302f, .402454883f, .500000060f, .597545207f, .691341758f, .777785182f, .853553414f, .915734828f, .961939812f, .990392685f, 1.00000000f, .990392625f, .961939752f, .915734768f, .853553295f, .777785063f, .691341639f, .597545087f, .500000000f, .402454853f, .308658272f, .222214878f, .146446615f, .084265172f, .038060218f, .009607345f }, { .038060248f, .146446645f, .308658302f, .500000060f, .691341758f, .853553414f, .961939812f, 1.00000000f, .961939752f, .853553295f, .691341639f, .500000000f, .308658272f, .146446615f, .038060218f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f }, { .146446645f, .500000060f, .853553414f, 1.00000000f, .853553295f, .500000000f, .146446615f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f }, { .500000060f, 1.00000000f, .500000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f } }; static const float sb_noise_attenuation[32] = { 0.0f, 0.0f, 0.3f, 0.4f, 0.5f, 0.7f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, }; static const uint8_t fft_subpackets[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0 }; /* first index is joined_stereo, second index is 0 or 2 (1 is unused) */ static float dequant_1bit[2][3] = { {-0.920000f, 0.000000f, 0.920000f }, {-0.890000f, 0.000000f, 0.890000f } }; static const float type30_dequant[8] = { -1.0f,-0.625f,-0.291666656732559f,0.0f, 0.25f,0.5f,0.75f,1.0f, }; static const float type34_delta[10] = { // FIXME: covers 8 entries.. -1.0f,-0.60947573184967f,-0.333333343267441f,-0.138071194291115f,0.0f, 0.138071194291115f,0.333333343267441f,0.60947573184967f,1.0f,0.0f, }; #endif /* QDM2DATA_H */ Index: Makefile.am =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/libavcodec/Makefile.am,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- Makefile.am 5 Sep 2005 17:02:57 -0000 1.66 +++ Makefile.am 23 Oct 2005 02:11:41 -0000 1.67 @@ -9,8 +9,8 @@ # we need to compile everything in debug mode, including the encoders, # otherwise we get unresolved symbols, because some unsatisfied function calls # are not optimized away with debug optimization -AM_CFLAGS = $(LIBFFMPEG_CFLAGS) `test "$(CFLAGS)" = "$(DEBUG_CFLAGS)" && echo -DCONFIG_ENCODERS` -AM_CPPFLAGS = $(ZLIB_CPPFLAGS) +AM_CFLAGS = $(LIBFFMPEG_CFLAGS) `test "$(CFLAGS)" = "$(DEBUG_CFLAGS)" && echo -DCONFIG_ENCODERS` -I../libavutil +AM_CPPFLAGS = $(ZLIB_CPPFLAGS) -I../libavutil ASFLAGS = noinst_LTLIBRARIES = libavcodec.la @@ -67,6 +67,7 @@ msvideo1.c \ parser.c \ pcm.c \ + qdm2.c \ qdrw.c \ qpeg.c \ qtrle.c \ @@ -74,7 +75,6 @@ ra288.c \ rangecoder.c \ ratecontrol.c \ - rational.c \ roqvideo.c \ rpza.c \ rv10.c \ @@ -112,7 +112,6 @@ bitstream.h \ bswap.h \ cabac.h \ - common.h \ dsputil.h \ dvdata.h \ faandct.h \ @@ -132,10 +131,11 @@ mpegaudiotab.h \ mpegvideo.h \ msmpeg4data.h \ + opt.h \ + qdm2data.h \ ra144.h \ ra288.h \ rangecoder.h \ - rational.h \ simple_idct.h \ sp5x.h \ svq1_cb.h \ Index: avcodec.h =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/libavcodec/avcodec.h,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- avcodec.h 19 Jul 2005 20:30:40 -0000 1.39 +++ avcodec.h 23 Oct 2005 02:11:41 -0000 1.40 @@ -11,21 +11,21 @@ extern "C" { #endif -#include "common.h" -#include "rational.h" +#include "avutil.h" #include <sys/types.h> /* size_t */ +//FIXME the following 2 really dont belong in here #define FFMPEG_VERSION_INT 0x000409 #define FFMPEG_VERSION "CVS" -#define LIBAVCODEC_BUILD 4758 - - -#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT -#define LIBAVCODEC_VERSION FFMPEG_VERSION #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s -#define LIBAVCODEC_IDENT "FFmpeg" LIBAVCODEC_VERSION "b" AV_STRINGIFY(LIBAVCODEC_BUILD) + +#define LIBAVCODEC_VERSION_INT ((50<<16)+(1<<8)+0) +#define LIBAVCODEC_VERSION 50.1.0 +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT + +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) #define AV_NOPTS_VALUE int64_t_C(0x8000000000000000) #define AV_TIME_BASE 1000000 @@ -118,6 +118,7 @@ CODEC_ID_AASC, CODEC_ID_INDEO2, CODEC_ID_FRAPS, + CODEC_ID_TRUEMOTION2, /* various pcm "codecs" */ CODEC_ID_PCM_S16LE= 0x10000, @@ -128,6 +129,15 @@ CODEC_ID_PCM_U8, CODEC_ID_PCM_MULAW, CODEC_ID_PCM_ALAW, + CODEC_ID_PCM_S32LE, + CODEC_ID_PCM_S32BE, + CODEC_ID_PCM_U32LE, + CODEC_ID_PCM_U32BE, + CODEC_ID_PCM_S24LE, + CODEC_ID_PCM_S24BE, + CODEC_ID_PCM_U24LE, + CODEC_ID_PCM_U24BE, + CODEC_ID_PCM_S24DAUD, /* various adpcm codecs */ CODEC_ID_ADPCM_IMA_QT= 0x11000, @@ -182,6 +192,7 @@ CODEC_ID_ALAC, CODEC_ID_WESTWOOD_SND1, CODEC_ID_GSM, + CODEC_ID_QDM2, CODEC_ID_OGGTHEORA= 0x16000, @@ -285,14 +296,6 @@ ME_X1 }; -enum AVRounding { - AV_ROUND_ZERO = 0, ///< round toward zero - AV_ROUND_INF = 1, ///< round away from zero - AV_ROUND_DOWN = 2, ///< round toward -infinity - AV_ROUND_UP = 3, ///< round toward +infinity - AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero -}; - enum AVDiscard{ //we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames) AVDISCARD_NONE =-16, ///< discard nothing @@ -687,6 +690,7 @@ or AVFormatContext, which begin with an AVClass. Needed because av_log is in libavcodec and has no visibility of AVIn/OutputFormat */ + struct AVOption *option; }; /** @@ -747,14 +751,17 @@ void *extradata; int extradata_size; - /* video only */ /** - * time base in which the timestamps are specified. + * this is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. for fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. * - encoding: MUST be set by user * - decoding: set by lavc. */ AVRational time_base; + /* video only */ /** * picture width / height. * - encoding: MUST be set by user. @@ -1007,7 +1014,7 @@ * - decoding: set by user */ int error_resilience; -#define FF_ER_CAREFULL 1 +#define FF_ER_CAREFUL 1 #define FF_ER_COMPLIANT 2 #define FF_ER_AGGRESSIVE 3 #define FF_ER_VERY_AGGRESSIVE 4 @@ -1214,6 +1221,7 @@ #define FF_IDCT_H264 11 #define FF_IDCT_VP3 12 #define FF_IDCT_IPP 13 +#define FF_IDCT_XVIDMMX 14 /** * slice count. @@ -1850,42 +1858,6 @@ enum AVDiscard skip_frame; } AVCodecContext; - -/** - * AVOption. - */ -typedef struct AVOption { - /** options' name */ - const char *name; /* if name is NULL, it indicates a link to next */ - /** short English text help or const struct AVOption* subpointer */ - const char *help; // const struct AVOption* sub; - /** offset to context structure where the parsed value should be stored */ - int offset; - /** options' type */ - int type; -#define FF_OPT_TYPE_BOOL 1 ///< boolean - true,1,on (or simply presence) -#define FF_OPT_TYPE_DOUBLE 2 ///< double -#define FF_OPT_TYPE_INT 3 ///< integer -#define FF_OPT_TYPE_STRING 4 ///< string (finished with \0) -#define FF_OPT_TYPE_MASK 0x1f ///< mask for types - upper bits are various flags -//#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option -#define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40) -#define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80) - /** min value (min == max -> no limits) */ - double min; - /** maximum value for double/int */ - double max; - /** default boo [0,1]l/double/int value */ - double defval; - /** - * default string value (with optional semicolon delimited extra option-list - * i.e. option1;option2;option3 - * defval might select other then first argument as default - */ - const char *defstr; -#define FF_OPT_MAX_DEPTH 10 -} AVOption; - /** * AVCodec. */ @@ -1900,7 +1872,9 @@ int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, uint8_t *buf, int buf_size); int capabilities; +#if LIBAVCODEC_VERSION_INT < ((50<<16)+(0<<8)+0) void *dummy; // FIXME remove next time we break binary compatibility +#endif struct AVCodec *next; void (*flush)(AVCodecContext *); const AVRational *supported_framerates; ///array of supported framerates, or NULL if any, array is terminated by {0,0} @@ -2034,6 +2008,7 @@ extern AVCodec mp3_decoder; extern AVCodec mp3adu_decoder; extern AVCodec mp3on4_decoder; +extern AVCodec qdm2_decoder; extern AVCodec mace3_decoder; extern AVCodec mace6_decoder; extern AVCodec huffyuv_decoder; @@ -2074,6 +2049,7 @@ extern AVCodec vmdvideo_decoder; extern AVCodec vmdaudio_decoder; extern AVCodec truemotion1_decoder; +extern AVCodec truemotion2_decoder; extern AVCodec mszh_decoder; extern AVCodec zlib_decoder; extern AVCodec ra_144_decoder; @@ -2107,6 +2083,15 @@ extern AVCodec name ## _decoder; \ extern AVCodec name ## _encoder +PCM_CODEC(CODEC_ID_PCM_S32LE, pcm_s32le); +PCM_CODEC(CODEC_ID_PCM_S32BE, pcm_s32be); +PCM_CODEC(CODEC_ID_PCM_U32LE, pcm_u32le); +PCM_CODEC(CODEC_ID_PCM_U32BE, pcm_u32be); +PCM_CODEC(CODEC_ID_PCM_S24LE, pcm_s24le); +PCM_CODEC(CODEC_ID_PCM_S24BE, pcm_s24be); +PCM_CODEC(CODEC_ID_PCM_U24LE, pcm_u24le); +PCM_CODEC(CODEC_ID_PCM_U24BE, pcm_u24be); +PCM_CODEC(CODEC_ID_PCM_S24DAUD, pcm_s24daud); PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le); PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be); PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le); @@ -2314,30 +2299,6 @@ */ char av_get_pict_type_char(int pict_type); -/** - * reduce a fraction. - * this is usefull for framerate calculations - * @param max the maximum allowed for dst_nom & dst_den - * @return 1 if exact, 0 otherwise - */ -int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max); - -/** - * rescale a 64bit integer with rounding to nearest. - * a simple a*b/c isn't possible as it can overflow - */ -int64_t av_rescale(int64_t a, int64_t b, int64_t c); - -/** - * rescale a 64bit integer with specified rounding. - * a simple a*b/c isn't possible as it can overflow - */ -int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding); - -/** - * rescale a 64bit integer by 2 rational numbers. - */ -int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq); /* frame parsing */ typedef struct AVCodecParserContext { @@ -2363,6 +2324,9 @@ int64_t cur_frame_offset[AV_PARSER_PTS_NB]; int64_t cur_frame_pts[AV_PARSER_PTS_NB]; int64_t cur_frame_dts[AV_PARSER_PTS_NB]; + + int flags; +#define PARSER_FLAG_COMPLETE_FRAMES 0x0001 } AVCodecParserContext; typedef struct AVCodecParser { Index: bitstream.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/libavcodec/bitstream.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- bitstream.c 28 May 2005 01:40:40 -0000 1.2 +++ bitstream.c 23 Oct 2005 02:11:41 -0000 1.3 @@ -37,7 +37,7 @@ #endif } -void put_string(PutBitContext * pbc, char *s, int put_zero) +void ff_put_string(PutBitContext * pbc, char *s, int put_zero) { while(*s){ put_bits(pbc, 8, *s); Index: bitstream.h =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/libavcodec/bitstream.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- bitstream.h 19 Jul 2005 20:30:40 -0000 1.3 +++ bitstream.h 23 Oct 2005 02:11:41 -0000 1.4 @@ -53,6 +53,11 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) { + if(buffer_size < 0) { + buffer_size = 0; + buffer = NULL; + } + s->buf = buffer; s->buf_end = s->buf + buffer_size; #ifdef ALT_BITSTREAM_WRITER @@ -95,7 +100,7 @@ } void align_put_bits(PutBitContext *s); -void put_string(PutBitContext * pbc, char *s, int put_zero); +void ff_put_string(PutBitContext * pbc, char *s, int put_zero); /* bit input */ /* buffer, buffer_end and size_in_bits must be present and used by every reader */ @@ -672,7 +677,11 @@ static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size) { - const int buffer_size= (bit_size+7)>>3; + int buffer_size= (bit_size+7)>>3; + if(buffer_size < 0 || bit_size < 0) { + buffer_size = bit_size = 0; + buffer = NULL; + } s->buffer= buffer; s->size_in_bits= bit_size; Index: cinepak.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/libavcodec/cinepak.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- cinepak.c 19 Jul 2005 20:30:40 -0000 1.7 +++ cinepak.c 23 Oct 2005 02:11:41 -0000 1.8 @@ -316,13 +316,22 @@ uint8_t *eod = (s->data + s->size); int i, result, strip_size, frame_flags, num_strips; int y0 = 0; + int encoded_buf_size; + /* if true, Cinepak data is from a Sega FILM/CPK file */ + int sega_film_data = 0; if (s->size < 10) return -1; frame_flags = s->data[0]; num_strips = BE_16 (&s->data[8]); - s->data += 10; + encoded_buf_size = BE_16 (&s->data[2]); + if (encoded_buf_size != s->size) + sega_film_data = 1; + if (sega_film_data) + s->data += 12; + else + s->data += 10; if (num_strips > MAX_STRIPS) num_strips = MAX_STRIPS; Index: cyuv.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/libavcodec/cyuv.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- cyuv.c 30 May 2004 19:24:19 -0000 1.5 +++ cyuv.c 23 Oct 2005 02:11:41 -0000 1.6 @@ -51,6 +51,9 @@ s->avctx = avctx; s->width = avctx->width; + /* width needs to be divisible by 4 for this codec to work */ + if (s->width & 0x3) + return -1; s->height = avctx->height; avctx->pix_fmt = PIX_FMT_YUV411P; avctx->has_b_frames = 0; Index: dsputil.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/libavcodec/dsputil.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- dsputil.c 19 Jul 2005 20:30:54 -0000 1.41 +++ dsputil.c 23 Oct 2005 02:11:41 -0000 1.42 @@ -2990,7 +2990,8 @@ return s; } -static int nsse16_c(MpegEncContext *c, uint8_t *s1, uint8_t *s2, int stride, int h){ +static int nsse16_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ + MpegEncContext *c = v; int score1=0; int score2=0; int x,y; @@ -3015,7 +3016,8 @@ else return score1 + ABS(score2)*8; } -static int nsse8_c(MpegEncContext *c, uint8_t *s1, uint8_t *s2, int stride, int h){ +static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ + MpegEncContext *c = v; int score1=0; int score2=0; int x,y; Index: dsputil.h =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/libavcodec/dsputil.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- dsputil.h 19 Jul 2005 20:30:54 -0000 1.34 +++ dsputil.h 23 Oct 2005 02:11:41 -0000 1.35 @@ -597,33 +597,4 @@ return score;\ } -#ifndef HAVE_LRINTF -/* XXX: add ISOC specific test to avoid specific BSD testing. */ -/* better than nothing implementation. */ -/* btw, rintf() is existing on fbsd too -- alex */ -static always_inline long int lrintf(float x) -{ -#ifdef CONFIG_WIN32 -# ifdef ARCH_X86 - int32_t i; - asm volatile( - "fistpl %0\n\t" - : "=m" (i) : "t" (x) : "st" - ); - return i; -# else - /* XXX: incorrect, but make it compile */ - return (int)(x + (x < 0 ? -0.5 : 0.5)); -# endif -#else - return (int)(rint(x)); -#endif -} -#else -#ifndef _ISOC9X_SOURCE -#define _ISOC9X_SOURCE -#endif -#include <math.h> -#endif - #endif Index: dv.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/libavcodec/dv.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- dv.c 28 May 2005 01:40:40 -0000 1.18 +++ dv.c 23 Oct 2005 02:11:41 -0000 1.19 @@ -34,9 +34,13 @@ #include "simple_idct.h" #include "dvdata.h" +//#undef NDEBUG +//#include <assert.h> + typedef struct DVVideoContext { const DVprofile* sys; AVFrame picture; + AVCodecContext *avctx; uint8_t *buf; uint8_t dv_zigzag[2][64]; @@ -54,7 +58,7 @@ #define DV_VLC_MAP_LEV_SIZE 23 #else #define DV_VLC_MAP_RUN_SIZE 64 -#define DV_VLC_MAP_LEV_SIZE 512 +#define DV_VLC_MAP_LEV_SIZE 512 //FIXME sign was removed so this should be /2 but needs check #endif /* MultiThreading */ @@ -109,14 +113,13 @@ done = 1; - dv_vlc_map = av_mallocz(DV_VLC_MAP_LEV_SIZE*DV_VLC_MAP_RUN_SIZE*sizeof(struct dv_vlc_pair)); + dv_vlc_map = av_mallocz_static(DV_VLC_MAP_LEV_SIZE*DV_VLC_MAP_RUN_SIZE*sizeof(struct dv_vlc_pair)); if (!dv_vlc_map) return -ENOMEM; /* dv_anchor lets each thread know its Id */ dv_anchor = av_malloc(12*27*sizeof(void*)); if (!dv_anchor) { - av_free(dv_vlc_map); return -ENOMEM; } for (i=0; i<12*27; i++) @@ -149,7 +152,6 @@ dv_rl_vlc = av_malloc(dv_vlc.table_size * sizeof(RL_VLC_ELEM)); if (!dv_rl_vlc) { av_free(dv_anchor); - av_free(dv_vlc_map); return -ENOMEM; } for(i = 0; i < dv_vlc.table_size; i++){ @@ -226,7 +228,13 @@ /* 248DCT setup */ s->fdct[1] = dsp.fdct248; s->idct_put[1] = simple_idct248_put; // FIXME: need to add it to DSP - memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); + if(avctx->lowres){ + for (i=0; i<64; i++){ + int j= ff_zigzag248_direct[i]; + s->dv_zigzag[1][i] = dsp.idct_permutation[(j&7) + (j&8)*4 + (j&48)/2]; + } + }else + memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); /* XXX: do it only for constant case */ dv_build_unquantize_tables(s, dsp.idct_permutation); @@ -235,6 +243,7 @@ if (dv_codec_profile(avctx)) avctx->pix_fmt = dv_codec_profile(avctx)->pix_fmt; avctx->coded_frame = &s->picture; + s->avctx= avctx; return 0; } @@ -334,10 +343,9 @@ if (pos >= 64) break; - if (level) { - pos1 = scan_table[pos]; - block[pos1] = level << shift_table[pos1]; - } + assert(level); + pos1 = scan_table[pos]; + block[pos1] = level << shift_table[pos1]; UPDATE_CACHE(re, gb); } @@ -348,9 +356,9 @@ static inline void bit_copy(PutBitContext *pb, GetBitContext *gb) { int bits_left = get_bits_left(gb); - while (bits_left >= 16) { - put_bits(pb, 16, get_bits(gb, 16)); - bits_left -= 16; + while (bits_left >= MIN_CACHE_BITS) { + put_bits(pb, MIN_CACHE_BITS, get_bits(gb, MIN_CACHE_BITS)); + bits_left -= MIN_CACHE_BITS; } if (bits_left > 0) { put_bits(pb, bits_left, get_bits(gb, bits_left)); @@ -373,9 +381,13 @@ GetBitContext gb; BlockInfo mb_data[5 * 6], *mb, *mb1; DCTELEM sblock[5*6][64] __align8; - uint8_t mb_bit_buffer[80 + 4]; /* allow some slack */ - uint8_t vs_bit_buffer[5 * 80 + 4]; /* allow some slack */ + uint8_t mb_bit_buffer[80 + 4] __align8; /* allow some slack */ + uint8_t vs_bit_buffer[5 * 80 + 4] __align8; /* allow some slack */ + const int log2_blocksize= 3-s->avctx->lowres; + assert((((int)mb_bit_buffer)&7)==0); + assert((((int)vs_bit_buffer)&7)==0); + memset(sblock, 0, sizeof(sblock)); /* pass 1 : read DC and AC coefficients in blocks */ @@ -477,39 +489,38 @@ v = *mb_pos_ptr++; mb_x = v & 0xff; mb_y = v >> 8; - y_ptr = s->picture.data[0] + (mb_y * s->picture.linesize[0] * 8) + (mb_x * 8); + y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x)<<log2_blocksize); if (s->sys->pix_fmt == PIX_FMT_YUV411P) - c_offset = (mb_y * s->picture.linesize[1] * 8) + ((mb_x >> 2) * 8); + c_offset = ((mb_y * s->picture.linesize[1] + (mb_x >> 2))<<log2_blocksize); else - c_offset = ((mb_y >> 1) * s->picture.linesize[1] * 8) + ((mb_x >> 1) * 8); + c_offset = (((mb_y >> 1) * s->picture.linesize[1] + (mb_x >> 1))<<log2_blocksize); for(j = 0;j < 6; j++) { - idct_put = s->idct_put[mb->dct_mode]; + idct_put = s->idct_put[mb->dct_mode && log2_blocksize==3]; if (j < 4) { if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x < (704 / 8)) { /* NOTE: at end of line, the macroblock is handled as 420 */ - idct_put(y_ptr + (j * 8), s->picture.linesize[0], block); + idct_put(y_ptr + (j<<log2_blocksize), s->picture.linesize[0], block); } else { - idct_put(y_ptr + ((j & 1) * 8) + ((j >> 1) * 8 * s->picture.linesize[0]), + idct_put(y_ptr + (((j & 1) + (j >> 1) * s->picture.linesize[0])<<log2_blocksize), s->picture.linesize[0], block); } } else { if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) { uint64_t aligned_pixels[64/8]; uint8_t *pixels= (uint8_t*)aligned_pixels; - uint8_t *c_ptr, *c_ptr1, *ptr; - int y, linesize; + uint8_t *c_ptr, *c_ptr1, *ptr, *ptr1; + int x, y, linesize; /* NOTE: at end of line, the macroblock is handled as 420 */ idct_put(pixels, 8, block); linesize = s->picture.linesize[6 - j]; c_ptr = s->picture.data[6 - j] + c_offset; ptr = pixels; - for(y = 0;y < 8; y++) { - /* convert to 411P */ - c_ptr1 = c_ptr + 8*linesize; - c_ptr[0]= ptr[0]; c_ptr1[0]= ptr[4]; - c_ptr[1]= ptr[1]; c_ptr1[1]= ptr[5]; - c_ptr[2]= ptr[2]; c_ptr1[2]= ptr[6]; - c_ptr[3]= ptr[3]; c_ptr1[3]= ptr[7]; + for(y = 0;y < (1<<log2_blocksize); y++) { + ptr1= ptr + (1<<(log2_blocksize-1)); + c_ptr1 = c_ptr + (linesize<<log2_blocksize); + for(x=0; x < (1<<(log2_blocksize-1)); x++){ + c_ptr[x]= ptr[x]; c_ptr1[x]= ptr1[x]; + } c_ptr += linesize; ptr += 8; } @@ -527,14 +538,9 @@ #ifdef DV_CODEC_TINY_TARGET /* Converts run and level (where level != 0) pair into vlc, returning bit size */ -static always_inline int dv_rl2vlc(int run, int l, uint32_t* vlc) +static always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc) { - int sign = l >> 8; - int level = (l ^ sign) - sign; int size; - - sign = (sign & 1); - if (run < DV_VLC_MAP_RUN_SIZE && level < DV_VLC_MAP_LEV_SIZE) { *vlc = dv_vlc_map[run][level].vlc | sign; size = dv_vlc_map[run][level].size; @@ -557,9 +563,8 @@ return size; } -static always_inline int dv_rl2vlc_size(int run, int l) +static always_inline int dv_rl2vlc_size(int run, int level) { - int level = (l ^ (l >> 8)) - (l >> 8); int size; if (run < DV_VLC_MAP_RUN_SIZE && level < DV_VLC_MAP_LEV_SIZE) { @@ -574,41 +579,43 @@ return size; } #else -static always_inline int dv_rl2vlc(int run, int l, uint32_t* vlc) +static always_inline int dv_rl2vlc(int run, int l, int sign, uint32_t* vlc) { - *vlc = dv_vlc_map[run][((uint16_t)l)&0x1ff].vlc; - return dv_vlc_map[run][((uint16_t)l)&0x1ff].size; + *vlc = dv_vlc_map[run][l].vlc | sign; + return dv_vlc_map[run][l].size; } static always_inline int dv_rl2vlc_size(int run, int l) { - return dv_vlc_map[run][((uint16_t)l)&0x1ff].size; + return dv_vlc_map[run][l].size; } #endif typedef struct EncBlockInfo { int area_q[4]; int bit_size[4]; - int prev_run[4]; + int prev[5]; int cur_ac; int cno; int dct_mode; - DCTELEM *mb; + DCTELEM mb[64]; + uint8_t next[64]; + uint8_t sign[64]; uint8_t partial_bit_count; uint32_t partial_bit_buffer; /* we can't use uint16_t here */ } EncBlockInfo; -static always_inline void dv_encode_ac(EncBlockInfo* bi, PutBitContext* pb_pool, - int pb_size) +static always_inline PutBitContext* dv_encode_ac(EncBlockInfo* bi, PutBitContext* pb_pool, + PutBitContext* pb_end) { - int run; + int prev; int bits_left; PutBitContext* pb = pb_pool; int size = bi->partial_bit_count; uint32_t vlc = bi->partial_bit_buffer; - + bi->partial_bit_count = bi->partial_bit_buffer = 0; -vlc_loop: + for(;;){ /* Find suitable storage space */ for (; size > (bits_left = put_bits_left(pb)); pb++) { if (bits_left) { @@ -616,69 +623,84 @@ put_bits(pb, bits_left, vlc >> size); vlc = vlc & ((1<<size)-1); } - if (pb_size == 1) { + if (pb + 1 >= pb_end) { bi->partial_bit_count = size; bi->partial_bit_buffer = vlc; - return; + return pb; } - --pb_size; } /* Store VLC */ put_bits(pb, size, vlc); + if(bi->cur_ac>=64) + break; + /* Construct the next VLC */ - run = 0; - for (; bi->cur_ac < 64; bi->cur_ac++, run++) { - if (bi->mb[bi->cur_ac]) { - size = dv_rl2vlc(run, bi->mb[bi->cur_ac], &vlc); - bi->cur_ac++; - goto vlc_loop; - } - } - - if (bi->cur_ac == 64) { + prev= bi->cur_ac; + bi->cur_ac = bi->next[prev]; + if(bi->cur_ac < 64){ + size = dv_rl2vlc(bi->cur_ac - prev - 1, bi->mb[bi->cur_ac], bi->sign[bi->cur_ac], &vlc); + } else { size = 4; vlc = 6; /* End Of Block stamp */ - bi->cur_ac++; - goto vlc_loop; } + } + return pb; } static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, const uint8_t* zigzag_scan, int bias) { int i, area; - int run; - int classes[] = {12, 24, 36, 0xffff}; + static const int classes[] = {12, 24, 36, 0xffff}; + int max=12; + int prev=0; - run = 0; bi->mb[0] = blk[0]; - bi->cno = 0; + for (area = 0; area < 4; area++) { - bi->prev_run[area] = run; - bi->bit_size[area] = 0; + bi->prev[area] = prev; + bi->bit_size[area] = 1; // 4 areas 4 bits for EOB :) for (i=mb_area_start[area]; i<mb_area_start[area+1]; i++) { - bi->mb[i] = (blk[zigzag_scan[i]] / 16); - while ((bi->mb[i] ^ (bi->mb[i] >> 8)) > classes[bi->cno]) - bi->cno++; + int level = blk[zigzag_scan[i]]; - if (bi->mb[i]) { - bi->bit_size[area] += dv_rl2vlc_size(run, bi->mb[i]); - run = 0; - } else - ++run; + if (level+15 > 30U) { + bi->sign[i] = (level>>31)&1; + bi->mb[i] = level= ABS(level)>>4; + if(level>max) max= level; + bi->bit_size[area] += dv_rl2vlc_size(i - prev - 1, level); + bi->next[prev]= i; + prev= i; + } } } - bi->bit_size[3] += 4; /* EOB marker */ + bi->next[prev]= i; + for(bi->cno = 0; max > classes[bi->cno]; bi->cno++); + bi->cno += bias; - if (bi->cno >= 3) { /* FIXME: we have to recreate bit_size[], prev_run[] */ + if (bi->cno >= 3) { bi->cno = 3; - for (i=1; i<64; i++) - bi->mb[i] /= 2; + prev=0; + i= bi->next[prev]; + for (area = 0; area < 4; area++) { + bi->prev[area] = prev; + bi->bit_size[area] = 1; // 4 areas 4 bits for EOB :) + for (; i<mb_area_start[area+1]; i= bi->next[i]) { + bi->mb[i] >>=1; + + if (bi->mb[i]) { + bi->bit_size[area] += dv_rl2vlc_size(i - prev - 1, bi->mb[i]); + bi->next[prev]= i; + prev= i; + } + } + } + bi->next[prev]= i; } } +//FIXME replace this by dsputil #define SC(x, y) ((s[x] - s[y]) ^ ((s[x] - s[y]) >> 7)) static always_inline int dv_guess_dct_mode(DCTELEM *blk) { DCTELEM *s; @@ -707,9 +729,9 @@ static inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos) { int size[5]; - int i, j, k, a, run; + int i, j, k, a, prev; EncBlockInfo* b; - + do { b = blks; for (i=0; i<5; i++) { @@ -721,17 +743,19 @@ for (j=0; j<6; j++, b++) { for (a=0; a<4; a++) { if (b->area_q[a] != dv_quant_shifts[qnos[i] + dv_quant_offset[b->cno]][a]) { - b->bit_size[a] = (a==3)?4:0; + b->bit_size[a] = 1; // 4 areas 4 bits for EOB :) b->area_q[a]++; - run = b->prev_run[a]; - for (k=mb_area_start[a]; k<mb_area_start[a+1]; k++) { - b->mb[k] /= 2; + prev= b->prev[a]; + for (k= b->next[prev] ; k<mb_area_start[a+1]; k= b->next[k]) { + b->mb[k] >>= 1; if (b->mb[k]) { - b->bit_size[a] += dv_rl2vlc_size(run, b->mb[k]); - run = 0; - } else - ++run; + b->bit_size[a] += dv_rl2vlc_size(k - prev - 1, b->mb[k]); + prev= k; + } else { + b->next[prev] = b->next[k]; + } } + b->prev[a+1]= prev; } size[i] += b->bit_size[a]; } @@ -757,13 +781,14 @@ uint8_t* ptr; int do_edge_wrap; DCTELEM block[64] __align8; - DCTELEM sblock[5*6][64] __align8; EncBlockInfo enc_blks[5*6]; PutBitContext pbs[5*6]; PutBitContext* pb; EncBlockInfo* enc_blk; int vs_bit_size = 0; int qnos[5]; + + assert((((int)block) & 7) == 0); enc_blk = &enc_blks[0]; pb = &pbs[0]; @@ -810,21 +835,22 @@ s->get_pixels(block, data, linesize); } - enc_blk->dct_mode = dv_guess_dct_mode(block); - enc_blk->mb = &sblock[mb_index*6+j][0]; + if(s->avctx->flags & CODEC_FLAG_INTERLACED_DCT) + enc_blk->dct_mode = dv_guess_dct_mode(block); + else + enc_blk->dct_mode = 0; enc_blk->area_q[0] = enc_blk->area_q[1] = enc_blk->area_q[2] = enc_blk->area_q[3] = 0; enc_blk->partial_bit_count = 0; enc_blk->partial_bit_buffer = 0; - enc_blk->cur_ac = 1; + enc_blk->cur_ac = 0; s->fdct[enc_blk->dct_mode](block); dv_set_class_number(block, enc_blk, - enc_blk->dct_mode ? ff_zigzag248_direct : ff_zigzag_direct, - j/4*(j%2)); + enc_blk->dct_mode ? ff_zigzag248_direct : ff_zigzag_direct, j/4); init_put_bits(pb, ptr, block_sizes[j]/8); - put_bits(pb, 9, (uint16_t)(((enc_blk->mb[0] >> 3) - 1024) >> 2)); + put_bits(pb, 9, (uint16_t)(((enc_blk->mb[0] >> 3) - 1024 + 2) >> 2)); put_bits(pb, 1, enc_blk->dct_mode); put_bits(pb, 2, enc_blk->cno); @@ -845,18 +871,22 @@ /* First pass over individual cells only */ for (j=0; j<5*6; j++) - dv_encode_ac(&enc_blks[j], &pbs[j], 1); + dv_encode_ac(&enc_blks[j], &pbs[j], &pbs[j+1]); /* Second pass over each MB space */ - for (j=0; j<5*6; j++) { - if (enc_blks[j].cur_ac < 65 || enc_blks[j].part... [truncated message content] |