Originally committed as revision 1567 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
@@ -28,18 +28,18 @@ typedef struct AC3EncodeContext { | |||||
int nb_all_channels; | int nb_all_channels; | ||||
int lfe_channel; | int lfe_channel; | ||||
int bit_rate; | int bit_rate; | ||||
int sample_rate; | |||||
int bsid; | |||||
int frame_size_min; /* minimum frame size in case rounding is necessary */ | |||||
int frame_size; /* current frame size in words */ | |||||
unsigned int sample_rate; | |||||
unsigned int bsid; | |||||
unsigned int frame_size_min; /* minimum frame size in case rounding is necessary */ | |||||
unsigned int frame_size; /* current frame size in words */ | |||||
int halfratecod; | int halfratecod; | ||||
int frmsizecod; | |||||
int fscod; /* frequency */ | |||||
int acmod; | |||||
unsigned int frmsizecod; | |||||
unsigned int fscod; /* frequency */ | |||||
unsigned int acmod; | |||||
int lfe; | int lfe; | ||||
int bsmod; | |||||
unsigned int bsmod; | |||||
short last_samples[AC3_MAX_CHANNELS][256]; | short last_samples[AC3_MAX_CHANNELS][256]; | ||||
int chbwcod[AC3_MAX_CHANNELS]; | |||||
unsigned int chbwcod[AC3_MAX_CHANNELS]; | |||||
int nb_coefs[AC3_MAX_CHANNELS]; | int nb_coefs[AC3_MAX_CHANNELS]; | ||||
/* bitrate allocation control */ | /* bitrate allocation control */ | ||||
@@ -586,7 +586,7 @@ static int encode_exp(UINT8 encoded_exp[N/2], | |||||
} | } | ||||
/* return the size in bits taken by the mantissa */ | /* return the size in bits taken by the mantissa */ | ||||
int compute_mantissa_size(AC3EncodeContext *s, UINT8 *m, int nb_coefs) | |||||
static int compute_mantissa_size(AC3EncodeContext *s, UINT8 *m, int nb_coefs) | |||||
{ | { | ||||
int bits, mant, i; | int bits, mant, i; | ||||
@@ -160,16 +160,16 @@ int check_marker(GetBitContext *s, const char *msg) | |||||
#define GET_DATA(v, table, i, wrap, size) \ | #define GET_DATA(v, table, i, wrap, size) \ | ||||
{\ | {\ | ||||
const UINT8 *ptr = (UINT8 *)table + i * wrap;\ | |||||
const UINT8 *ptr = (const UINT8 *)table + i * wrap;\ | |||||
switch(size) {\ | switch(size) {\ | ||||
case 1:\ | case 1:\ | ||||
v = *(UINT8 *)ptr;\ | |||||
v = *(const UINT8 *)ptr;\ | |||||
break;\ | break;\ | ||||
case 2:\ | case 2:\ | ||||
v = *(UINT16 *)ptr;\ | |||||
v = *(const UINT16 *)ptr;\ | |||||
break;\ | break;\ | ||||
default:\ | default:\ | ||||
v = *(UINT32 *)ptr;\ | |||||
v = *(const UINT32 *)ptr;\ | |||||
break;\ | break;\ | ||||
}\ | }\ | ||||
} | } | ||||
@@ -23,6 +23,9 @@ | |||||
* see http://joe.hotchkiss.com/programming/eval/eval.html | * see http://joe.hotchkiss.com/programming/eval/eval.html | ||||
*/ | */ | ||||
#include "avcodec.h" | |||||
#include "mpegvideo.h" | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
@@ -43,9 +46,9 @@ typedef struct Parser{ | |||||
int stack_index; | int stack_index; | ||||
char *s; | char *s; | ||||
double *const_value; | double *const_value; | ||||
char **const_name; // NULL terminated | |||||
const char **const_name; // NULL terminated | |||||
double (**func1)(void *, double a); // NULL terminated | double (**func1)(void *, double a); // NULL terminated | ||||
char **func1_name; // NULL terminated | |||||
const char **func1_name; // NULL terminated | |||||
double (**func2)(void *, double a, double b); // NULL terminated | double (**func2)(void *, double a, double b); // NULL terminated | ||||
char **func2_name; // NULL terminated | char **func2_name; // NULL terminated | ||||
void *opaque; | void *opaque; | ||||
@@ -71,7 +74,7 @@ static double pop(Parser *p){ | |||||
return p->stack[ --p->stack_index ]; | return p->stack[ --p->stack_index ]; | ||||
} | } | ||||
static int strmatch(char *s, char *prefix){ | |||||
static int strmatch(const char *s, const char *prefix){ | |||||
int i; | int i; | ||||
for(i=0; prefix[i]; i++){ | for(i=0; prefix[i]; i++){ | ||||
if(prefix[i] != s[i]) return 0; | if(prefix[i] != s[i]) return 0; | ||||
@@ -126,7 +129,7 @@ static void evalPrimary(Parser *p){ | |||||
else if( strmatch(next, "log" ) ) d= log(d); | else if( strmatch(next, "log" ) ) d= log(d); | ||||
else if( strmatch(next, "squish") ) d= 1/(1+exp(4*d)); | else if( strmatch(next, "squish") ) d= 1/(1+exp(4*d)); | ||||
else if( strmatch(next, "gauss" ) ) d= exp(-d*d/2)/sqrt(2*M_PI); | else if( strmatch(next, "gauss" ) ) d= exp(-d*d/2)/sqrt(2*M_PI); | ||||
else if( strmatch(next, "abs" ) ) d= abs(d); | |||||
else if( strmatch(next, "abs" ) ) d= fabs(d); | |||||
else if( strmatch(next, "max" ) ) d= d > d2 ? d : d2; | else if( strmatch(next, "max" ) ) d= d > d2 ? d : d2; | ||||
else if( strmatch(next, "min" ) ) d= d < d2 ? d : d2; | else if( strmatch(next, "min" ) ) d= d < d2 ? d : d2; | ||||
else if( strmatch(next, "gt" ) ) d= d > d2 ? 1.0 : 0.0; | else if( strmatch(next, "gt" ) ) d= d > d2 ? 1.0 : 0.0; | ||||
@@ -228,8 +231,8 @@ static void evalExpression(Parser *p){ | |||||
} | } | ||||
} | } | ||||
double ff_eval(char *s, double *const_value, char **const_name, | |||||
double (**func1)(void *, double), char **func1_name, | |||||
double ff_eval(char *s, double *const_value, const char **const_name, | |||||
double (**func1)(void *, double), const char **func1_name, | |||||
double (**func2)(void *, double, double), char **func2_name, | double (**func2)(void *, double, double), char **func2_name, | ||||
void *opaque){ | void *opaque){ | ||||
Parser p; | Parser p; | ||||
@@ -456,7 +456,7 @@ void mpeg4_encode_mb(MpegEncContext * s, | |||||
DCTELEM block[6][64], | DCTELEM block[6][64], | ||||
int motion_x, int motion_y) | int motion_x, int motion_y) | ||||
{ | { | ||||
int cbpc, cbpy, i, pred_x, pred_y; | |||||
int cbpc, cbpy, pred_x, pred_y; | |||||
int bits; | int bits; | ||||
PutBitContext * const pb2 = s->data_partitioning ? &s->pb2 : &s->pb; | PutBitContext * const pb2 = s->data_partitioning ? &s->pb2 : &s->pb; | ||||
PutBitContext * const tex_pb = s->data_partitioning && s->pict_type!=B_TYPE ? &s->tex_pb : &s->pb; | PutBitContext * const tex_pb = s->data_partitioning && s->pict_type!=B_TYPE ? &s->tex_pb : &s->pb; | ||||
@@ -467,7 +467,7 @@ void mpeg4_encode_mb(MpegEncContext * s, | |||||
// printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); | // printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); | ||||
if (!s->mb_intra) { | if (!s->mb_intra) { | ||||
/* compute cbp */ | /* compute cbp */ | ||||
int cbp = 0; | |||||
int i, cbp = 0; | |||||
for (i = 0; i < 6; i++) { | for (i = 0; i < 6; i++) { | ||||
if (s->block_last_index[i] >= 0) | if (s->block_last_index[i] >= 0) | ||||
cbp |= 1 << (5 - i); | cbp |= 1 << (5 - i); | ||||
@@ -728,7 +728,8 @@ void mpeg4_encode_mb(MpegEncContext * s, | |||||
int dc_diff[6]; //dc values with the dc prediction subtracted | int dc_diff[6]; //dc values with the dc prediction subtracted | ||||
int dir[6]; //prediction direction | int dir[6]; //prediction direction | ||||
int zigzag_last_index[6]; | int zigzag_last_index[6]; | ||||
UINT8 *scan_table[6]; | |||||
UINT8 *scan_table[6]; | |||||
int i; | |||||
for(i=0; i<6; i++){ | for(i=0; i<6; i++){ | ||||
const int level= block[i][0]; | const int level= block[i][0]; | ||||
@@ -1010,7 +1011,7 @@ static int h263_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr) | |||||
} | } | ||||
void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n) | |||||
static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n) | |||||
{ | { | ||||
int x, y, wrap, a, c, pred_dc, scale, i; | int x, y, wrap, a, c, pred_dc, scale, i; | ||||
INT16 *dc_val, *ac_val, *ac_val1; | INT16 *dc_val, *ac_val, *ac_val1; | ||||
@@ -4353,7 +4354,7 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){ | |||||
// FIXME a bunch of grayscale shape things | // FIXME a bunch of grayscale shape things | ||||
if((s->mpeg_quant=get_bits1(gb))){ /* vol_quant_type */ | if((s->mpeg_quant=get_bits1(gb))){ /* vol_quant_type */ | ||||
int i, j, v; | |||||
int i, v; | |||||
/* load default matrixes */ | /* load default matrixes */ | ||||
for(i=0; i<64; i++){ | for(i=0; i<64; i++){ | ||||
@@ -4370,7 +4371,8 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){ | |||||
/* load custom intra matrix */ | /* load custom intra matrix */ | ||||
if(get_bits1(gb)){ | if(get_bits1(gb)){ | ||||
int last=0; | int last=0; | ||||
for(i=0; i<64; i++){ | |||||
for(i=0; i<64; i++){ | |||||
int j; | |||||
v= get_bits(gb, 8); | v= get_bits(gb, 8); | ||||
if(v==0) break; | if(v==0) break; | ||||
@@ -4382,7 +4384,7 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){ | |||||
/* replicate last value */ | /* replicate last value */ | ||||
for(; i<64; i++){ | for(; i<64; i++){ | ||||
j= s->idct_permutation[ ff_zigzag_direct[i] ]; | |||||
int j= s->idct_permutation[ ff_zigzag_direct[i] ]; | |||||
s->intra_matrix[j]= v; | s->intra_matrix[j]= v; | ||||
s->chroma_intra_matrix[j]= v; | s->chroma_intra_matrix[j]= v; | ||||
} | } | ||||
@@ -4391,7 +4393,8 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){ | |||||
/* load custom non intra matrix */ | /* load custom non intra matrix */ | ||||
if(get_bits1(gb)){ | if(get_bits1(gb)){ | ||||
int last=0; | int last=0; | ||||
for(i=0; i<64; i++){ | |||||
for(i=0; i<64; i++){ | |||||
int j; | |||||
v= get_bits(gb, 8); | v= get_bits(gb, 8); | ||||
if(v==0) break; | if(v==0) break; | ||||
@@ -4403,7 +4406,7 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){ | |||||
/* replicate last value */ | /* replicate last value */ | ||||
for(; i<64; i++){ | for(; i<64; i++){ | ||||
j= s->idct_permutation[ ff_zigzag_direct[i] ]; | |||||
int j= s->idct_permutation[ ff_zigzag_direct[i] ]; | |||||
s->inter_matrix[j]= last; | s->inter_matrix[j]= last; | ||||
s->chroma_inter_matrix[j]= last; | s->chroma_inter_matrix[j]= last; | ||||
} | } | ||||
@@ -23,30 +23,7 @@ | |||||
int mm_flags; /* multimedia extension flags */ | int mm_flags; /* multimedia extension flags */ | ||||
/* FIXME use them in static form */ | /* FIXME use them in static form */ | ||||
int pix_abs16x16_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs16x16_x2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs16x16_y2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs16x16_xy2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs16x16_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs16x16_x2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs16x16_y2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs16x16_xy2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs8x8_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs8x8_x2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs8x8_y2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs8x8_xy2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs8x8_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs8x8_x2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs8x8_y2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int pix_abs8x8_xy2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int sad16x16_mmx(void *s, UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int sad8x8_mmx(void *s, UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int sad16x16_mmx2(void *s, UINT8 *blk1, UINT8 *blk2, int lx); | |||||
int sad8x8_mmx2(void *s, UINT8 *blk1, UINT8 *blk2, int lx); | |||||
void dsputil_init_pix_mmx(DSPContext* c, unsigned mask); | |||||
/* pixel operations */ | /* pixel operations */ | ||||
static const uint64_t mm_bone __attribute__ ((aligned(8))) = 0x0101010101010101ULL; | static const uint64_t mm_bone __attribute__ ((aligned(8))) = 0x0101010101010101ULL; | ||||
@@ -777,7 +754,7 @@ WARPER88_1616(hadamard8_diff_mmx, hadamard8_diff16_mmx) | |||||
OP(%%mm5, out, %%mm7, d) | OP(%%mm5, out, %%mm7, d) | ||||
#define QPEL_BASE(OPNAME, ROUNDER, RND, OP_MMX2, OP_3DNOW)\ | #define QPEL_BASE(OPNAME, ROUNDER, RND, OP_MMX2, OP_3DNOW)\ | ||||
void OPNAME ## mpeg4_qpel16_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ | |||||
static void OPNAME ## mpeg4_qpel16_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ | |||||
uint64_t temp;\ | uint64_t temp;\ | ||||
\ | \ | ||||
asm volatile(\ | asm volatile(\ | ||||
@@ -944,7 +921,7 @@ static void OPNAME ## mpeg4_qpel16_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, i | |||||
}\ | }\ | ||||
}\ | }\ | ||||
\ | \ | ||||
void OPNAME ## mpeg4_qpel8_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ | |||||
static void OPNAME ## mpeg4_qpel8_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ | |||||
uint64_t temp;\ | uint64_t temp;\ | ||||
\ | \ | ||||
asm volatile(\ | asm volatile(\ | ||||
@@ -1121,7 +1098,7 @@ static void OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, | |||||
);\ | );\ | ||||
}\ | }\ | ||||
\ | \ | ||||
void OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ | |||||
static void OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ | |||||
uint64_t temp[9*4];\ | uint64_t temp[9*4];\ | ||||
uint64_t *temp_ptr= temp;\ | uint64_t *temp_ptr= temp;\ | ||||
int count= 9;\ | int count= 9;\ | ||||
@@ -1460,15 +1437,6 @@ void dsputil_init_mmx(DSPContext* c, unsigned mask) | |||||
c->clear_blocks = clear_blocks_mmx; | c->clear_blocks = clear_blocks_mmx; | ||||
c->pix_sum = pix_sum16_mmx; | c->pix_sum = pix_sum16_mmx; | ||||
c->pix_abs16x16 = pix_abs16x16_mmx; | |||||
c->pix_abs16x16_x2 = pix_abs16x16_x2_mmx; | |||||
c->pix_abs16x16_y2 = pix_abs16x16_y2_mmx; | |||||
c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx; | |||||
c->pix_abs8x8 = pix_abs8x8_mmx; | |||||
c->pix_abs8x8_x2 = pix_abs8x8_x2_mmx; | |||||
c->pix_abs8x8_y2 = pix_abs8x8_y2_mmx; | |||||
c->pix_abs8x8_xy2 = pix_abs8x8_xy2_mmx; | |||||
c->put_pixels_tab[0][0] = put_pixels16_mmx; | c->put_pixels_tab[0][0] = put_pixels16_mmx; | ||||
c->put_pixels_tab[0][1] = put_pixels16_x2_mmx; | c->put_pixels_tab[0][1] = put_pixels16_x2_mmx; | ||||
c->put_pixels_tab[0][2] = put_pixels16_y2_mmx; | c->put_pixels_tab[0][2] = put_pixels16_y2_mmx; | ||||
@@ -1515,26 +1483,10 @@ void dsputil_init_mmx(DSPContext* c, unsigned mask) | |||||
c->hadamard8_diff[0]= hadamard8_diff16_mmx; | c->hadamard8_diff[0]= hadamard8_diff16_mmx; | ||||
c->hadamard8_diff[1]= hadamard8_diff_mmx; | c->hadamard8_diff[1]= hadamard8_diff_mmx; | ||||
c->sad[0]= sad16x16_mmx; | |||||
c->sad[1]= sad8x8_mmx; | |||||
c->pix_norm1 = pix_norm1_mmx; | c->pix_norm1 = pix_norm1_mmx; | ||||
c->sse[0] = sse16_mmx; | c->sse[0] = sse16_mmx; | ||||
if (mm_flags & MM_MMXEXT) { | if (mm_flags & MM_MMXEXT) { | ||||
c->pix_abs16x16 = pix_abs16x16_mmx2; | |||||
c->pix_abs16x16_x2 = pix_abs16x16_x2_mmx2; | |||||
c->pix_abs16x16_y2 = pix_abs16x16_y2_mmx2; | |||||
c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx2; | |||||
c->pix_abs8x8 = pix_abs8x8_mmx2; | |||||
c->pix_abs8x8_x2 = pix_abs8x8_x2_mmx2; | |||||
c->pix_abs8x8_y2 = pix_abs8x8_y2_mmx2; | |||||
c->pix_abs8x8_xy2 = pix_abs8x8_xy2_mmx2; | |||||
c->sad[0]= sad16x16_mmx2; | |||||
c->sad[1]= sad8x8_mmx2; | |||||
c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2; | c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2; | ||||
c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2; | c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2; | ||||
c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2; | c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2; | ||||
@@ -1644,7 +1596,7 @@ void dsputil_init_mmx(DSPContext* c, unsigned mask) | |||||
SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_3dnow) | SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_3dnow) | ||||
} | } | ||||
} | } | ||||
dsputil_init_pix_mmx(c, mask); | |||||
#if 0 | #if 0 | ||||
// for speed testing | // for speed testing | ||||
get_pixels = just_return; | get_pixels = just_return; | ||||
@@ -1694,14 +1646,6 @@ void dsputil_set_bit_exact_mmx(DSPContext* c, unsigned mask) | |||||
c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx; | c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx; | ||||
c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx; | c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx; | ||||
c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx; | c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx; | ||||
if (mm_flags & MM_MMXEXT) { | |||||
c->pix_abs16x16_x2 = pix_abs16x16_x2_mmx; | |||||
c->pix_abs16x16_y2 = pix_abs16x16_y2_mmx; | |||||
c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx; | |||||
c->pix_abs8x8_x2 = pix_abs8x8_x2_mmx; | |||||
c->pix_abs8x8_y2 = pix_abs8x8_y2_mmx; | |||||
c->pix_abs8x8_xy2= pix_abs8x8_xy2_mmx; | |||||
} | |||||
} | } | ||||
dsputil_set_bit_exact_pix_mmx(c, mask); | |||||
} | } |
@@ -20,6 +20,9 @@ | |||||
*/ | */ | ||||
#include "../dsputil.h" | #include "../dsputil.h" | ||||
void dsputil_init_pix_mmx(DSPContext* c, unsigned mask); | |||||
void dsputil_set_bit_exact_pix_mmx(DSPContext* c, unsigned mask); | |||||
static const __attribute__ ((aligned(8))) UINT64 round_tab[3]={ | static const __attribute__ ((aligned(8))) UINT64 round_tab[3]={ | ||||
0x0000000000000000, | 0x0000000000000000, | ||||
0x0001000100010001, | 0x0001000100010001, | ||||
@@ -118,7 +121,7 @@ static inline void sad8_4_mmx2(UINT8 *blk1, UINT8 *blk2, int stride, int h) | |||||
asm volatile( | asm volatile( | ||||
".balign 16 \n\t" | ".balign 16 \n\t" | ||||
"movq "MANGLE(bone)", %%mm5 \n\t" | "movq "MANGLE(bone)", %%mm5 \n\t" | ||||
"1: \n\t" | |||||
"1: \n\t" | |||||
"movq (%1, %%eax), %%mm0 \n\t" | "movq (%1, %%eax), %%mm0 \n\t" | ||||
"movq (%2, %%eax), %%mm2 \n\t" | "movq (%2, %%eax), %%mm2 \n\t" | ||||
"movq 1(%1, %%eax), %%mm1 \n\t" | "movq 1(%1, %%eax), %%mm1 \n\t" | ||||
@@ -165,7 +168,7 @@ static inline void sad8_2_mmx(UINT8 *blk1a, UINT8 *blk1b, UINT8 *blk2, int strid | |||||
"punpckhbw %%mm7, %%mm3 \n\t" | "punpckhbw %%mm7, %%mm3 \n\t" | ||||
"paddw %%mm0, %%mm1 \n\t" | "paddw %%mm0, %%mm1 \n\t" | ||||
"paddw %%mm2, %%mm3 \n\t" | "paddw %%mm2, %%mm3 \n\t" | ||||
"movq (%3, %%eax), %%mm4 \n\t" | |||||
"movq (%3, %%eax), %%mm4 \n\t" | |||||
"movq (%3, %%eax), %%mm2 \n\t" | "movq (%3, %%eax), %%mm2 \n\t" | ||||
"paddw %%mm5, %%mm1 \n\t" | "paddw %%mm5, %%mm1 \n\t" | ||||
"paddw %%mm5, %%mm3 \n\t" | "paddw %%mm5, %%mm3 \n\t" | ||||
@@ -215,8 +218,8 @@ static inline void sad8_4_mmx(UINT8 *blk1, UINT8 *blk2, int stride, int h) | |||||
"punpckhbw %%mm7, %%mm4 \n\t" | "punpckhbw %%mm7, %%mm4 \n\t" | ||||
"paddw %%mm3, %%mm2 \n\t" | "paddw %%mm3, %%mm2 \n\t" | ||||
"paddw %%mm4, %%mm1 \n\t" | "paddw %%mm4, %%mm1 \n\t" | ||||
"movq (%3, %%eax), %%mm3 \n\t" | |||||
"movq (%3, %%eax), %%mm4 \n\t" | |||||
"movq (%3, %%eax), %%mm3 \n\t" | |||||
"movq (%3, %%eax), %%mm4 \n\t" | |||||
"paddw %%mm5, %%mm2 \n\t" | "paddw %%mm5, %%mm2 \n\t" | ||||
"paddw %%mm5, %%mm1 \n\t" | "paddw %%mm5, %%mm1 \n\t" | ||||
"psrlw $2, %%mm2 \n\t" | "psrlw $2, %%mm2 \n\t" | ||||
@@ -237,7 +240,7 @@ static inline void sad8_4_mmx(UINT8 *blk1, UINT8 *blk2, int stride, int h) | |||||
); | ); | ||||
} | } | ||||
static inline int sum_mmx() | |||||
static inline int sum_mmx(void) | |||||
{ | { | ||||
int ret; | int ret; | ||||
asm volatile( | asm volatile( | ||||
@@ -253,7 +256,7 @@ static inline int sum_mmx() | |||||
return ret&0xFFFF; | return ret&0xFFFF; | ||||
} | } | ||||
static inline int sum_mmx2() | |||||
static inline int sum_mmx2(void) | |||||
{ | { | ||||
int ret; | int ret; | ||||
asm volatile( | asm volatile( | ||||
@@ -265,7 +268,7 @@ static inline int sum_mmx2() | |||||
#define PIX_SAD(suf)\ | #define PIX_SAD(suf)\ | ||||
int pix_abs8x8_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
static int pix_abs8x8_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
{\ | {\ | ||||
asm volatile("pxor %%mm7, %%mm7 \n\t"\ | asm volatile("pxor %%mm7, %%mm7 \n\t"\ | ||||
"pxor %%mm6, %%mm6 \n\t":);\ | "pxor %%mm6, %%mm6 \n\t":);\ | ||||
@@ -274,7 +277,7 @@ int pix_abs8x8_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
\ | \ | ||||
return sum_ ## suf();\ | return sum_ ## suf();\ | ||||
}\ | }\ | ||||
int sad8x8_ ## suf(void *s, UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
static int sad8x8_ ## suf(void *s, UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
{\ | {\ | ||||
asm volatile("pxor %%mm7, %%mm7 \n\t"\ | asm volatile("pxor %%mm7, %%mm7 \n\t"\ | ||||
"pxor %%mm6, %%mm6 \n\t":);\ | "pxor %%mm6, %%mm6 \n\t":);\ | ||||
@@ -284,7 +287,7 @@ int sad8x8_ ## suf(void *s, UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
return sum_ ## suf();\ | return sum_ ## suf();\ | ||||
}\ | }\ | ||||
\ | \ | ||||
int pix_abs8x8_x2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
static int pix_abs8x8_x2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
{\ | {\ | ||||
asm volatile("pxor %%mm7, %%mm7 \n\t"\ | asm volatile("pxor %%mm7, %%mm7 \n\t"\ | ||||
"pxor %%mm6, %%mm6 \n\t"\ | "pxor %%mm6, %%mm6 \n\t"\ | ||||
@@ -297,7 +300,7 @@ int pix_abs8x8_x2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
return sum_ ## suf();\ | return sum_ ## suf();\ | ||||
}\ | }\ | ||||
\ | \ | ||||
int pix_abs8x8_y2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
static int pix_abs8x8_y2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
{\ | {\ | ||||
asm volatile("pxor %%mm7, %%mm7 \n\t"\ | asm volatile("pxor %%mm7, %%mm7 \n\t"\ | ||||
"pxor %%mm6, %%mm6 \n\t"\ | "pxor %%mm6, %%mm6 \n\t"\ | ||||
@@ -310,7 +313,7 @@ int pix_abs8x8_y2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
return sum_ ## suf();\ | return sum_ ## suf();\ | ||||
}\ | }\ | ||||
\ | \ | ||||
int pix_abs8x8_xy2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
static int pix_abs8x8_xy2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
{\ | {\ | ||||
asm volatile("pxor %%mm7, %%mm7 \n\t"\ | asm volatile("pxor %%mm7, %%mm7 \n\t"\ | ||||
"pxor %%mm6, %%mm6 \n\t"\ | "pxor %%mm6, %%mm6 \n\t"\ | ||||
@@ -323,7 +326,7 @@ int pix_abs8x8_xy2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
return sum_ ## suf();\ | return sum_ ## suf();\ | ||||
}\ | }\ | ||||
\ | \ | ||||
int pix_abs16x16_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
static int pix_abs16x16_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
{\ | {\ | ||||
asm volatile("pxor %%mm7, %%mm7 \n\t"\ | asm volatile("pxor %%mm7, %%mm7 \n\t"\ | ||||
"pxor %%mm6, %%mm6 \n\t":);\ | "pxor %%mm6, %%mm6 \n\t":);\ | ||||
@@ -333,7 +336,7 @@ int pix_abs16x16_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
\ | \ | ||||
return sum_ ## suf();\ | return sum_ ## suf();\ | ||||
}\ | }\ | ||||
int sad16x16_ ## suf(void *s, UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
static int sad16x16_ ## suf(void *s, UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
{\ | {\ | ||||
asm volatile("pxor %%mm7, %%mm7 \n\t"\ | asm volatile("pxor %%mm7, %%mm7 \n\t"\ | ||||
"pxor %%mm6, %%mm6 \n\t":);\ | "pxor %%mm6, %%mm6 \n\t":);\ | ||||
@@ -343,7 +346,7 @@ int sad16x16_ ## suf(void *s, UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
\ | \ | ||||
return sum_ ## suf();\ | return sum_ ## suf();\ | ||||
}\ | }\ | ||||
int pix_abs16x16_x2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
static int pix_abs16x16_x2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
{\ | {\ | ||||
asm volatile("pxor %%mm7, %%mm7 \n\t"\ | asm volatile("pxor %%mm7, %%mm7 \n\t"\ | ||||
"pxor %%mm6, %%mm6 \n\t"\ | "pxor %%mm6, %%mm6 \n\t"\ | ||||
@@ -356,7 +359,7 @@ int pix_abs16x16_x2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
\ | \ | ||||
return sum_ ## suf();\ | return sum_ ## suf();\ | ||||
}\ | }\ | ||||
int pix_abs16x16_y2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
static int pix_abs16x16_y2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
{\ | {\ | ||||
asm volatile("pxor %%mm7, %%mm7 \n\t"\ | asm volatile("pxor %%mm7, %%mm7 \n\t"\ | ||||
"pxor %%mm6, %%mm6 \n\t"\ | "pxor %%mm6, %%mm6 \n\t"\ | ||||
@@ -369,7 +372,7 @@ int pix_abs16x16_y2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
\ | \ | ||||
return sum_ ## suf();\ | return sum_ ## suf();\ | ||||
}\ | }\ | ||||
int pix_abs16x16_xy2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
static int pix_abs16x16_xy2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
{\ | {\ | ||||
asm volatile("pxor %%mm7, %%mm7 \n\t"\ | asm volatile("pxor %%mm7, %%mm7 \n\t"\ | ||||
"pxor %%mm6, %%mm6 \n\t"\ | "pxor %%mm6, %%mm6 \n\t"\ | ||||
@@ -385,3 +388,45 @@ int pix_abs16x16_xy2_ ## suf(UINT8 *blk2, UINT8 *blk1, int stride)\ | |||||
PIX_SAD(mmx) | PIX_SAD(mmx) | ||||
PIX_SAD(mmx2) | PIX_SAD(mmx2) | ||||
void dsputil_init_pix_mmx(DSPContext* c, unsigned mask) | |||||
{ | |||||
if (mm_flags & MM_MMX) { | |||||
c->pix_abs16x16 = pix_abs16x16_mmx; | |||||
c->pix_abs16x16_x2 = pix_abs16x16_x2_mmx; | |||||
c->pix_abs16x16_y2 = pix_abs16x16_y2_mmx; | |||||
c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx; | |||||
c->pix_abs8x8 = pix_abs8x8_mmx; | |||||
c->pix_abs8x8_x2 = pix_abs8x8_x2_mmx; | |||||
c->pix_abs8x8_y2 = pix_abs8x8_y2_mmx; | |||||
c->pix_abs8x8_xy2 = pix_abs8x8_xy2_mmx; | |||||
c->sad[0]= sad16x16_mmx; | |||||
c->sad[1]= sad8x8_mmx; | |||||
} | |||||
if (mm_flags & MM_MMXEXT) { | |||||
c->pix_abs16x16 = pix_abs16x16_mmx2; | |||||
c->pix_abs16x16_x2 = pix_abs16x16_x2_mmx2; | |||||
c->pix_abs16x16_y2 = pix_abs16x16_y2_mmx2; | |||||
c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx2; | |||||
c->pix_abs8x8 = pix_abs8x8_mmx2; | |||||
c->pix_abs8x8_x2 = pix_abs8x8_x2_mmx2; | |||||
c->pix_abs8x8_y2 = pix_abs8x8_y2_mmx2; | |||||
c->pix_abs8x8_xy2 = pix_abs8x8_xy2_mmx2; | |||||
c->sad[0]= sad16x16_mmx2; | |||||
c->sad[1]= sad8x8_mmx2; | |||||
} | |||||
} | |||||
void dsputil_set_bit_exact_pix_mmx(DSPContext* c, unsigned mask) | |||||
{ | |||||
if (mm_flags & MM_MMXEXT) { | |||||
c->pix_abs16x16_x2 = pix_abs16x16_x2_mmx; | |||||
c->pix_abs16x16_y2 = pix_abs16x16_y2_mmx; | |||||
c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx; | |||||
c->pix_abs8x8_x2 = pix_abs8x8_x2_mmx; | |||||
c->pix_abs8x8_y2 = pix_abs8x8_y2_mmx; | |||||
c->pix_abs8x8_xy2 = pix_abs8x8_xy2_mmx; | |||||
} | |||||
} |
@@ -739,7 +739,7 @@ static inline unsigned int bitcopy_n(unsigned int a, int n) | |||||
#define RGB_IN(r, g, b, s)\ | #define RGB_IN(r, g, b, s)\ | ||||
{\ | {\ | ||||
unsigned int v = ((UINT16 *)(s))[0];\ | |||||
unsigned int v = ((const UINT16 *)(s))[0];\ | |||||
r = bitcopy_n(v >> (10 - 3), 3);\ | r = bitcopy_n(v >> (10 - 3), 3);\ | ||||
g = bitcopy_n(v >> (5 - 3), 3);\ | g = bitcopy_n(v >> (5 - 3), 3);\ | ||||
b = bitcopy_n(v << 3, 3);\ | b = bitcopy_n(v << 3, 3);\ | ||||
@@ -762,7 +762,7 @@ RGB_FUNCTIONS(rgb555) | |||||
#define RGB_IN(r, g, b, s)\ | #define RGB_IN(r, g, b, s)\ | ||||
{\ | {\ | ||||
unsigned int v = ((UINT16 *)(s))[0];\ | |||||
unsigned int v = ((const UINT16 *)(s))[0];\ | |||||
r = bitcopy_n(v >> (11 - 3), 3);\ | r = bitcopy_n(v >> (11 - 3), 3);\ | ||||
g = bitcopy_n(v >> (5 - 2), 2);\ | g = bitcopy_n(v >> (5 - 2), 2);\ | ||||
b = bitcopy_n(v << 3, 3);\ | b = bitcopy_n(v << 3, 3);\ | ||||
@@ -833,7 +833,7 @@ RGB_FUNCTIONS(rgb24) | |||||
#define RGB_IN(r, g, b, s)\ | #define RGB_IN(r, g, b, s)\ | ||||
{\ | {\ | ||||
unsigned int v = ((UINT32 *)(s))[0];\ | |||||
unsigned int v = ((const UINT32 *)(s))[0];\ | |||||
r = (v >> 16) & 0xff;\ | r = (v >> 16) & 0xff;\ | ||||
g = (v >> 8) & 0xff;\ | g = (v >> 8) & 0xff;\ | ||||
b = v & 0xff;\ | b = v & 0xff;\ | ||||
@@ -1229,7 +1229,7 @@ static ConvertEntry convert_table[PIX_FMT_NB][PIX_FMT_NB] = { | |||||
static int avpicture_alloc(AVPicture *picture, | static int avpicture_alloc(AVPicture *picture, | ||||
int pix_fmt, int width, int height) | int pix_fmt, int width, int height) | ||||
{ | { | ||||
int size; | |||||
unsigned int size; | |||||
void *ptr; | void *ptr; | ||||
size = avpicture_get_size(pix_fmt, width, height); | size = avpicture_get_size(pix_fmt, width, height); | ||||
@@ -22,7 +22,6 @@ | |||||
#ifdef USE_FASTMEMCPY | #ifdef USE_FASTMEMCPY | ||||
#include "fastmemcpy.h" | #include "fastmemcpy.h" | ||||
#endif | #endif | ||||
extern int mm_flags; | |||||
#define NB_COMPONENTS 3 | #define NB_COMPONENTS 3 | ||||
@@ -1262,11 +1262,11 @@ out: | |||||
static int mjpeg_decode_com(MJpegDecodeContext *s) | static int mjpeg_decode_com(MJpegDecodeContext *s) | ||||
{ | { | ||||
int len, i; | |||||
int i; | |||||
UINT8 *cbuf; | UINT8 *cbuf; | ||||
/* XXX: verify len field validity */ | /* XXX: verify len field validity */ | ||||
len = get_bits(&s->gb, 16)-2; | |||||
unsigned int len = get_bits(&s->gb, 16)-2; | |||||
cbuf = av_malloc(len+1); | cbuf = av_malloc(len+1); | ||||
for (i = 0; i < len; i++) | for (i = 0; i < len; i++) | ||||
@@ -61,8 +61,8 @@ typedef struct Minima{ | |||||
}Minima; | }Minima; | ||||
static int minima_cmp(const void *a, const void *b){ | static int minima_cmp(const void *a, const void *b){ | ||||
Minima *da = (Minima *) a; | |||||
Minima *db = (Minima *) b; | |||||
const Minima *da = (const Minima *) a; | |||||
const Minima *db = (const Minima *) b; | |||||
return da->height - db->height; | return da->height - db->height; | ||||
} | } | ||||
@@ -1193,7 +1193,7 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s, | |||||
return dmin; | return dmin; | ||||
} | } | ||||
int ff_estimate_motion_b(MpegEncContext * s, | |||||
static int ff_estimate_motion_b(MpegEncContext * s, | |||||
int mb_x, int mb_y, int16_t (*mv_table)[2], Picture *picture, int f_code) | int mb_x, int mb_y, int16_t (*mv_table)[2], Picture *picture, int f_code) | ||||
{ | { | ||||
int mx, my, range, dmin; | int mx, my, range, dmin; | ||||
@@ -54,7 +54,7 @@ typedef struct MpegAudioContext { | |||||
#include "mpegaudiotab.h" | #include "mpegaudiotab.h" | ||||
int MPA_encode_init(AVCodecContext *avctx) | |||||
static int MPA_encode_init(AVCodecContext *avctx) | |||||
{ | { | ||||
MpegAudioContext *s = avctx->priv_data; | MpegAudioContext *s = avctx->priv_data; | ||||
int freq = avctx->sample_rate; | int freq = avctx->sample_rate; | ||||
@@ -737,8 +737,8 @@ static void encode_frame(MpegAudioContext *s, | |||||
flush_put_bits(p); | flush_put_bits(p); | ||||
} | } | ||||
int MPA_encode_frame(AVCodecContext *avctx, | |||||
unsigned char *frame, int buf_size, void *data) | |||||
static int MPA_encode_frame(AVCodecContext *avctx, | |||||
unsigned char *frame, int buf_size, void *data) | |||||
{ | { | ||||
MpegAudioContext *s = avctx->priv_data; | MpegAudioContext *s = avctx->priv_data; | ||||
short *samples = data; | short *samples = data; | ||||
@@ -348,7 +348,8 @@ static int decode_init(AVCodecContext * avctx) | |||||
huff_code_table[0] = NULL; | huff_code_table[0] = NULL; | ||||
for(i=1;i<16;i++) { | for(i=1;i<16;i++) { | ||||
const HuffTable *h = &mpa_huff_tables[i]; | const HuffTable *h = &mpa_huff_tables[i]; | ||||
int xsize, n, x, y; | |||||
int xsize, x, y; | |||||
unsigned int n; | |||||
UINT8 *code_table; | UINT8 *code_table; | ||||
xsize = h->xsize; | xsize = h->xsize; | ||||
@@ -1448,7 +1449,7 @@ static int mp_decode_layer2(MPADecodeContext *s) | |||||
/* | /* | ||||
* Seek back in the stream for backstep bytes (at most 511 bytes) | * Seek back in the stream for backstep bytes (at most 511 bytes) | ||||
*/ | */ | ||||
static void seek_to_maindata(MPADecodeContext *s, long backstep) | |||||
static void seek_to_maindata(MPADecodeContext *s, unsigned int backstep) | |||||
{ | { | ||||
UINT8 *ptr; | UINT8 *ptr; | ||||
@@ -20,6 +20,8 @@ | |||||
#ifndef AVCODEC_MPEGVIDEO_H | #ifndef AVCODEC_MPEGVIDEO_H | ||||
#define AVCODEC_MPEGVIDEO_H | #define AVCODEC_MPEGVIDEO_H | ||||
#include "dsputil.h" | |||||
#define FRAME_SKIPED 100 // return value for header parsers if frame is not coded | #define FRAME_SKIPED 100 // return value for header parsers if frame is not coded | ||||
enum OutputFormat { | enum OutputFormat { | ||||
@@ -771,8 +773,8 @@ int ff_rate_control_init(MpegEncContext *s); | |||||
float ff_rate_estimate_qscale(MpegEncContext *s); | float ff_rate_estimate_qscale(MpegEncContext *s); | ||||
void ff_write_pass1_stats(MpegEncContext *s); | void ff_write_pass1_stats(MpegEncContext *s); | ||||
void ff_rate_control_uninit(MpegEncContext *s); | void ff_rate_control_uninit(MpegEncContext *s); | ||||
double ff_eval(char *s, double *const_value, char **const_name, | |||||
double (**func1)(void *, double), char **func1_name, | |||||
double ff_eval(char *s, double *const_value, const char **const_name, | |||||
double (**func1)(void *, double), const char **func1_name, | |||||
double (**func2)(void *, double, double), char **func2_name, | double (**func2)(void *, double, double), char **func2_name, | ||||
void *opaque); | void *opaque); | ||||
@@ -625,7 +625,7 @@ void msmpeg4_encode_mb(MpegEncContext * s, | |||||
} | } | ||||
/* old ffmpeg msmpeg4v3 mode */ | /* old ffmpeg msmpeg4v3 mode */ | ||||
void ff_old_msmpeg4_dc_scale(MpegEncContext * s) | |||||
static void ff_old_msmpeg4_dc_scale(MpegEncContext * s) | |||||
{ | { | ||||
if (s->qscale < 5){ | if (s->qscale < 5){ | ||||
s->y_dc_scale = 8; | s->y_dc_scale = 8; | ||||
@@ -250,7 +250,7 @@ static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_f | |||||
(rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / (double)rcc->frame_count[pict_type], | (rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / (double)rcc->frame_count[pict_type], | ||||
0 | 0 | ||||
}; | }; | ||||
char *const_names[]={ | |||||
static const char *const_names[]={ | |||||
"PI", | "PI", | ||||
"E", | "E", | ||||
"iTex", | "iTex", | ||||
@@ -282,7 +282,7 @@ static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_f | |||||
(void *)qp2bits, | (void *)qp2bits, | ||||
NULL | NULL | ||||
}; | }; | ||||
char *func1_names[]={ | |||||
static const char *func1_names[]={ | |||||
"bits2qp", | "bits2qp", | ||||
"qp2bits", | "qp2bits", | ||||
NULL | NULL | ||||
@@ -43,7 +43,7 @@ struct ReSampleContext { | |||||
static void init_mono_resample(ReSampleChannelContext *s, float ratio) | static void init_mono_resample(ReSampleChannelContext *s, float ratio) | ||||
{ | { | ||||
ratio = 1.0 / ratio; | ratio = 1.0 / ratio; | ||||
s->iratio = (int)floor(ratio); | |||||
s->iratio = (int)floorf(ratio); | |||||
if (s->iratio == 0) | if (s->iratio == 0) | ||||
s->iratio = 1; | s->iratio = 1; | ||||
s->incr = (int)((ratio / s->iratio) * FRAC); | s->incr = (int)((ratio / s->iratio) * FRAC); | ||||
@@ -46,7 +46,7 @@ char *av_strdup(const char *s) | |||||
/** | /** | ||||
* realloc which does nothing if the block is large enough | * realloc which does nothing if the block is large enough | ||||
*/ | */ | ||||
void *av_fast_realloc(void *ptr, int *size, int min_size) | |||||
void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) | |||||
{ | { | ||||
if(min_size < *size) | if(min_size < *size) | ||||
return ptr; | return ptr; | ||||
@@ -63,7 +63,7 @@ static char*** array_static = NULL; | |||||
static const unsigned int grow_static = 64; // ^2 | static const unsigned int grow_static = 64; // ^2 | ||||
void *__av_mallocz_static(void** location, unsigned int size) | void *__av_mallocz_static(void** location, unsigned int size) | ||||
{ | { | ||||
int l = (last_static + grow_static) & ~(grow_static - 1); | |||||
unsigned int l = (last_static + grow_static) & ~(grow_static - 1); | |||||
void *ptr = av_mallocz(size); | void *ptr = av_mallocz(size); | ||||
if (!ptr) | if (!ptr) | ||||
return NULL; | return NULL; | ||||
@@ -467,7 +467,7 @@ s->picture_number++; //FIXME ? | |||||
return 0; | return 0; | ||||
} | } | ||||
void ff_wmv2_decode_init(MpegEncContext *s){ | |||||
static void ff_wmv2_decode_init(MpegEncContext *s){ | |||||
} | } | ||||
static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr){ | static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr){ | ||||
@@ -68,7 +68,7 @@ struct AVFormatContext; | |||||
/* this structure contains the data a format has to probe a file */ | /* this structure contains the data a format has to probe a file */ | ||||
typedef struct AVProbeData { | typedef struct AVProbeData { | ||||
char *filename; | |||||
const char *filename; | |||||
unsigned char *buf; | unsigned char *buf; | ||||
int buf_size; | int buf_size; | ||||
} AVProbeData; | } AVProbeData; | ||||
@@ -17,6 +17,7 @@ | |||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||
*/ | */ | ||||
#include "avformat.h" | #include "avformat.h" | ||||
#include "avio.h" | |||||
#include <stdarg.h> | #include <stdarg.h> | ||||
#define IO_BUFFER_SIZE 32768 | #define IO_BUFFER_SIZE 32768 | ||||
@@ -381,19 +382,19 @@ UINT64 get_be64(ByteIOContext *s) | |||||
/* link with avio functions */ | /* link with avio functions */ | ||||
void url_write_packet(void *opaque, UINT8 *buf, int buf_size) | |||||
static void url_write_packet(void *opaque, UINT8 *buf, int buf_size) | |||||
{ | { | ||||
URLContext *h = opaque; | URLContext *h = opaque; | ||||
url_write(h, buf, buf_size); | url_write(h, buf, buf_size); | ||||
} | } | ||||
int url_read_packet(void *opaque, UINT8 *buf, int buf_size) | |||||
static int url_read_packet(void *opaque, UINT8 *buf, int buf_size) | |||||
{ | { | ||||
URLContext *h = opaque; | URLContext *h = opaque; | ||||
return url_read(h, buf, buf_size); | return url_read(h, buf, buf_size); | ||||
} | } | ||||
int url_seek_packet(void *opaque, INT64 offset, int whence) | |||||
static int url_seek_packet(void *opaque, INT64 offset, int whence) | |||||
{ | { | ||||
URLContext *h = opaque; | URLContext *h = opaque; | ||||
url_seek(h, offset, whence); | url_seek(h, offset, whence); | ||||
@@ -60,7 +60,7 @@ int stristart(const char *str, const char *val, const char **ptr) | |||||
p = str; | p = str; | ||||
q = val; | q = val; | ||||
while (*q != '\0') { | while (*q != '\0') { | ||||
if (toupper(*(unsigned char *)p) != toupper(*(unsigned char *)q)) | |||||
if (toupper(*(const unsigned char *)p) != toupper(*(const unsigned char *)q)) | |||||
return 0; | return 0; | ||||
p++; | p++; | ||||
q++; | q++; | ||||
@@ -103,7 +103,7 @@ void frame_hook_process(AVPicture *pict, enum PixelFormat pix_fmt, int width, in | |||||
} | } | ||||
} | } | ||||
void frame_hook_release() | |||||
void frame_hook_release(void) | |||||
{ | { | ||||
FrameHookEntry *fhe; | FrameHookEntry *fhe; | ||||
FrameHookEntry *fhenext; | FrameHookEntry *fhenext; | ||||
@@ -157,7 +157,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) | |||||
char filename[1024]; | char filename[1024]; | ||||
int ret; | int ret; | ||||
ByteIOContext f1, *f; | ByteIOContext f1, *f; | ||||
static INT64 first_frame; | |||||
static INT64 first_frame; // BUG -> to context FIXME | |||||
if (emulate_frame_rate) { | if (emulate_frame_rate) { | ||||
if (!first_frame) { | if (!first_frame) { | ||||
@@ -19,28 +19,26 @@ | |||||
#include "avformat.h" | #include "avformat.h" | ||||
/* simple formats */ | /* simple formats */ | ||||
int raw_write_header(struct AVFormatContext *s) | |||||
static int raw_write_header(struct AVFormatContext *s) | |||||
{ | { | ||||
return 0; | return 0; | ||||
} | } | ||||
int raw_write_packet(struct AVFormatContext *s, | |||||
int stream_index, | |||||
unsigned char *buf, int size, int force_pts) | |||||
static int raw_write_packet(struct AVFormatContext *s, int stream_index, | |||||
unsigned char *buf, int size, int force_pts) | |||||
{ | { | ||||
put_buffer(&s->pb, buf, size); | put_buffer(&s->pb, buf, size); | ||||
put_flush_packet(&s->pb); | put_flush_packet(&s->pb); | ||||
return 0; | return 0; | ||||
} | } | ||||
int raw_write_trailer(struct AVFormatContext *s) | |||||
static int raw_write_trailer(struct AVFormatContext *s) | |||||
{ | { | ||||
return 0; | return 0; | ||||
} | } | ||||
/* raw input */ | /* raw input */ | ||||
static int raw_read_header(AVFormatContext *s, | |||||
AVFormatParameters *ap) | |||||
static static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap) | |||||
{ | { | ||||
AVStream *st; | AVStream *st; | ||||
int id; | int id; | ||||
@@ -78,8 +76,7 @@ static int raw_read_header(AVFormatContext *s, | |||||
#define RAW_PACKET_SIZE 1024 | #define RAW_PACKET_SIZE 1024 | ||||
int raw_read_packet(AVFormatContext *s, | |||||
AVPacket *pkt) | |||||
static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) | |||||
{ | { | ||||
int ret, size; | int ret, size; | ||||
// AVStream *st = s->streams[0]; | // AVStream *st = s->streams[0]; | ||||
@@ -101,7 +98,7 @@ int raw_read_packet(AVFormatContext *s, | |||||
return ret; | return ret; | ||||
} | } | ||||
int raw_read_close(AVFormatContext *s) | |||||
static int raw_read_close(AVFormatContext *s) | |||||
{ | { | ||||
return 0; | return 0; | ||||
} | } | ||||
@@ -390,8 +387,7 @@ PCMDEF(mulaw, "pcm mu law format", | |||||
PCMDEF(alaw, "pcm A law format", | PCMDEF(alaw, "pcm A law format", | ||||
"al", CODEC_ID_PCM_ALAW) | "al", CODEC_ID_PCM_ALAW) | ||||
int rawvideo_read_packet(AVFormatContext *s, | |||||
AVPacket *pkt) | |||||
static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) | |||||
{ | { | ||||
int packet_size, ret, width, height; | int packet_size, ret, width, height; | ||||
AVStream *st = s->streams[0]; | AVStream *st = s->streams[0]; | ||||
@@ -71,7 +71,7 @@ int rtp_set_remote_url(URLContext *h, const char *uri) | |||||
/* add option to url of the form: | /* add option to url of the form: | ||||
"http://host:port/path?option1=val1&option2=val2... */ | "http://host:port/path?option1=val1&option2=val2... */ | ||||
void url_add_option(char *buf, int buf_size, const char *fmt, ...) | |||||
static void url_add_option(char *buf, int buf_size, const char *fmt, ...) | |||||
{ | { | ||||
char buf1[1024]; | char buf1[1024]; | ||||
va_list ap; | va_list ap; | ||||
@@ -86,9 +86,9 @@ void url_add_option(char *buf, int buf_size, const char *fmt, ...) | |||||
va_end(ap); | va_end(ap); | ||||
} | } | ||||
void build_udp_url(char *buf, int buf_size, | |||||
const char *hostname, int port, | |||||
int local_port, int multicast, int ttl) | |||||
static void build_udp_url(char *buf, int buf_size, | |||||
const char *hostname, int port, | |||||
int local_port, int multicast, int ttl) | |||||
{ | { | ||||
snprintf(buf, buf_size, "udp://%s:%d", hostname, port); | snprintf(buf, buf_size, "udp://%s:%d", hostname, port); | ||||
if (local_port >= 0) | if (local_port >= 0) | ||||
@@ -345,7 +345,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, | |||||
} | } | ||||
} | } | ||||
int sdp_parse(AVFormatContext *s, const char *content) | |||||
static int sdp_parse(AVFormatContext *s, const char *content) | |||||
{ | { | ||||
const char *p; | const char *p; | ||||
int letter; | int letter; | ||||
@@ -1376,7 +1376,7 @@ int av_read_image(ByteIOContext *pb, const char *filename, | |||||
int ret; | int ret; | ||||
if (!fmt) { | if (!fmt) { | ||||
pd->filename = (char *)filename; | |||||
pd->filename = filename; | |||||
pd->buf = buf; | pd->buf = buf; | ||||
pos = url_ftell(pb); | pos = url_ftell(pb); | ||||
pd->buf_size = get_buffer(pb, buf, PROBE_BUF_SIZE); | pd->buf_size = get_buffer(pb, buf, PROBE_BUF_SIZE); | ||||