diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-04-03 01:18:24 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-04-03 01:18:24 +0200 |
commit | fb09531720a4aa2dfa97e5a9a246a453b6278fd2 (patch) | |
tree | 61525c3a8ddb419d3838a26e488fc3659079bbcd /contrib/ffmpeg/libavutil | |
parent | 294d01046724e28b7193bcb65bf2a0391b0135b6 (diff) | |
download | xine-lib-fb09531720a4aa2dfa97e5a9a246a453b6278fd2.tar.gz xine-lib-fb09531720a4aa2dfa97e5a9a246a453b6278fd2.tar.bz2 |
Sync with a more recent version of FFmpeg.
Diffstat (limited to 'contrib/ffmpeg/libavutil')
31 files changed, 1760 insertions, 322 deletions
diff --git a/contrib/ffmpeg/libavutil/Makefile b/contrib/ffmpeg/libavutil/Makefile index ab0db8f9b..a760401ab 100644 --- a/contrib/ffmpeg/libavutil/Makefile +++ b/contrib/ffmpeg/libavutil/Makefile @@ -1,10 +1,5 @@ -# -# libavutil Makefile -# include ../config.mak -CFLAGS+=-DBUILD_AVUTIL - OBJS= mathematics.o \ rational.o \ intfloat_readwrite.o \ @@ -16,14 +11,17 @@ OBJS= mathematics.o \ mem.o \ fifo.o \ tree.o \ + lzo.o \ + random.o \ + aes.o \ + base64.o \ HEADERS = avutil.h common.h mathematics.h integer.h rational.h \ - intfloat_readwrite.h md5.h adler32.h log.h fifo.h + intfloat_readwrite.h md5.h adler32.h log.h fifo.h lzo.h \ + random.h mem.h base64.h NAME=avutil -ifeq ($(BUILD_SHARED),yes) LIBVERSION=$(LAVUVERSION) LIBMAJOR=$(LAVUMAJOR) -endif include ../common.mak diff --git a/contrib/ffmpeg/libavutil/aes.c b/contrib/ffmpeg/libavutil/aes.c new file mode 100644 index 000000000..55ae0d4f3 --- /dev/null +++ b/contrib/ffmpeg/libavutil/aes.c @@ -0,0 +1,239 @@ +/* + * copyright (c) 2007 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg 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, + * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * some optimization ideas from aes128.c by Reimar Doeffinger + */ + +#include "common.h" +#include "aes.h" + +typedef struct AVAES{ + uint8_t round_key[15][4][4]; + uint8_t state[2][4][4]; + int rounds; +}AVAES; + +const int av_aes_size= sizeof(AVAES); + +static const uint8_t rcon[10] = { + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36 +}; + +static uint8_t sbox[256]; +static uint8_t inv_sbox[256]; +#ifdef CONFIG_SMALL +static uint32_t enc_multbl[1][256]; +static uint32_t dec_multbl[1][256]; +#else +static uint32_t enc_multbl[4][256]; +static uint32_t dec_multbl[4][256]; +#endif + +static inline void addkey(uint64_t dst[2], uint64_t src[2], uint64_t round_key[2]){ + dst[0] = src[0] ^ round_key[0]; + dst[1] = src[1] ^ round_key[1]; +} + +static void subshift(uint8_t s0[2][16], int s, uint8_t *box){ + uint8_t (*s1)[16]= s0[0] - s; + uint8_t (*s3)[16]= s0[0] + s; + s0[0][0]=box[s0[1][ 0]]; s0[0][ 4]=box[s0[1][ 4]]; s0[0][ 8]=box[s0[1][ 8]]; s0[0][12]=box[s0[1][12]]; + s1[0][3]=box[s1[1][ 7]]; s1[0][ 7]=box[s1[1][11]]; s1[0][11]=box[s1[1][15]]; s1[0][15]=box[s1[1][ 3]]; + s0[0][2]=box[s0[1][10]]; s0[0][10]=box[s0[1][ 2]]; s0[0][ 6]=box[s0[1][14]]; s0[0][14]=box[s0[1][ 6]]; + s3[0][1]=box[s3[1][13]]; s3[0][13]=box[s3[1][ 9]]; s3[0][ 9]=box[s3[1][ 5]]; s3[0][ 5]=box[s3[1][ 1]]; +} + +static inline int mix_core(uint32_t multbl[4][256], int a, int b, int c, int d){ +#ifdef CONFIG_SMALL +#define ROT(x,s) ((x<<s)|(x>>(32-s))) + return multbl[0][a] ^ ROT(multbl[0][b], 8) ^ ROT(multbl[0][c], 16) ^ ROT(multbl[0][d], 24); +#else + return multbl[0][a] ^ multbl[1][b] ^ multbl[2][c] ^ multbl[3][d]; +#endif +} + +static inline void mix(uint8_t state[2][4][4], uint32_t multbl[4][256], int s1, int s3){ + ((uint32_t *)(state))[0] = mix_core(multbl, state[1][0][0], state[1][s1 ][1], state[1][2][2], state[1][s3 ][3]); + ((uint32_t *)(state))[1] = mix_core(multbl, state[1][1][0], state[1][s3-1][1], state[1][3][2], state[1][s1-1][3]); + ((uint32_t *)(state))[2] = mix_core(multbl, state[1][2][0], state[1][s3 ][1], state[1][0][2], state[1][s1 ][3]); + ((uint32_t *)(state))[3] = mix_core(multbl, state[1][3][0], state[1][s1-1][1], state[1][1][2], state[1][s3-1][3]); +} + +static inline void crypt(AVAES *a, int s, uint8_t *sbox, uint32_t *multbl){ + int r; + + for(r=a->rounds-1; r>0; r--){ + mix(a->state, multbl, 3-s, 1+s); + addkey(a->state[1], a->state[0], a->round_key[r]); + } + subshift(a->state[0][0], s, sbox); +} + +void av_aes_crypt(AVAES *a, uint8_t *dst, uint8_t *src, int count, uint8_t *iv, int decrypt){ + while(count--){ + addkey(a->state[1], src, a->round_key[a->rounds]); + if(decrypt) { + crypt(a, 0, inv_sbox, dec_multbl); + if(iv){ + addkey(a->state[0], a->state[0], iv); + memcpy(iv, src, 16); + } + addkey(dst, a->state[0], a->round_key[0]); + }else{ + if(iv) addkey(a->state[1], a->state[1], iv); + crypt(a, 2, sbox, enc_multbl); + addkey(dst, a->state[0], a->round_key[0]); + if(iv) memcpy(iv, dst, 16); + } + src+=16; + dst+=16; + } +} + +static void init_multbl2(uint8_t tbl[1024], int c[4], uint8_t *log8, uint8_t *alog8, uint8_t *sbox){ + int i, j; + for(i=0; i<1024; i++){ + int x= sbox[i>>2]; + if(x) tbl[i]= alog8[ log8[x] + log8[c[i&3]] ]; + } +#ifndef CONFIG_SMALL + for(j=256; j<1024; j++) + for(i=0; i<4; i++) + tbl[4*j+i]= tbl[4*j + ((i-1)&3) - 1024]; +#endif +} + +// this is based on the reference AES code by Paulo Barreto and Vincent Rijmen +int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt) { + int i, j, t, rconpointer = 0; + uint8_t tk[8][4]; + int KC= key_bits>>5; + int rounds= KC + 6; + uint8_t log8[256]; + uint8_t alog8[512]; + + if(!enc_multbl[4][1023]){ + j=1; + for(i=0; i<255; i++){ + alog8[i]= + alog8[i+255]= j; + log8[j]= i; + j^= j+j; + if(j>255) j^= 0x11B; + } + for(i=0; i<256; i++){ + j= i ? alog8[255-log8[i]] : 0; + j ^= (j<<1) ^ (j<<2) ^ (j<<3) ^ (j<<4); + j = (j ^ (j>>8) ^ 99) & 255; + inv_sbox[j]= i; + sbox [i]= j; + } + init_multbl2(dec_multbl[0], (int[4]){0xe, 0x9, 0xd, 0xb}, log8, alog8, inv_sbox); + init_multbl2(enc_multbl[0], (int[4]){0x2, 0x1, 0x1, 0x3}, log8, alog8, sbox); + } + + if(key_bits!=128 && key_bits!=192 && key_bits!=256) + return -1; + + a->rounds= rounds; + + memcpy(tk, key, KC*4); + + for(t= 0; t < (rounds+1)*16;) { + memcpy(a->round_key[0][0]+t, tk, KC*4); + t+= KC*4; + + for(i = 0; i < 4; i++) + tk[0][i] ^= sbox[tk[KC-1][(i+1)&3]]; + tk[0][0] ^= rcon[rconpointer++]; + + for(j = 1; j < KC; j++){ + if(KC != 8 || j != KC>>1) + for(i = 0; i < 4; i++) tk[j][i] ^= tk[j-1][i]; + else + for(i = 0; i < 4; i++) tk[j][i] ^= sbox[tk[j-1][i]]; + } + } + + if(decrypt){ + for(i=1; i<rounds; i++){ + uint8_t tmp[3][16]; + memcpy(tmp[2], a->round_key[i][0], 16); + subshift(tmp[1], 0, sbox); + mix(tmp, dec_multbl, 1, 3); + memcpy(a->round_key[i][0], tmp[0], 16); + } + }else{ + for(i=0; i<(rounds+1)>>1; i++){ + for(j=0; j<16; j++) + FFSWAP(int, a->round_key[i][0][j], a->round_key[rounds-i][0][j]); + } + } + + return 0; +} + +#ifdef TEST +#include "log.h" + +int main(){ + int i,j; + AVAES ae, ad, b; + uint8_t rkey[2][16]= { + {0}, + {0x10, 0xa5, 0x88, 0x69, 0xd7, 0x4b, 0xe5, 0xa3, 0x74, 0xcf, 0x86, 0x7c, 0xfb, 0x47, 0x38, 0x59}}; + uint8_t pt[16], rpt[2][16]= { + {0x6a, 0x84, 0x86, 0x7c, 0xd7, 0x7e, 0x12, 0xad, 0x07, 0xea, 0x1b, 0xe8, 0x95, 0xc5, 0x3f, 0xa3}, + {0}}; + uint8_t rct[2][16]= { + {0x73, 0x22, 0x81, 0xc0, 0xa0, 0xaa, 0xb8, 0xf7, 0xa5, 0x4a, 0x0c, 0x67, 0xa0, 0xc4, 0x5e, 0xcf}, + {0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0, 0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65}}; + uint8_t temp[16]; + + av_aes_init(&ae, "PI=3.141592654..", 128, 0); + av_aes_init(&ad, "PI=3.141592654..", 128, 1); + av_log_level= AV_LOG_DEBUG; + + for(i=0; i<2; i++){ + av_aes_init(&b, rkey[i], 128, 1); + av_aes_crypt(&b, temp, rct[i], 1, NULL, 1); + for(j=0; j<16; j++) + if(rpt[i][j] != temp[j]) + av_log(NULL, AV_LOG_ERROR, "%d %02X %02X\n", j, rpt[i][j], temp[j]); + } + + for(i=0; i<10000; i++){ + for(j=0; j<16; j++){ + pt[j]= random(); + } +{START_TIMER + av_aes_crypt(&ae, temp, pt, 1, NULL, 0); + if(!(i&(i-1))) + av_log(NULL, AV_LOG_ERROR, "%02X %02X %02X %02X\n", temp[0], temp[5], temp[10], temp[15]); + av_aes_crypt(&ad, temp, temp, 1, NULL, 1); +STOP_TIMER("aes")} + for(j=0; j<16; j++){ + if(pt[j] != temp[j]){ + av_log(NULL, AV_LOG_ERROR, "%d %d %02X %02X\n", i,j, pt[j], temp[j]); + } + } + } + return 0; +} +#endif diff --git a/contrib/ffmpeg/libavutil/aes.h b/contrib/ffmpeg/libavutil/aes.h new file mode 100644 index 000000000..34ba0a2fa --- /dev/null +++ b/contrib/ffmpeg/libavutil/aes.h @@ -0,0 +1,45 @@ +/* + * copyright (c) 2007 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg 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, + * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AES_H +#define AES_H + +extern const int av_aes_size; + +struct AVAES; + +/** + * initalizes a AVAES context + * @param key_bits 128, 192 or 256 + * @param decrypt 0 for encryption, 1 for decryption + */ +int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); + +/** + * encrypts / decrypts. + * @param count number of 16 byte blocks + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param iv initalization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_aes_crypt(struct AVAES *a, uint8_t *dst, uint8_t *src, int count, uint8_t *iv, int decrypt); + +#endif /* AES_H */ diff --git a/contrib/ffmpeg/libavutil/avutil.h b/contrib/ffmpeg/libavutil/avutil.h index 08cc61567..32bc40bfb 100644 --- a/contrib/ffmpeg/libavutil/avutil.h +++ b/contrib/ffmpeg/libavutil/avutil.h @@ -34,8 +34,8 @@ extern "C" { #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s -#define LIBAVUTIL_VERSION_INT ((49<<16)+(1<<8)+0) -#define LIBAVUTIL_VERSION 49.1.0 +#define LIBAVUTIL_VERSION_INT ((49<<16)+(4<<8)+0) +#define LIBAVUTIL_VERSION 49.4.0 #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) diff --git a/contrib/ffmpeg/libavutil/base64.c b/contrib/ffmpeg/libavutil/base64.c new file mode 100644 index 000000000..bee800c82 --- /dev/null +++ b/contrib/ffmpeg/libavutil/base64.c @@ -0,0 +1,230 @@ +/* + * Base64.c + * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) + * + * This file is part of FFmpeg. + * + * FFmpeg 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, + * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** +* @file base64.c + * @brief Base64 Encode/Decode + * @author Ryan Martell <rdm4@martellventures.com> (with lots of Michael) + */ + +#include "common.h" +#include "base64.h" + +/* ---------------- private code */ +static uint8_t map2[] = +{ + 0x3e, 0xff, 0xff, 0xff, 0x3f, 0x34, 0x35, 0x36, + 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, + 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x1b, + 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, + 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, + 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33 +}; + +int av_base64_decode(uint8_t * out, const char *in, int out_length) +{ + int i, v; + uint8_t *dst = out; + + v = 0; + for (i = 0; in[i] && in[i] != '='; i++) { + unsigned int index= in[i]-43; + if (index>=(sizeof(map2)/sizeof(map2[0])) || map2[index] == 0xff) + return -1; + v = (v << 6) + map2[index]; + if (i & 3) { + if (dst - out < out_length) { + *dst++ = v >> (6 - 2 * (i & 3)); + } + } + } + + return (dst - out); +} + +/***************************************************************************** +* b64_encode: stolen from VLC's http.c +* simplified by michael +* fixed edge cases and made it work from data (vs. strings) by ryan. +*****************************************************************************/ + +char *av_base64_encode(char * buf, int buf_len, uint8_t * src, int len) +{ + static const char b64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + char *ret, *dst; + unsigned i_bits = 0; + int i_shift = 0; + int bytes_remaining = len; + + if (len >= UINT_MAX / 4 || + buf_len < len * 4 / 3 + 12) + return NULL; + ret = dst = buf; + if (len) { // special edge case, what should we really do here? + while (bytes_remaining) { + i_bits = (i_bits << 8) + *src++; + bytes_remaining--; + i_shift += 8; + + do { + *dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f]; + i_shift -= 6; + } while (i_shift > 6 || (bytes_remaining == 0 && i_shift > 0)); + } + while ((dst - ret) & 3) + *dst++ = '='; + } + *dst = '\0'; + + return ret; +} + +// #define TEST_BASE64 + +#ifdef TEST_BASE64 +#include "avutil.h" + +int b64test() +{ + int numerr = 0; + int len; + int numtest = 1; + uint8_t decode[1000]; + struct test { + void *data; + int len; + const char *result; + } *t, tests[] = { + { + "", 0, ""}, { + "1", 1, "MQ=="}, { + "22", 2, "MjI="}, { + "333", 3, "MzMz"}, { + "4444", 4, "NDQ0NA=="}, { + "55555", 5, "NTU1NTU="}, { + "abc:def", 7, "YWJjOmRlZg=="}, { + NULL} + }; + for (t = tests; t->data; t++) { + char *str; + + av_log(NULL, AV_LOG_ERROR, "Encoding %s...\n", (char *) t->data); + str = av_base64_encode(t->data, t->len); + if (str) { + av_log(NULL, AV_LOG_ERROR, "Encoded to %s...\n", str); + if (strcmp(str, t->result) != 0) { + av_log(NULL, AV_LOG_ERROR, "failed test %d: %s != %s\n", + numtest, str, t->result); + numerr++; + } + av_free(str); + } + + av_log(NULL, AV_LOG_ERROR, "Done encoding, about to decode...\n"); + len = av_base64_decode(decode, t->result, sizeof(decode)); + if (len != t->len) { + av_log(NULL, AV_LOG_ERROR, "failed test %d: len %d != %d\n", + numtest, len, t->len); + numerr++; + } else if (memcmp(decode, t->data, t->len) != 0) { + av_log(NULL, AV_LOG_ERROR, "failed test %d: data\n", numtest); + numerr++; + } else { + av_log(NULL, AV_LOG_ERROR, "Decoded to %s\n", + (char *) t->data); + } + numtest++; + } + +#undef srand +#undef rand + + { + int test_count; + srand(123141); // time(NULL)); + for (test_count = 0; test_count < 100; test_count++) { + int size = rand() % 1024; + int ii; + uint8_t *data; + char *encoded_result; + + av_log(NULL, AV_LOG_ERROR, "Test %d: Size %d bytes...", + test_count, size); + data = (uint8_t *) av_malloc(size); + for (ii = 0; ii < size; ii++) { + data[ii] = rand() % 255; + } + + encoded_result = av_base64_encode(data, size); + if (encoded_result) { + int decode_buffer_size = size + 10; // try without 10 as well + uint8_t *decode_buffer = av_malloc(decode_buffer_size); + if (decode_buffer) { + int decoded_size = + av_base64_decode(decode_buffer, encoded_result, + decode_buffer_size); + + if (decoded_size != size) { + av_log(NULL, AV_LOG_ERROR, + "Decoded/Encoded size mismatch (%d != %d)\n", + decoded_size, size); + } else { + if (memcmp(decode_buffer, data, decoded_size) == 0) { + av_log(NULL, AV_LOG_ERROR, "Passed!\n"); + } else { + av_log(NULL, AV_LOG_ERROR, + "Failed (Data differs)!\n"); + } + } + av_free(decode_buffer); + } + + av_free(encoded_result); + } + } + } + + // these are invalid strings, that it currently decodes (which it probably shouldn't?) + { + uint8_t str[32]; + if (av_base64_decode(str, "M=M=", sizeof(str)) != -1) { + av_log(NULL, AV_LOG_ERROR, + "failed test %d: successful decode of `M=M='\n", + numtest++); + numerr++; + } + if (av_base64_decode(str, "MQ===", sizeof(str)) != -1) { + av_log(NULL, AV_LOG_ERROR, + "failed test %d: successful decode of `MQ==='\n", + numtest++); + numerr++; + } + } + + return numerr; +} +#endif + diff --git a/contrib/ffmpeg/libavutil/base64.h b/contrib/ffmpeg/libavutil/base64.h new file mode 100644 index 000000000..3d905313c --- /dev/null +++ b/contrib/ffmpeg/libavutil/base64.h @@ -0,0 +1,34 @@ +/* + * Base64.c + * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) + * + * This file is part of FFmpeg. + * + * FFmpeg 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, + * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * decodes base64 + * param order as strncpy() + */ +int av_base64_decode(uint8_t * out, const char *in, int out_length); + +/** + * encodes base64 + * @param src data, not a string + * @param buf output string + */ +char *av_base64_encode(char * buf, int buf_len, uint8_t * src, int len); + diff --git a/contrib/ffmpeg/libavutil/bswap.h b/contrib/ffmpeg/libavutil/bswap.h index 4614c9045..03d613db2 100644 --- a/contrib/ffmpeg/libavutil/bswap.h +++ b/contrib/ffmpeg/libavutil/bswap.h @@ -37,7 +37,7 @@ #endif #if defined(ARCH_X86) -static always_inline uint16_t bswap_16(uint16_t x) +static av_always_inline uint16_t bswap_16(uint16_t x) { __asm("rorw $8, %0" : LEGACY_REGS (x) : @@ -45,7 +45,7 @@ static always_inline uint16_t bswap_16(uint16_t x) return x; } -static always_inline uint32_t bswap_32(uint32_t x) +static av_always_inline uint32_t bswap_32(uint32_t x) { #if __CPU__ != 386 __asm("bswap %0": @@ -82,12 +82,12 @@ static inline uint64_t bswap_64(uint64_t x) #elif defined(ARCH_SH4) -static always_inline uint16_t bswap_16(uint16_t x) { +static av_always_inline uint16_t bswap_16(uint16_t x) { __asm__("swap.b %0,%0":"=r"(x):"0"(x)); return x; } -static always_inline uint32_t bswap_32(uint32_t x) { +static av_always_inline uint32_t bswap_32(uint32_t x) { __asm__( "swap.b %0,%0\n" "swap.w %0,%0\n" @@ -110,12 +110,12 @@ static inline uint64_t bswap_64(uint64_t x) } #else -static always_inline uint16_t bswap_16(uint16_t x){ +static av_always_inline uint16_t bswap_16(uint16_t x){ return (x>>8) | (x<<8); } #ifdef ARCH_ARM -static always_inline uint32_t bswap_32(uint32_t x){ +static av_always_inline uint32_t bswap_32(uint32_t x){ uint32_t t; __asm__ ( "eor %1, %0, %0, ror #16 \n\t" @@ -126,7 +126,7 @@ static always_inline uint32_t bswap_32(uint32_t x){ return x; } #else -static always_inline uint32_t bswap_32(uint32_t x){ +static av_always_inline uint32_t bswap_32(uint32_t x){ x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); return (x>>16) | (x<<16); } diff --git a/contrib/ffmpeg/libavutil/common.h b/contrib/ffmpeg/libavutil/common.h index 41bbe8f63..9ec5c7c78 100644 --- a/contrib/ffmpeg/libavutil/common.h +++ b/contrib/ffmpeg/libavutil/common.h @@ -26,9 +26,7 @@ #ifndef COMMON_H #define COMMON_H -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif +#include <inttypes.h> #ifdef HAVE_AV_CONFIG_H /* only include the following when compiling package */ @@ -39,42 +37,23 @@ # include <string.h> # include <ctype.h> # include <limits.h> -# ifndef __BEOS__ -# include <errno.h> -# else -# include "berrno.h" -# endif +# include <errno.h> # include <math.h> #endif /* HAVE_AV_CONFIG_H */ -/* Suppress restrict if it was not defined in config.h. */ -#ifndef restrict -# define restrict -#endif - -#ifndef always_inline -#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define always_inline __attribute__((always_inline)) inline -#else -# define always_inline inline -#endif -#endif - -#ifndef attribute_used +#ifndef av_always_inline #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define attribute_used __attribute__((used)) +# define av_always_inline __attribute__((always_inline)) inline +# define av_noinline __attribute__((noinline)) #else -# define attribute_used +# define av_always_inline inline +# define av_noinline #endif #endif -#ifndef attribute_unused -#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define attribute_unused __attribute__((unused)) -#else -# define attribute_unused -#endif -#endif +#ifdef HAVE_AV_CONFIG_H +# include "internal.h" +#endif /* HAVE_AV_CONFIG_H */ #ifndef attribute_deprecated #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) @@ -84,92 +63,7 @@ #endif #endif -# include <inttypes.h> - -#ifndef PRId64 -#define PRId64 "lld" -#endif - -#ifndef PRIu64 -#define PRIu64 "llu" -#endif - -#ifndef PRIx64 -#define PRIx64 "llx" -#endif - -#ifndef PRIX64 -#define PRIX64 "llX" -#endif - -#ifndef PRId32 -#define PRId32 "d" -#endif - -#ifndef PRIdFAST16 -#define PRIdFAST16 PRId32 -#endif - -#ifndef PRIdFAST32 -#define PRIdFAST32 PRId32 -#endif - -#ifndef INT16_MIN -#define INT16_MIN (-0x7fff-1) -#endif - -#ifndef INT16_MAX -#define INT16_MAX 0x7fff -#endif - -#ifndef INT32_MIN -#define INT32_MIN (-0x7fffffff-1) -#endif - -#ifndef INT32_MAX -#define INT32_MAX 0x7fffffff -#endif - -#ifndef UINT32_MAX -#define UINT32_MAX 0xffffffff -#endif - -#ifndef INT64_MIN -#define INT64_MIN (-0x7fffffffffffffffLL-1) -#endif - -#ifndef INT64_MAX -#define INT64_MAX int64_t_C(9223372036854775807) -#endif - -#ifndef UINT64_MAX -#define UINT64_MAX uint64_t_C(0xFFFFFFFFFFFFFFFF) -#endif - -#ifndef INT_BIT -# if INT_MAX != 2147483647 -# define INT_BIT 64 -# else -# define INT_BIT 32 -# endif -#endif - -#ifndef int64_t_C -#define int64_t_C(c) (c ## LL) -#define uint64_t_C(c) (c ## ULL) -#endif - -#if defined(__MINGW32__) && !defined(BUILD_AVUTIL) && defined(BUILD_SHARED_AV) -# define FF_IMPORT_ATTR __declspec(dllimport) -#else -# define FF_IMPORT_ATTR -#endif - - -#ifdef HAVE_AV_CONFIG_H -/* only include the following when compiling package */ -# include "internal.h" -#endif +#include "mem.h" //rounded divison & shift #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) @@ -184,7 +78,7 @@ #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) /* misc math functions */ -extern FF_IMPORT_ATTR const uint8_t ff_log2_tab[256]; +extern const uint8_t ff_log2_tab[256]; static inline int av_log2(unsigned int v) { @@ -221,7 +115,7 @@ static inline int av_log2_16bit(unsigned int v) /* median of 3 */ static inline int mid_pred(int a, int b, int c) { -#if HAVE_CMOV +#ifdef HAVE_CMOV int i=b; asm volatile( "cmp %2, %1 \n\t" @@ -264,9 +158,9 @@ static inline int mid_pred(int a, int b, int c) * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range - * @return cliped value + * @return clipped value */ -static inline int clip(int a, int amin, int amax) +static inline int av_clip(int a, int amin, int amax) { if (a < amin) return amin; else if (a > amax) return amax; @@ -276,9 +170,9 @@ static inline int clip(int a, int amin, int amax) /** * clip a signed integer value into the 0-255 range * @param a value to clip - * @return cliped value + * @return clipped value */ -static inline uint8_t clip_uint8(int a) +static inline uint8_t av_clip_uint8(int a) { if (a&(~255)) return (-a)>>31; else return a; @@ -415,7 +309,7 @@ tend= read_time();\ static uint64_t tsum=0;\ static int tcount=0;\ static int tskip_count=0;\ - if(tcount<2 || tend - tstart < 8*tsum/tcount){\ + if(tcount<2 || tend - tstart < FFMAX(8*tsum/tcount, 2000)){\ tsum+= tend - tstart;\ tcount++;\ }else\ @@ -429,21 +323,4 @@ tend= read_time();\ #define STOP_TIMER(id) {} #endif -/* memory */ - -#ifdef __GNUC__ - #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n))) -#else - #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v -#endif - -/* memory */ -void *av_malloc(unsigned int size); -void *av_realloc(void *ptr, unsigned int size); -void av_free(void *ptr); - -void *av_mallocz(unsigned int size); -char *av_strdup(const char *s); -void av_freep(void *ptr); - #endif /* COMMON_H */ diff --git a/contrib/ffmpeg/libavutil/crc.c b/contrib/ffmpeg/libavutil/crc.c index baa605d32..02fb860b8 100644 --- a/contrib/ffmpeg/libavutil/crc.c +++ b/contrib/ffmpeg/libavutil/crc.c @@ -21,10 +21,17 @@ #include "common.h" #include "crc.h" +#if LIBAVUTIL_VERSION_INT < (50<<16) AVCRC *av_crcEDB88320; AVCRC *av_crc04C11DB7; AVCRC *av_crc8005 ; AVCRC *av_crc07 ; +#else +AVCRC av_crcEDB88320[257]; +AVCRC av_crc04C11DB7[257]; +AVCRC av_crc8005 [257]; +AVCRC av_crc07 [257]; +#endif /** * Inits a crc table. diff --git a/contrib/ffmpeg/libavutil/crc.h b/contrib/ffmpeg/libavutil/crc.h index e739c309b..1f6431992 100644 --- a/contrib/ffmpeg/libavutil/crc.h +++ b/contrib/ffmpeg/libavutil/crc.h @@ -23,10 +23,17 @@ typedef uint32_t AVCRC; +#if LIBAVUTIL_VERSION_INT < (50<<16) extern AVCRC *av_crcEDB88320; extern AVCRC *av_crc04C11DB7; extern AVCRC *av_crc8005 ; extern AVCRC *av_crc07 ; +#else +extern AVCRC av_crcEDB88320[]; +extern AVCRC av_crc04C11DB7[]; +extern AVCRC av_crc8005 []; +extern AVCRC av_crc07 []; +#endif int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length); diff --git a/contrib/ffmpeg/libavutil/fifo.c b/contrib/ffmpeg/libavutil/fifo.c index 550f13de5..8ac3a0cb5 100644 --- a/contrib/ffmpeg/libavutil/fifo.c +++ b/contrib/ffmpeg/libavutil/fifo.c @@ -24,11 +24,11 @@ int av_fifo_init(AVFifoBuffer *f, int size) { + f->wptr = f->rptr = f->buffer = av_malloc(size); + f->end = f->buffer + size; if (!f->buffer) return -1; - f->end = f->buffer + size; - f->wptr = f->rptr = f->buffer; return 0; } @@ -50,23 +50,7 @@ int av_fifo_size(AVFifoBuffer *f) */ int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size) { - int len; - int size = f->wptr - f->rptr; - if (size < 0) - size += f->end - f->buffer; - - if (size < buf_size) - return -1; - while (buf_size > 0) { - len = FFMIN(f->end - f->rptr, buf_size); - memcpy(buf, f->rptr, len); - buf += len; - f->rptr += len; - if (f->rptr >= f->end) - f->rptr = f->buffer; - buf_size -= len; - } - return 0; + return av_fifo_generic_read(f, buf_size, NULL, buf); } /** @@ -76,59 +60,52 @@ void av_fifo_realloc(AVFifoBuffer *f, unsigned int new_size) { unsigned int old_size= f->end - f->buffer; if(old_size < new_size){ - uint8_t *old= f->buffer; - - f->buffer= av_realloc(f->buffer, new_size); - - f->rptr += f->buffer - old; - f->wptr += f->buffer - old; - - if(f->wptr < f->rptr){ - memmove(f->rptr + new_size - old_size, f->rptr, f->buffer + old_size - f->rptr); - f->rptr += new_size - old_size; - } - f->end= f->buffer + new_size; + int len= av_fifo_size(f); + AVFifoBuffer f2; + + av_fifo_init(&f2, new_size); + av_fifo_read(f, f2.buffer, len); + f2.wptr += len; + av_free(f->buffer); + *f= f2; } } void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size) { - int len; - - while (size > 0) { - len = FFMIN(f->end - f->wptr, size); + do { + int len = FFMIN(f->end - f->wptr, size); memcpy(f->wptr, buf, len); f->wptr += len; if (f->wptr >= f->end) f->wptr = f->buffer; buf += len; size -= len; - } + } while (size > 0); } -/* get data from the fifo (return -1 if not enough data) */ +/** get data from the fifo (return -1 if not enough data) */ int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest) { - int len; - int size = f->wptr - f->rptr; - if (size < 0) - size += f->end - f->buffer; + int size = av_fifo_size(f); if (size < buf_size) return -1; - while (buf_size > 0) { - len = FFMIN(f->end - f->rptr, buf_size); - func(dest, f->rptr, len); - f->rptr += len; - if (f->rptr >= f->end) - f->rptr = f->buffer; + do { + int len = FFMIN(f->end - f->rptr, buf_size); + if(func) func(dest, f->rptr, len); + else{ + memcpy(dest, f->rptr, len); + dest = (uint8_t*)dest + len; + } + av_fifo_drain(f, len); buf_size -= len; - } + } while (buf_size > 0); return 0; } -/* discard data from the fifo */ +/** discard data from the fifo */ void av_fifo_drain(AVFifoBuffer *f, int size) { f->rptr += size; diff --git a/contrib/ffmpeg/libavutil/fifo.h b/contrib/ffmpeg/libavutil/fifo.h index 9dec0e62d..e1e85293d 100644 --- a/contrib/ffmpeg/libavutil/fifo.h +++ b/contrib/ffmpeg/libavutil/fifo.h @@ -1,3 +1,26 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg 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, + * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file fifo.h + * A very simple circular buffer FIFO implementation. + */ + #ifndef FIFO_H #define FIFO_H @@ -6,13 +29,65 @@ typedef struct AVFifoBuffer { uint8_t *rptr, *wptr, *end; } AVFifoBuffer; +/** + * Initializes an AVFifoBuffer. + * @param *f AVFifoBuffer to initialize + * @param size of FIFO + * @return <0 for failure >=0 otherwise + */ int av_fifo_init(AVFifoBuffer *f, int size); + +/** + * Frees an AVFifoBuffer. + * @param *f AVFifoBuffer to free + */ void av_fifo_free(AVFifoBuffer *f); + +/** + * Returns the amount of data in bytes in the AVFifoBuffer, that is the + * amount of data you can read from it. + * @param *f AVFifoBuffer to read from + * @return size + */ int av_fifo_size(AVFifoBuffer *f); + +/** + * Reads data from an AVFifoBuffer. + * @param *f AVFifoBuffer to read from + * @param *buf data destination + * @param buf_size number of bytes to read + */ int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size); + +/** + * Feeds data from an AVFifoBuffer to a user supplied callback. + * @param *f AVFifoBuffer to read from + * @param buf_size number of bytes to read + * @param *func generic read function + * @param *dest data destination + */ int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest); + +/** + * Writes data into an AVFifoBuffer. + * @param *f AVFifoBuffer to write to + * @param *buf data source + * @param size data size + */ void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size); + +/** + * Resizes an AVFifoBuffer. + * @param *f AVFifoBuffer to resize + * @param size new AVFifoBuffer size in bytes + */ void av_fifo_realloc(AVFifoBuffer *f, unsigned int size); + +/** + * Reads and discards the specified amount of data from an AVFifoBuffer. + * @param *f AVFifoBuffer to read from + * @param size amount of data to read in bytes + */ void av_fifo_drain(AVFifoBuffer *f, int size); static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs) diff --git a/contrib/ffmpeg/libavutil/integer.c b/contrib/ffmpeg/libavutil/integer.c index 09cd756e2..3269a366a 100644 --- a/contrib/ffmpeg/libavutil/integer.c +++ b/contrib/ffmpeg/libavutil/integer.c @@ -49,10 +49,6 @@ AVInteger av_sub_i(AVInteger a, AVInteger b){ return a; } -/** - * returns the rounded down value of the logarithm of base 2 of the given AVInteger. - * this is simply the index of the most significant bit which is 1. Or 0 of all bits are 0 - */ int av_log2_i(AVInteger a){ int i; @@ -84,9 +80,6 @@ AVInteger av_mul_i(AVInteger a, AVInteger b){ return out; } -/** - * returns 0 if a==b, 1 if a>b and -1 if a<b. - */ int av_cmp_i(AVInteger a, AVInteger b){ int i; int v= (int16_t)a.v[AV_INTEGER_SIZE-1] - (int16_t)b.v[AV_INTEGER_SIZE-1]; @@ -99,10 +92,6 @@ int av_cmp_i(AVInteger a, AVInteger b){ return 0; } -/** - * bitwise shift. - * @param s the number of bits by which the value should be shifted right, may be negative for shifting left - */ AVInteger av_shr_i(AVInteger a, int s){ AVInteger out; int i; @@ -117,10 +106,6 @@ AVInteger av_shr_i(AVInteger a, int s){ return out; } -/** - * returns a % b. - * @param quot a/b will be stored here - */ AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b){ int i= av_log2_i(a) - av_log2_i(b); AVInteger quot_temp; @@ -145,18 +130,12 @@ AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b){ return a; } -/** - * returns a/b. - */ AVInteger av_div_i(AVInteger a, AVInteger b){ AVInteger quot; av_mod_i(", a, b); return quot; } -/** - * converts the given int64_t to an AVInteger. - */ AVInteger av_int2i(int64_t a){ AVInteger out; int i; @@ -168,11 +147,6 @@ AVInteger av_int2i(int64_t a){ return out; } -/** - * converts the given AVInteger to an int64_t. - * if the AVInteger is too large to fit into an int64_t, - * then only the least significant 64bit will be used - */ int64_t av_i2int(AVInteger a){ int i; int64_t out=(int8_t)a.v[AV_INTEGER_SIZE-1]; diff --git a/contrib/ffmpeg/libavutil/integer.h b/contrib/ffmpeg/libavutil/integer.h index a50ad9bae..2a4d70316 100644 --- a/contrib/ffmpeg/libavutil/integer.h +++ b/contrib/ffmpeg/libavutil/integer.h @@ -37,13 +37,46 @@ typedef struct AVInteger{ AVInteger av_add_i(AVInteger a, AVInteger b); AVInteger av_sub_i(AVInteger a, AVInteger b); + +/** + * returns the rounded down value of the logarithm of base 2 of the given AVInteger. + * this is simply the index of the most significant bit which is 1. Or 0 of all bits are 0 + */ int av_log2_i(AVInteger a); AVInteger av_mul_i(AVInteger a, AVInteger b); + +/** + * returns 0 if a==b, 1 if a>b and -1 if a<b. + */ int av_cmp_i(AVInteger a, AVInteger b); + +/** + * bitwise shift. + * @param s the number of bits by which the value should be shifted right, may be negative for shifting left + */ AVInteger av_shr_i(AVInteger a, int s); + +/** + * returns a % b. + * @param quot a/b will be stored here + */ AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b); + +/** + * returns a/b. + */ AVInteger av_div_i(AVInteger a, AVInteger b); + +/** + * converts the given int64_t to an AVInteger. + */ AVInteger av_int2i(int64_t a); + +/** + * converts the given AVInteger to an int64_t. + * if the AVInteger is too large to fit into an int64_t, + * then only the least significant 64bit will be used + */ int64_t av_i2int(AVInteger a); #endif // INTEGER_H diff --git a/contrib/ffmpeg/libavutil/internal.h b/contrib/ffmpeg/libavutil/internal.h index 4cb0d2a7e..eefbfa1e4 100644 --- a/contrib/ffmpeg/libavutil/internal.h +++ b/contrib/ffmpeg/libavutil/internal.h @@ -26,14 +26,71 @@ #ifndef INTERNAL_H #define INTERNAL_H -#if ( defined(__PIC__) || defined(__pic__) ) && ! defined(PIC) -# define PIC +#ifndef attribute_used +#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) +# define attribute_used __attribute__((used)) +#else +# define attribute_used +#endif +#endif + +#ifndef attribute_unused +#if defined(__GNUC__) +# define attribute_unused __attribute__((unused)) +#else +# define attribute_unused +#endif +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#ifndef INT16_MIN +#define INT16_MIN (-0x7fff-1) +#endif + +#ifndef INT16_MAX +#define INT16_MAX 0x7fff +#endif + +#ifndef INT32_MIN +#define INT32_MIN (-0x7fffffff-1) #endif -#ifndef ENODATA -# define ENODATA 61 +#ifndef INT32_MAX +#define INT32_MAX 0x7fffffff +#endif + +#ifndef UINT32_MAX +#define UINT32_MAX 0xffffffff +#endif + +#ifndef INT64_MIN +#define INT64_MIN (-0x7fffffffffffffffLL-1) +#endif + +#ifndef INT64_MAX +#define INT64_MAX INT64_C(9223372036854775807) +#endif + +#ifndef UINT64_MAX +#define UINT64_MAX UINT64_C(0xFFFFFFFFFFFFFFFF) +#endif + +#ifndef INT_BIT +# if INT_MAX != 2147483647 +# define INT_BIT 64 +# else +# define INT_BIT 32 +# endif +#endif + +#if ( defined(__PIC__) || defined(__pic__) ) && ! defined(PIC) +# define PIC #endif +#include "intreadwrite.h" #include "bswap.h" #include <stddef.h> @@ -93,9 +150,9 @@ /* dprintf macros */ #ifdef DEBUG -# define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__) +# define dprintf(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) #else -# define dprintf(fmt,...) +# define dprintf(pctx, ...) #endif #define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) @@ -132,7 +189,7 @@ extern const uint32_t ff_inverse[256]; # define FASTDIV(a,b) ((a)/(b)) #endif -extern FF_IMPORT_ATTR const uint8_t ff_sqrt_tab[128]; +extern const uint8_t ff_sqrt_tab[128]; static inline int ff_sqrt(int a) { @@ -194,6 +251,7 @@ if((y)<(x)){\ #define srand srand_is_forbidden_due_to_state_trashing #define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf #define strcat strcat_is_forbidden_due_to_security_issues_use_pstrcat +#define exit exit_is_forbidden #if !(defined(LIBAVFORMAT_BUILD) || defined(_FRAMEHOOK_H)) #define printf please_use_av_log #define fprintf please_use_av_log @@ -212,7 +270,7 @@ if((y)<(x)){\ /* 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) +static av_always_inline long int lrintf(float x) { #ifdef __MINGW32__ # ifdef ARCH_X86_32 diff --git a/contrib/ffmpeg/libavutil/intreadwrite.h b/contrib/ffmpeg/libavutil/intreadwrite.h new file mode 100644 index 000000000..7225f0b67 --- /dev/null +++ b/contrib/ffmpeg/libavutil/intreadwrite.h @@ -0,0 +1,99 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg 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, + * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef INTREADWRITE_H +#define INTREADWRITE_H + +#ifdef __GNUC__ + +struct unaligned_64 { uint64_t l; } __attribute__((packed)); +struct unaligned_32 { uint32_t l; } __attribute__((packed)); +struct unaligned_16 { uint16_t l; } __attribute__((packed)); + +#define LD16(a) (((const struct unaligned_16 *) (a))->l) +#define LD32(a) (((const struct unaligned_32 *) (a))->l) +#define LD64(a) (((const struct unaligned_64 *) (a))->l) + +#define ST16(a, b) (((struct unaligned_16 *) (a))->l) = (b) +#define ST32(a, b) (((struct unaligned_32 *) (a))->l) = (b) + +#else /* __GNUC__ */ + +#define LD16(a) (*((uint16_t*)(a))) +#define LD32(a) (*((uint32_t*)(a))) +#define LD64(a) (*((uint64_t*)(a))) + +#define ST16(a, b) *((uint16_t*)(a)) = (b) +#define ST32(a, b) *((uint32_t*)(a)) = (b) + +#endif /* !__GNUC__ */ + +/* endian macros */ +#define AV_RB8(x) (((uint8_t*)(x))[0]) +#define AV_WB8(p, d) { ((uint8_t*)(p))[0] = (d); } + +#define AV_RB16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) +#define AV_WB16(p, d) { \ + ((uint8_t*)(p))[1] = (d); \ + ((uint8_t*)(p))[0] = (d)>>8; } + +#define AV_RB24(x) ((((uint8_t*)(x))[0] << 16) | \ + (((uint8_t*)(x))[1] << 8) | \ + ((uint8_t*)(x))[2]) +#define AV_WB24(p, d) { \ + ((uint8_t*)(p))[2] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[0] = (d)>>16; } + +#define AV_RB32(x) ((((uint8_t*)(x))[0] << 24) | \ + (((uint8_t*)(x))[1] << 16) | \ + (((uint8_t*)(x))[2] << 8) | \ + ((uint8_t*)(x))[3]) +#define AV_WB32(p, d) { \ + ((uint8_t*)(p))[3] = (d); \ + ((uint8_t*)(p))[2] = (d)>>8; \ + ((uint8_t*)(p))[1] = (d)>>16; \ + ((uint8_t*)(p))[0] = (d)>>24; } + +#define AV_RL8(x) AV_RB8(x) +#define AV_WL8(p, d) AV_WB8(p, d) + +#define AV_RL16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) +#define AV_WL16(p, d) { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; } + +#define AV_RL24(x) ((((uint8_t*)(x))[2] << 16) | \ + (((uint8_t*)(x))[1] << 8) | \ + ((uint8_t*)(x))[0]) +#define AV_WL24(p, d) { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; } + +#define AV_RL32(x) ((((uint8_t*)(x))[3] << 24) | \ + (((uint8_t*)(x))[2] << 16) | \ + (((uint8_t*)(x))[1] << 8) | \ + ((uint8_t*)(x))[0]) +#define AV_WL32(p, d) { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; } + +#endif /* INTREADWRITE_H */ diff --git a/contrib/ffmpeg/libavutil/log.c b/contrib/ffmpeg/libavutil/log.c index 8b2dc6f6d..4fd503d0d 100644 --- a/contrib/ffmpeg/libavutil/log.c +++ b/contrib/ffmpeg/libavutil/log.c @@ -28,7 +28,7 @@ int av_log_level = AV_LOG_INFO; -static void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) +void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) { static int print_prefix=1; AVClass* avc= ptr ? *(AVClass**)ptr : NULL; diff --git a/contrib/ffmpeg/libavutil/log.h b/contrib/ffmpeg/libavutil/log.h index 0ff1f9fcf..fa88f5fb2 100644 --- a/contrib/ffmpeg/libavutil/log.h +++ b/contrib/ffmpeg/libavutil/log.h @@ -38,12 +38,65 @@ struct AVCLASS { /* av_log API */ +#if LIBAVUTIL_VERSION_INT < (50<<16) #define AV_LOG_QUIET -1 +#define AV_LOG_FATAL 0 #define AV_LOG_ERROR 0 +#define AV_LOG_WARNING 1 #define AV_LOG_INFO 1 +#define AV_LOG_VERBOSE 1 #define AV_LOG_DEBUG 2 +#else +#define AV_LOG_QUIET -8 + +/** + * something went really wrong and we will crash now + */ +#define AV_LOG_PANIC 0 + +/** + * something went wrong and recovery is not possible + * like no header in a format which depends on it or a combination + * of parameters which are not allowed + */ +#define AV_LOG_FATAL 8 + +/** + * something went wrong and cannot losslessly be recovered + * but not all future data is affected + */ +#define AV_LOG_ERROR 16 + +/** + * something somehow does not look correct / something which may or may not + * lead to some problems like use of -vstrict -2 + */ +#define AV_LOG_WARNING 24 + +#define AV_LOG_INFO 32 +#define AV_LOG_VERBOSE 40 + +/** + * stuff which is only useful for libav* developers + */ +#define AV_LOG_DEBUG 48 +#endif extern int av_log_level; +/** + * Send the specified message to the log if the level is less than or equal to + * the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different av_vlog callback + * function. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @see av_vlog + */ #ifdef __GNUC__ extern void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); #else @@ -55,6 +108,7 @@ extern void av_vlog(void*, int level, const char *fmt, va_list); extern int av_log_get_level(void); extern void av_log_set_level(int); extern void av_log_set_callback(void (*)(void*, int, const char*, va_list)); +extern void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); #else extern void (*av_vlog)(void*, int, const char*, va_list); #endif diff --git a/contrib/ffmpeg/libavutil/lzo.c b/contrib/ffmpeg/libavutil/lzo.c new file mode 100644 index 000000000..d3849a743 --- /dev/null +++ b/contrib/ffmpeg/libavutil/lzo.c @@ -0,0 +1,273 @@ +/* + * LZO 1x decompression + * Copyright (c) 2006 Reimar Doeffinger + * + * This file is part of FFmpeg. + * + * FFmpeg 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, + * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "common.h" +//! avoid e.g. MPlayers fast_memcpy, it slows things down here +#undef memcpy +#include <string.h> +#include "lzo.h" + +//! define if we may write up to 12 bytes beyond the output buffer +#define OUTBUF_PADDED 1 +//! define if we may read up to 8 bytes beyond the input buffer +#define INBUF_PADDED 1 +typedef struct LZOContext { + uint8_t *in, *in_end; + uint8_t *out_start, *out, *out_end; + int error; +} LZOContext; + +/** + * \brief read one byte from input buffer, avoiding overrun + * \return byte read + */ +static inline int get_byte(LZOContext *c) { + if (c->in < c->in_end) + return *c->in++; + c->error |= LZO_INPUT_DEPLETED; + return 1; +} + +#ifdef INBUF_PADDED +#define GETB(c) (*(c).in++) +#else +#define GETB(c) get_byte(&(c)) +#endif + +/** + * \brief decode a length value in the coding used by lzo + * \param x previous byte value + * \param mask bits used from x + * \return decoded length value + */ +static inline int get_len(LZOContext *c, int x, int mask) { + int cnt = x & mask; + if (!cnt) { + while (!(x = get_byte(c))) cnt += 255; + cnt += mask + x; + } + return cnt; +} + +//#define UNALIGNED_LOADSTORE +#define BUILTIN_MEMCPY +#ifdef UNALIGNED_LOADSTORE +#define COPY2(d, s) *(uint16_t *)(d) = *(uint16_t *)(s); +#define COPY4(d, s) *(uint32_t *)(d) = *(uint32_t *)(s); +#elif defined(BUILTIN_MEMCPY) +#define COPY2(d, s) memcpy(d, s, 2); +#define COPY4(d, s) memcpy(d, s, 4); +#else +#define COPY2(d, s) (d)[0] = (s)[0]; (d)[1] = (s)[1]; +#define COPY4(d, s) (d)[0] = (s)[0]; (d)[1] = (s)[1]; (d)[2] = (s)[2]; (d)[3] = (s)[3]; +#endif + +/** + * \brief copy bytes from input to output buffer with checking + * \param cnt number of bytes to copy, must be >= 0 + */ +static inline void copy(LZOContext *c, int cnt) { + register uint8_t *src = c->in; + register uint8_t *dst = c->out; + if (cnt > c->in_end - src) { + cnt = FFMAX(c->in_end - src, 0); + c->error |= LZO_INPUT_DEPLETED; + } + if (cnt > c->out_end - dst) { + cnt = FFMAX(c->out_end - dst, 0); + c->error |= LZO_OUTPUT_FULL; + } +#if defined(INBUF_PADDED) && defined(OUTBUF_PADDED) + COPY4(dst, src); + src += 4; + dst += 4; + cnt -= 4; + if (cnt > 0) +#endif + memcpy(dst, src, cnt); + c->in = src + cnt; + c->out = dst + cnt; +} + +/** + * \brief copy previously decoded bytes to current position + * \param back how many bytes back we start + * \param cnt number of bytes to copy, must be >= 0 + * + * cnt > back is valid, this will copy the bytes we just copied, + * thus creating a repeating pattern with a period length of back. + */ +static inline void copy_backptr(LZOContext *c, int back, int cnt) { + register uint8_t *src = &c->out[-back]; + register uint8_t *dst = c->out; + if (src < c->out_start || src > dst) { + c->error |= LZO_INVALID_BACKPTR; + return; + } + if (cnt > c->out_end - dst) { + cnt = FFMAX(c->out_end - dst, 0); + c->error |= LZO_OUTPUT_FULL; + } + if (back == 1) { + memset(dst, *src, cnt); + dst += cnt; + } else { +#ifdef OUTBUF_PADDED + COPY2(dst, src); + COPY2(dst + 2, src + 2); + src += 4; + dst += 4; + cnt -= 4; + if (cnt > 0) { + COPY2(dst, src); + COPY2(dst + 2, src + 2); + COPY2(dst + 4, src + 4); + COPY2(dst + 6, src + 6); + src += 8; + dst += 8; + cnt -= 8; + } +#endif + if (cnt > 0) { + int blocklen = back; + while (cnt > blocklen) { + memcpy(dst, src, blocklen); + dst += blocklen; + cnt -= blocklen; + blocklen <<= 1; + } + memcpy(dst, src, cnt); + } + dst += cnt; + } + c->out = dst; +} + +/** + * \brief decode LZO 1x compressed data + * \param out output buffer + * \param outlen size of output buffer, number of bytes left are returned here + * \param in input buffer + * \param inlen size of input buffer, number of bytes left are returned here + * \return 0 on success, otherwise error flags, see lzo.h + * + * make sure all buffers are appropriately padded, in must provide + * LZO_INPUT_PADDING, out must provide LZO_OUTPUT_PADDING additional bytes + */ +int lzo1x_decode(void *out, int *outlen, void *in, int *inlen) { + int state= 0; + int x; + LZOContext c; + c.in = in; + c.in_end = (uint8_t *)in + *inlen; + c.out = c.out_start = out; + c.out_end = (uint8_t *)out + * outlen; + c.error = 0; + x = GETB(c); + if (x > 17) { + copy(&c, x - 17); + x = GETB(c); + if (x < 16) c.error |= LZO_ERROR; + } + if (c.in > c.in_end) + c.error |= LZO_INPUT_DEPLETED; + while (!c.error) { + int cnt, back; + if (x > 15) { + if (x > 63) { + cnt = (x >> 5) - 1; + back = (GETB(c) << 3) + ((x >> 2) & 7) + 1; + } else if (x > 31) { + cnt = get_len(&c, x, 31); + x = GETB(c); + back = (GETB(c) << 6) + (x >> 2) + 1; + } else { + cnt = get_len(&c, x, 7); + back = (1 << 14) + ((x & 8) << 11); + x = GETB(c); + back += (GETB(c) << 6) + (x >> 2); + if (back == (1 << 14)) { + if (cnt != 1) + c.error |= LZO_ERROR; + break; + } + } + } else if(!state){ + cnt = get_len(&c, x, 15); + copy(&c, cnt + 3); + x = GETB(c); + if (x > 15) + continue; + cnt = 1; + back = (1 << 11) + (GETB(c) << 2) + (x >> 2) + 1; + } else { + cnt = 0; + back = (GETB(c) << 2) + (x >> 2) + 1; + } + copy_backptr(&c, back, cnt + 2); + state= + cnt = x & 3; + copy(&c, cnt); + x = GETB(c); + } + *inlen = c.in_end - c.in; + if (c.in > c.in_end) + *inlen = 0; + *outlen = c.out_end - c.out; + return c.error; +} + +#ifdef TEST +#include <stdio.h> +#include <lzo/lzo1x.h> +#include "log.h" +#define MAXSZ (10*1024*1024) +int main(int argc, char *argv[]) { + FILE *in = fopen(argv[1], "rb"); + uint8_t *orig = av_malloc(MAXSZ + 16); + uint8_t *comp = av_malloc(2*MAXSZ + 16); + uint8_t *decomp = av_malloc(MAXSZ + 16); + size_t s = fread(orig, 1, MAXSZ, in); + lzo_uint clen = 0; + long tmp[LZO1X_MEM_COMPRESS]; + int inlen, outlen; + int i; + av_log_level = AV_LOG_DEBUG; + lzo1x_999_compress(orig, s, comp, &clen, tmp); + for (i = 0; i < 300; i++) { +START_TIMER + inlen = clen; outlen = MAXSZ; +#ifdef LIBLZO + if (lzo1x_decompress_safe(comp, inlen, decomp, &outlen, NULL)) +#elif defined(LIBLZO_UNSAFE) + if (lzo1x_decompress(comp, inlen, decomp, &outlen, NULL)) +#else + if (lzo1x_decode(decomp, &outlen, comp, &inlen)) +#endif + av_log(NULL, AV_LOG_ERROR, "decompression error\n"); +STOP_TIMER("lzod") + } + if (memcmp(orig, decomp, s)) + av_log(NULL, AV_LOG_ERROR, "decompression incorrect\n"); + else + av_log(NULL, AV_LOG_ERROR, "decompression ok\n"); + return 0; +} +#endif diff --git a/contrib/ffmpeg/libavutil/lzo.h b/contrib/ffmpeg/libavutil/lzo.h new file mode 100644 index 000000000..5b3d98f40 --- /dev/null +++ b/contrib/ffmpeg/libavutil/lzo.h @@ -0,0 +1,35 @@ +/* + * LZO 1x decompression + * copyright (c) 2006 Reimar Doeffinger + * + * This file is part of FFmpeg. + * + * FFmpeg 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, + * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LZO_H +#define LZO_H + +#define LZO_INPUT_DEPLETED 1 +#define LZO_OUTPUT_FULL 2 +#define LZO_INVALID_BACKPTR 4 +#define LZO_ERROR 8 + +#define LZO_INPUT_PADDING 8 +#define LZO_OUTPUT_PADDING 12 + +int lzo1x_decode(void *out, int *outlen, void *in, int *inlen); + +#endif diff --git a/contrib/ffmpeg/libavutil/md5.c b/contrib/ffmpeg/libavutil/md5.c index d33ad1483..f71703124 100644 --- a/contrib/ffmpeg/libavutil/md5.c +++ b/contrib/ffmpeg/libavutil/md5.c @@ -35,10 +35,9 @@ #include "md5.h" typedef struct AVMD5{ + uint64_t len; uint8_t block[64]; uint32_t ABCD[4]; - uint64_t len; - int b_used; } AVMD5; const int av_md5_size= sizeof(AVMD5); @@ -50,7 +49,7 @@ static const uint8_t S[4][4] = { { 6, 10, 15, 21 } /* Round 4 */ }; -static const uint32_t T[64] = { +static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32) 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, /* Round 1 */ 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, @@ -76,11 +75,12 @@ static const uint32_t T[64] = { t = S[i>>4][i&3];\ a += T[i];\ \ - switch(i>>4){\ - case 0: a += (d ^ (b&(c^d))) + X[ i &15 ]; break;\ - case 1: a += (c ^ (d&(c^b))) + X[ (1+5*i)&15 ]; break;\ - case 2: a += (b^c^d) + X[ (5+3*i)&15 ]; break;\ - case 3: a += (c^(b|~d)) + X[ ( 7*i)&15 ]; break;\ + if(i<32){\ + if(i<16) a += (d ^ (b&(c^d))) + X[ i &15 ];\ + else a += (c ^ (d&(c^b))) + X[ (1+5*i)&15 ];\ + }else{\ + if(i<48) a += (b^c^d) + X[ (5+3*i)&15 ];\ + else a += (c^(b|~d)) + X[ ( 7*i)&15 ];\ }\ a = b + (( a << t ) | ( a >> (32 - t) )); @@ -117,7 +117,6 @@ CORE4(0) CORE4(16) CORE4(32) CORE4(48) void av_md5_init(AVMD5 *ctx){ ctx->len = 0; - ctx->b_used = 0; ctx->ABCD[0] = 0x10325476; ctx->ABCD[1] = 0x98badcfe; @@ -126,35 +125,29 @@ void av_md5_init(AVMD5 *ctx){ } void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len){ - int i; + int i, j; + j= ctx->len & 63; ctx->len += len; for( i = 0; i < len; i++ ){ - ctx->block[ ctx->b_used++ ] = src[i]; - if( 64 == ctx->b_used ){ + ctx->block[j++] = src[i]; + if( 64 == j ){ body(ctx->ABCD, (uint32_t*) ctx->block); - ctx->b_used = 0; + j = 0; } } } void av_md5_final(AVMD5 *ctx, uint8_t *dst){ int i; + uint64_t finalcount= le2me_64(ctx->len<<3); - ctx->block[ctx->b_used++] = 0x80; - - memset(&ctx->block[ctx->b_used], 0, 64 - ctx->b_used); - - if( 56 < ctx->b_used ){ - body( ctx->ABCD, (uint32_t*) ctx->block ); - memset(ctx->block, 0, 64); - } - - for(i=0; i<8; i++) - ctx->block[56+i] = (ctx->len << 3) >> (i<<3); + av_md5_update(ctx, "\200", 1); + while((ctx->len & 63)<56) + av_md5_update(ctx, "", 1); - body(ctx->ABCD, (uint32_t*) ctx->block); + av_md5_update(ctx, &finalcount, 8); for(i=0; i<4; i++) ((uint32_t*)dst)[i]= le2me_32(ctx->ABCD[3-i]); @@ -170,6 +163,7 @@ void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len){ #ifdef TEST #include <stdio.h> +#undef printf main(){ uint64_t md5val; int i; diff --git a/contrib/ffmpeg/libavutil/mem.c b/contrib/ffmpeg/libavutil/mem.c index f43fb5420..a91ac4a07 100644 --- a/contrib/ffmpeg/libavutil/mem.c +++ b/contrib/ffmpeg/libavutil/mem.c @@ -26,7 +26,7 @@ #include "common.h" -/* here we can use OS dependant allocation functions */ +/* here we can use OS dependent allocation functions */ #undef malloc #undef free #undef realloc @@ -39,11 +39,6 @@ memory allocator. You do not need to suppress this file because the linker will do it automatically */ -/** - * Memory allocation of size byte with alignment suitable for all - * memory accesses (including vectors if available on the - * CPU). av_malloc(0) must return a non NULL pointer. - */ void *av_malloc(unsigned int size) { void *ptr; @@ -96,11 +91,6 @@ void *av_malloc(unsigned int size) return ptr; } -/** - * av_realloc semantics (same as glibc): if ptr is NULL and size > 0, - * identical to malloc(size). If size is zero, it is identical to - * free(ptr) and NULL is returned. - */ void *av_realloc(void *ptr, unsigned int size) { #ifdef CONFIG_MEMALIGN_HACK @@ -121,11 +111,6 @@ void *av_realloc(void *ptr, unsigned int size) #endif } -/** - * Free memory which has been allocated with av_malloc(z)() or av_realloc(). - * NOTE: ptr = NULL is explicetly allowed - * Note2: it is recommended that you use av_freep() instead - */ void av_free(void *ptr) { /* XXX: this test should not be needed on most libcs */ @@ -137,10 +122,6 @@ void av_free(void *ptr) #endif } -/** - * Frees memory and sets the pointer to NULL. - * @param arg pointer to the pointer which should be freed - */ void av_freep(void *arg) { void **ptr= (void**)arg; diff --git a/contrib/ffmpeg/libavutil/mem.h b/contrib/ffmpeg/libavutil/mem.h new file mode 100644 index 000000000..4ebdad8f5 --- /dev/null +++ b/contrib/ffmpeg/libavutil/mem.h @@ -0,0 +1,65 @@ +/* + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg 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, + * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file mem.h + * Memory handling functions. + */ + +#ifndef AV_MEM_H +#define AV_MEM_H + +#ifdef __GNUC__ + #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n))) +#else + #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v +#endif + +/** + * Memory allocation of size byte with alignment suitable for all + * memory accesses (including vectors if available on the + * CPU). av_malloc(0) must return a non NULL pointer. + */ +void *av_malloc(unsigned int size); + +/** + * av_realloc semantics (same as glibc): if ptr is NULL and size > 0, + * identical to malloc(size). If size is zero, it is identical to + * free(ptr) and NULL is returned. + */ +void *av_realloc(void *ptr, unsigned int size); + +/** + * Free memory which has been allocated with av_malloc(z)() or av_realloc(). + * NOTE: ptr = NULL is explicetly allowed + * Note2: it is recommended that you use av_freep() instead + */ +void av_free(void *ptr); + +void *av_mallocz(unsigned int size); +char *av_strdup(const char *s); + +/** + * Frees memory and sets the pointer to NULL. + * @param ptr pointer to the pointer which should be freed + */ +void av_freep(void *ptr); + +#endif /* AV_MEM_H */ diff --git a/contrib/ffmpeg/libavutil/random.c b/contrib/ffmpeg/libavutil/random.c new file mode 100644 index 000000000..c3e71e699 --- /dev/null +++ b/contrib/ffmpeg/libavutil/random.c @@ -0,0 +1,104 @@ +/* + * Mersenne Twister Random Algorithm + * Copyright (c) 2006 Ryan Martell. + * Based on A C-program for MT19937, with initialization improved 2002/1/26. Coded by + * Takuji Nishimura and Makoto Matsumoto. + * + * This file is part of FFmpeg. + * + * FFmpeg 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, + * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +/** +see http://en.wikipedia.org/wiki/Mersenne_twister for an explanation of this algorithm. +*/ +#include <stdio.h> +#include "random.h" + +//#define DEBUG + +#ifdef DEBUG +#include "common.h" +#include "log.h" +#endif + + +/* Period parameters */ +#define M 397 +#define A 0x9908b0df /* constant vector a */ +#define UPPER_MASK 0x80000000 /* most significant w-r bits */ +#define LOWER_MASK 0x7fffffff /* least significant r bits */ + +/** initializes mt[AV_RANDOM_N] with a seed */ +void av_init_random(unsigned int seed, AVRandomState *state) +{ + int index; + + /* + This differs from the wikipedia article. Source is from the Makoto + Makoto Matsumoto and Takuji Nishimura code, with the following comment: + */ + /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ + /* In the previous versions, MSBs of the seed affect */ + /* only MSBs of the array mt[]. */ + state->mt[0] = seed & 0xffffffff; + for (index = 1; index < AV_RANDOM_N; index++) { + unsigned int prev= state->mt[index - 1]; + state->mt[index] = (1812433253UL * (prev ^ (prev>>30)) + index) & 0xffffffff; + } + state->index= index; // will cause it to generate untempered numbers the first iteration +} + +/** generate AV_RANDOM_N words at one time (which will then be tempered later) (av_random calls this; you shouldn't) */ +void av_random_generate_untempered_numbers(AVRandomState *state) +{ + int kk; + unsigned int y; + + for (kk = 0; kk < AV_RANDOM_N - M; kk++) { + y = (state->mt[kk] & UPPER_MASK) | (state->mt[kk + 1] & LOWER_MASK); + state->mt[kk] = state->mt[kk + M] ^ (y >> 1) ^ ((y&1)*A); + } + for (; kk < AV_RANDOM_N - 1; kk++) { + y = (state->mt[kk] & UPPER_MASK) | (state->mt[kk + 1] & LOWER_MASK); + state->mt[kk] = state->mt[kk + (M - AV_RANDOM_N)] ^ (y >> 1) ^ ((y&1)*A); + } + y = (state->mt[AV_RANDOM_N - 1] & UPPER_MASK) | (state->mt[0] & LOWER_MASK); + state->mt[AV_RANDOM_N - 1] = state->mt[M - 1] ^ (y >> 1) ^ ((y&1)*A); + state->index = 0; +} + +#ifdef DEBUG +void av_benchmark_random(void) +{ + int x=0; + int i, j; + AVRandomState state; + + av_init_random(0xdeadbeef, &state); + for (j = 0; j < 100; j++) { + START_TIMER; + x+= av_random(&state); + STOP_TIMER("first call to av_random"); + for (i = 1; i < AV_RANDOM_N; i++) { + START_TIMER; + x+= av_random(&state); + STOP_TIMER("AV_RANDOM_N calls of av_random"); + } + } + av_log(NULL, AV_LOG_ERROR, "final value:%X\n", x); +} +#endif diff --git a/contrib/ffmpeg/libavutil/random.h b/contrib/ffmpeg/libavutil/random.h new file mode 100644 index 000000000..d9d08a5de --- /dev/null +++ b/contrib/ffmpeg/libavutil/random.h @@ -0,0 +1,69 @@ +/* + * Mersenne Twister Random Algorithm + * Copyright (c) 2006 Ryan Martell. + * Based on A C-program for MT19937, with initialization improved 2002/1/26. Coded by + * Takuji Nishimura and Makoto Matsumoto. + * + * This file is part of FFmpeg. + * + * FFmpeg 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, + * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AV_RANDOM_H +#define AV_RANDOM_H + +#define AV_RANDOM_N 624 + +typedef struct { + unsigned int mt[AV_RANDOM_N]; ///< the array for the state vector + int index; ///< current untempered value we use as the base. +} AVRandomState; + + +void av_init_random(unsigned int seed, AVRandomState *state); ///< to be inlined, the struct must be visible, so it doesn't make sense to try and keep it opaque with malloc/free like calls +void av_random_generate_untempered_numbers(AVRandomState *state); ///< Regenerate the untempered numbers (must be done every 624 iterations, or it will loop) + +/** generates a random number on [0,0xffffffff]-interval */ +static inline unsigned int av_random(AVRandomState *state) +{ + unsigned int y; + + // regenerate the untempered numbers if we should... + if (state->index >= AV_RANDOM_N) + av_random_generate_untempered_numbers(state); + + // grab one... + y = state->mt[state->index++]; + + /* Now temper (Mersenne Twister coefficients) The coefficients for MT19937 are.. */ + y ^= (y >> 11); + y ^= (y << 7) & 0x9d2c5680; + y ^= (y << 15) & 0xefc60000; + y ^= (y >> 18); + + return y; +} + +/** return random in range [0-1] as double */ +static inline double av_random_real1(AVRandomState *state) +{ + /* divided by 2^32-1 */ + return av_random(state) * (1.0 / 4294967296.0); +} + +// only available if DEBUG is defined in the .c file +void av_benchmark_random(void); +#endif // AV_RANDOM_H + diff --git a/contrib/ffmpeg/libavutil/rational.c b/contrib/ffmpeg/libavutil/rational.c index 0e018c41b..ac0c9d371 100644 --- a/contrib/ffmpeg/libavutil/rational.c +++ b/contrib/ffmpeg/libavutil/rational.c @@ -38,8 +38,10 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max) int sign= (nom<0) ^ (den<0); int64_t gcd= ff_gcd(FFABS(nom), FFABS(den)); - nom = FFABS(nom)/gcd; - den = FFABS(den)/gcd; + if(gcd){ + nom = FFABS(nom)/gcd; + den = FFABS(den)/gcd; + } if(nom<=max && den<=max){ a1= (AVRational){nom, den}; den=0; @@ -65,7 +67,7 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max) nom= den; den= next_den; } - assert(ff_gcd(a1.num, a1.den) == 1); + assert(ff_gcd(a1.num, a1.den) <= 1U); *dst_nom = sign ? -a1.num : a1.num; *dst_den = a1.den; @@ -73,40 +75,24 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max) return den==0; } -/** - * returns b*c. - */ AVRational av_mul_q(AVRational b, AVRational c){ av_reduce(&b.num, &b.den, b.num * (int64_t)c.num, b.den * (int64_t)c.den, INT_MAX); return b; } -/** - * returns b/c. - */ AVRational av_div_q(AVRational b, AVRational c){ return av_mul_q(b, (AVRational){c.den, c.num}); } -/** - * returns b+c. - */ AVRational av_add_q(AVRational b, AVRational c){ av_reduce(&b.num, &b.den, b.num * (int64_t)c.den + c.num * (int64_t)b.den, b.den * (int64_t)c.den, INT_MAX); return b; } -/** - * returns b-c. - */ AVRational av_sub_q(AVRational b, AVRational c){ return av_add_q(b, (AVRational){-c.num, c.den}); } -/** - * Converts a double precission floating point number to a AVRational. - * @param max the maximum allowed numerator and denominator - */ AVRational av_d2q(double d, int max){ AVRational a; #define LOG2 0.69314718055994530941723212145817656807550013436025 diff --git a/contrib/ffmpeg/libavutil/rational.h b/contrib/ffmpeg/libavutil/rational.h index 43fc22114..63c0b150f 100644 --- a/contrib/ffmpeg/libavutil/rational.h +++ b/contrib/ffmpeg/libavutil/rational.h @@ -38,7 +38,10 @@ typedef struct AVRational{ } AVRational; /** - * returns 0 if a==b, 1 if a>b and -1 if a<b. + * Compare two rationals. + * @param a first rational + * @param b second rational + * @return 0 if a==b, 1 if a>b and -1 if a<b. */ static inline int av_cmp_q(AVRational a, AVRational b){ const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den; @@ -48,24 +51,64 @@ static inline int av_cmp_q(AVRational a, AVRational b){ } /** - * converts the given AVRational to a double. + * Rational to double conversion. + * @param a rational to convert + * @return (double) a */ static inline double av_q2d(AVRational a){ return a.num / (double) a.den; } /** - * reduce a fraction. - * this is usefull for framerate calculations + * Reduce a fraction. + * This is useful for framerate calculations. + * @param dst_nom destination numerator + * @param dst_den destination denominator + * @param nom source numerator + * @param den source denominator * @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); +/** + * Multiplies two rationals. + * @param b first rational. + * @param c second rational. + * @return b*c. + */ AVRational av_mul_q(AVRational b, AVRational c); + +/** + * Divides one rational by another. + * @param b first rational. + * @param c second rational. + * @return b/c. + */ AVRational av_div_q(AVRational b, AVRational c); + +/** + * Adds two rationals. + * @param b first rational. + * @param c second rational. + * @return b+c. + */ AVRational av_add_q(AVRational b, AVRational c); + +/** + * Subtracts one rational from another. + * @param b first rational. + * @param c second rational. + * returns b-c. + */ AVRational av_sub_q(AVRational b, AVRational c); + +/** + * Converts a double precision floating point number to a rational. + * @param d double to convert + * @param max the maximum allowed numerator and denominator + * @return (AVRational) d. + */ AVRational av_d2q(double d, int max); #endif // RATIONAL_H diff --git a/contrib/ffmpeg/libavutil/sha1.c b/contrib/ffmpeg/libavutil/sha1.c new file mode 100644 index 000000000..6c10791f4 --- /dev/null +++ b/contrib/ffmpeg/libavutil/sha1.c @@ -0,0 +1,160 @@ +// SHA-1 code Copyright 2007 Michael Nidermayer <michaelni@gmx.at> +// license LGPL +// based on public domain SHA-1 code by Steve Reid <steve@edmweb.com> + +#include "common.h" +#include "sha1.h" + +typedef struct AVSHA1 { + uint64_t count; + uint8_t buffer[64]; + uint32_t state[5]; +} AVSHA1; + +#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) + +/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ +#define blk0(i) (block[i] = be2me_32(((uint32_t*)buffer)[i])) +#define blk(i) (block[i] = rol(block[i-3]^block[i-8]^block[i-14]^block[i-16],1)) + +#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y) +blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y) +blk (i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R2(v,w,x,y,z,i) z+=( w^x ^y) +blk (i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); +#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk (i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); +#define R4(v,w,x,y,z,i) z+=( w^x ^y) +blk (i)+0xCA62C1D6+rol(v,5);w=rol(w,30); + +/* Hash a single 512-bit block. This is the core of the algorithm. */ + +static void transform(uint32_t state[5], uint8_t buffer[64]){ + uint32_t block[80]; + unsigned int i, a, b, c, d, e; + + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; +#ifdef CONFIG_SMALL + for(i=0; i<80; i++){ + int t; + if(i<16) t= be2me_32(((uint32_t*)buffer)[i]); + else t= rol(block[i-3]^block[i-8]^block[i-14]^block[i-16],1); + block[i]= t; + t+= e+rol(a,5); + if(i<40){ + if(i<20) t+= ((b&(c^d))^d) +0x5A827999; + else t+= ( b^c ^d) +0x6ED9EBA1; + }else{ + if(i<60) t+= (((b|c)&d)|(b&c))+0x8F1BBCDC; + else t+= ( b^c ^d) +0xCA62C1D6; + } + e= d; + d= c; + c= rol(b,30); + b= a; + a= t; + } +#else + for(i=0; i<15; i+=5){ + R0(a,b,c,d,e,0+i); R0(e,a,b,c,d,1+i); R0(d,e,a,b,c,2+i); R0(c,d,e,a,b,3+i); R0(b,c,d,e,a,4+i); + } + R0(a,b,c,d,e,15); R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); + for(i=20; i<40; i+=5){ + R2(a,b,c,d,e,0+i); R2(e,a,b,c,d,1+i); R2(d,e,a,b,c,2+i); R2(c,d,e,a,b,3+i); R2(b,c,d,e,a,4+i); + } + for(; i<60; i+=5){ + R3(a,b,c,d,e,0+i); R3(e,a,b,c,d,1+i); R3(d,e,a,b,c,2+i); R3(c,d,e,a,b,3+i); R3(b,c,d,e,a,4+i); + } + for(; i<80; i+=5){ + R4(a,b,c,d,e,0+i); R4(e,a,b,c,d,1+i); R4(d,e,a,b,c,2+i); R4(c,d,e,a,b,3+i); R4(b,c,d,e,a,4+i); + } +#endif + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; +} + +void av_sha1_init(AVSHA1* ctx){ + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xEFCDAB89; + ctx->state[2] = 0x98BADCFE; + ctx->state[3] = 0x10325476; + ctx->state[4] = 0xC3D2E1F0; + ctx->count = 0; +} + +void av_sha1_update(AVSHA1* ctx, uint8_t* data, unsigned int len){ + unsigned int i, j; + + j = ctx->count & 63; + ctx->count += len; +#ifdef CONFIG_SMALL + for( i = 0; i < len; i++ ){ + ctx->buffer[ j++ ] = data[i]; + if( 64 == j ){ + transform(ctx->state, ctx->buffer); + j = 0; + } + } +#else + if ((j + len) > 63) { + memcpy(&ctx->buffer[j], data, (i = 64-j)); + transform(ctx->state, ctx->buffer); + for ( ; i + 63 < len; i += 64) { + transform(ctx->state, &data[i]); + } + j=0; + } + else i = 0; + memcpy(&ctx->buffer[j], &data[i], len - i); +#endif +} + +void av_sha1_final(AVSHA1* ctx, uint8_t digest[20]){ + int i; + uint64_t finalcount= be2me_64(ctx->count<<3); + + av_sha1_update(ctx, "\200", 1); + while ((ctx->count & 63) != 56) { + av_sha1_update(ctx, "", 1); + } + av_sha1_update(ctx, &finalcount, 8); /* Should cause a transform() */ + for(i=0; i<5; i++) + ((uint32_t*)digest)[i]= be2me_32(ctx->state[i]); +} + +// use the following to test +// gcc -DTEST -DHAVE_AV_CONFIG_H -I.. sha1.c -O2 -W -Wall -o sha1 && time ./sha1 +#ifdef TEST +#include <stdio.h> +#undef printf + +int main(){ + int i, k; + AVSHA1 ctx; + unsigned char digest[20]; + + for(k=0; k<3; k++){ + av_sha1_init(&ctx); + if(k==0) + av_sha1_update(&ctx, "abc", 3); + else if(k==1) + av_sha1_update(&ctx, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56); + else + for(i=0; i<1000*1000; i++) + av_sha1_update(&ctx, "a", 1); + av_sha1_final(&ctx, digest); + for (i = 0; i < 20; i++) + printf("%02X", digest[i]); + putchar('\n'); + } + //Test Vectors (from FIPS PUB 180-1) + printf("A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D\n" + "84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1\n" + "34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F\n"); + + return 0; +} +#endif diff --git a/contrib/ffmpeg/libavutil/sha1.h b/contrib/ffmpeg/libavutil/sha1.h new file mode 100644 index 000000000..8739cbde9 --- /dev/null +++ b/contrib/ffmpeg/libavutil/sha1.h @@ -0,0 +1,11 @@ +#ifndef AV_SHA1_H +#define AV_SHA1_H + +extern const int av_sha1_size; + +struct AVSHA1; + +void av_sha1_init(struct AVSHA1* context); +void av_sha1_update(struct AVSHA1* context, uint8_t* data, unsigned int len); +void av_sha1_final(struct AVSHA1* context, uint8_t digest[20]); +#endif diff --git a/contrib/ffmpeg/libavutil/tree.h b/contrib/ffmpeg/libavutil/tree.h index 36897ef46..be1735858 100644 --- a/contrib/ffmpeg/libavutil/tree.h +++ b/contrib/ffmpeg/libavutil/tree.h @@ -18,6 +18,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/** + * @file tree.h + * A tree container. + * @author Michael Niedermayer <michaelni@gmx.at> + */ + #ifndef TREE_H #define TREE_H @@ -26,25 +32,25 @@ struct AVTreeNode; /** * Finds an element. * @param root a pointer to the root node of the tree - * @param next if next is not NULL then next[0] will contain the previous element and - * next[1] the next element if either doesnt exist then the corresponding - * entry in next is unchanged - * @return an element with cmp(key, elem)==0 or NULL if no such element exists in - * the tree + * @param next If next is not NULL then next[0] will contain the previous + * element and next[1] the next element if either does not exist + * then the corresponding entry in next is unchanged. + * @return An element with cmp(key, elem)==0 or NULL if no such element exists in + * the tree. */ void *av_tree_find(const struct AVTreeNode *root, void *key, int (*cmp)(void *key, const void *b), void *next[2]); /** * Finds a element for which cmp(key, elem)==0, if no such element is found key * is inserted into the tree. - * @param rootp a pointer to a pointer to the root node of the tree note the - * root node can change during insertions, this is required to - * keep the tree balanced + * @param rootp A pointer to a pointer to the root node of the tree. Note that + * the root node can change during insertions, this is required + * to keep the tree balanced. * - * @return if no insertion happened, the found element - * if a insertion happened, then either key or NULL is returned (which it is - * depends on the tree state and the implemenattion, you should make no - * asumtations that its one or the other in code) + * @return If no insertion happened, the found element. + * If an insertion happened, then either key or NULL will be returned. + * Which one it is depends on the tree state and the implementation. You + * should make no assumptions that it's one or the other in the code. */ void *av_tree_insert(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b)); void av_tree_destroy(struct AVTreeNode *t); diff --git a/contrib/ffmpeg/libavutil/x86_cpu.h b/contrib/ffmpeg/libavutil/x86_cpu.h index 3d54b2a60..67d4cd9aa 100644 --- a/contrib/ffmpeg/libavutil/x86_cpu.h +++ b/contrib/ffmpeg/libavutil/x86_cpu.h @@ -57,4 +57,8 @@ # define REGSP esp #endif +#if defined(ARCH_X86_64) || (defined(ARCH_X86_32) && defined(CONFIG_EBX_AVAILABLE) && defined(CONFIG_EBP_AVAILABLE)) +# define CONFIG_7REGS 1 +#endif + #endif /* AVUTIL_X86CPU_H */ |