[FFmpeg-devel] Various small fixes
Michael Niedermayer
michaelni
Sat Dec 13 21:47:35 CET 2008
On Sat, Dec 13, 2008 at 05:20:21PM +0100, Anders Gr?nberg wrote:
> On Sat, Dec 13, 2008 at 3:52 PM, M?ns Rullg?rd <mans at mansr.com> wrote:
> > "Anders Gr?nberg" <galileo.m2 at gmail.com> writes:
[...]
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c (revision 16102)
> +++ ffmpeg.c (working copy)
> @@ -87,7 +87,7 @@
> int in_file;
> } AVMetaDataMap;
>
> -static const OptionDef options[];
> +const OptionDef options[];
>
> #define MAX_FILES 20
>
> Index: ffserver.c
> ===================================================================
> --- ffserver.c (revision 16102)
> +++ ffserver.c (working copy)
> @@ -60,7 +60,7 @@
> const char program_name[] = "FFserver";
> const int program_birth_year = 2000;
>
> -static const OptionDef options[];
> +const OptionDef options[];
>
> enum HTTPState {
> HTTPSTATE_WAIT_REQUEST,
whatever your argument for these changes, i am against them. If these really
break the C standard, another solution has to be found or if its not an issue
with any real compiler they could as well be left as they are
[...]
> Index: libavcodec/dsputil.c
> ===================================================================
> --- libavcodec/dsputil.c (revision 16102)
> +++ libavcodec/dsputil.c (working copy)
> @@ -3458,7 +3458,7 @@
> static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
> long i;
> #ifndef HAVE_FAST_UNALIGNED
> - if((long)src2 & (sizeof(long)-1)){
> + if((intptr_t)src2 & (sizeof(src2)-1)){
> for(i=0; i+7<w; i+=8){
> dst[i+0] = src1[i+0]-src2[i+0];
> dst[i+1] = src1[i+1]-src2[i+1];
> @@ -4186,7 +4186,7 @@
> static int did_fail=0;
> DECLARE_ALIGNED_16(int, aligned);
>
> - if((long)&aligned & 15){
> + if((intptr_t)&aligned & 15){
> if(!did_fail){
> #if defined(HAVE_MMX) || defined(HAVE_ALTIVEC)
> av_log(NULL, AV_LOG_ERROR,
as mans has already said, intptr_t is optional, long is not, both are
correct so this is making things worse.
> Index: libavcodec/dsputil.h
> ===================================================================
> --- libavcodec/dsputil.h (revision 16102)
> +++ libavcodec/dsputil.h (working copy)
> @@ -712,11 +712,11 @@
> * @param n size of half window
> */
> void ff_sine_window_init(float *window, int n);
> -extern float ff_sine_128 [ 128];
> -extern float ff_sine_256 [ 256];
> -extern float ff_sine_512 [ 512];
> -extern float ff_sine_1024[1024];
> -extern float ff_sine_2048[2048];
> +DECLARE_ALIGNED(16, extern float, ff_sine_128 [ 128]);
> +DECLARE_ALIGNED(16, extern float, ff_sine_256 [ 256]);
> +DECLARE_ALIGNED(16, extern float, ff_sine_512 [ 512]);
> +DECLARE_ALIGNED(16, extern float, ff_sine_1024[1024]);
> +DECLARE_ALIGNED(16, extern float, ff_sine_2048[2048]);
> extern float *ff_sine_windows[5];
>
> int ff_mdct_init(MDCTContext *s, int nbits, int inverse);
does this make any difference in the generated object file from any compiler?
> Index: libavcodec/eval.c
> ===================================================================
> --- libavcodec/eval.c (revision 16102)
> +++ libavcodec/eval.c (working copy)
> @@ -47,12 +47,12 @@
> typedef struct Parser{
> int stack_index;
> char *s;
> - double *const_value;
> - const char **const_name; // NULL terminated
> + const double *const_value;
> + const char * const *const_name; // NULL terminated
> double (**func1)(void *, double a); // NULL terminated
> const char **func1_name; // NULL terminated
> double (**func2)(void *, double a, double b); // NULL terminated
> - char **func2_name; // NULL terminated
> + const char **func2_name; // NULL terminated
> void *opaque;
> const char **error;
> #define VARS 10
> @@ -375,9 +375,9 @@
> }
> }
>
> -AVEvalExpr * ff_parse(const char *s, const char **const_name,
> +AVEvalExpr * ff_parse(const char *s, const char * const *const_name,
> double (**func1)(void *, double), const char **func1_name,
> - double (**func2)(void *, double, double), char **func2_name,
> + double (**func2)(void *, double, double), const char **func2_name,
> const char **error){
> Parser p;
> AVEvalExpr * e;
> @@ -404,7 +404,7 @@
> return e;
> }
>
> -double ff_parse_eval(AVEvalExpr * e, double *const_value, void *opaque) {
> +double ff_parse_eval(AVEvalExpr * e, const double *const_value, void *opaque) {
> Parser p;
>
> p.const_value= const_value;
> @@ -412,9 +412,9 @@
> return eval_expr(&p, e);
> }
>
> -double ff_eval2(const char *s, double *const_value, const char **const_name,
> +double ff_eval2(const char *s, const double *const_value, const char * const *const_name,
> double (**func1)(void *, double), const char **func1_name,
> - double (**func2)(void *, double, double), char **func2_name,
> + double (**func2)(void *, double, double), const char **func2_name,
> void *opaque, const char **error){
> AVEvalExpr * e = ff_parse(s, const_name, func1, func1_name, func2, func2_name, error);
> double d;
> Index: libavcodec/eval.h
> ===================================================================
> --- libavcodec/eval.h (revision 16102)
> +++ libavcodec/eval.h (working copy)
> @@ -42,9 +42,9 @@
> * @param opaque a pointer which will be passed to all functions from func1 and func2
> * @return the value of the expression
> */
> -double ff_eval2(const char *s, double *const_value, const char **const_name,
> +double ff_eval2(const char *s, const double *const_value, const char * const *const_name,
> double (**func1)(void *, double), const char **func1_name,
> - double (**func2)(void *, double, double), char **func2_name,
> + double (**func2)(void *, double, double), const char **func2_name,
> void *opaque, const char **error);
>
> typedef struct ff_expr_s AVEvalExpr;
> @@ -61,9 +61,9 @@
> * @return AVEvalExpr which must be freed with ff_eval_free by the user when it is not needed anymore
> * NULL if anything went wrong
> */
> -AVEvalExpr * ff_parse(const char *s, const char **const_name,
> +AVEvalExpr * ff_parse(const char *s, const char * const *const_name,
> double (**func1)(void *, double), const char **func1_name,
> - double (**func2)(void *, double, double), char **func2_name,
> + double (**func2)(void *, double, double), const char **func2_name,
> const char **error);
> /**
> * Evaluates a previously parsed expression.
> @@ -71,7 +71,7 @@
> * @param opaque a pointer which will be passed to all functions from func1 and func2
> * @return the value of the expression
> */
> -double ff_parse_eval(AVEvalExpr * e, double *const_value, void *opaque);
> +double ff_parse_eval(AVEvalExpr * e, const double *const_value, void *opaque);
> void ff_eval_free(AVEvalExpr * e);
>
> #endif /* AVCODEC_EVAL_H */
> Index: libavcodec/h264.c
> ===================================================================
> --- libavcodec/h264.c (revision 16102)
> +++ libavcodec/h264.c (working copy)
> @@ -106,7 +106,7 @@
> const int mb_xy= h->mb_xy;
> int topleft_xy, top_xy, topright_xy, left_xy[2];
> int topleft_type, top_type, topright_type, left_type[2];
> - int * left_block;
> + const int * left_block;
> int topleft_partition= -1;
> int i;
>
this is probably ok
> Index: libavcodec/imgconvert.c
> ===================================================================
> --- libavcodec/imgconvert.c (revision 16102)
> +++ libavcodec/imgconvert.c (working copy)
> @@ -783,7 +783,7 @@
> dst_pix_fmt = -1;
> min_dist = 0x7fffffff;
> for(i = 0;i < PIX_FMT_NB; i++) {
> - if (pix_fmt_mask & (1 << i)) {
> + if (pix_fmt_mask & (1ULL << i)) {
> loss = avcodec_get_pix_fmt_loss(i, src_pix_fmt, has_alpha) & loss_mask;
> if (loss == 0) {
> dist = avg_bits_per_pixel(i);
ok
> Index: libavutil/common.h
> ===================================================================
> --- libavutil/common.h (revision 16102)
> +++ libavutil/common.h (working copy)
> @@ -108,7 +108,7 @@
> /* assume b>0 */
> #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
> #define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
> -#define FFSIGN(a) ((a) > 0 ? 1 : -1)
> +#define FFSIGN(a) ((a) >= 0 ? 1 : -1)
>
> #define FFMAX(a,b) ((a) > (b) ? (a) : (b))
> #define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
as all uses of FFSIGN check for 0 first, the 0 case can be factorized into
FFSIGN
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081213/12711f03/attachment.pgp>
More information about the ffmpeg-devel
mailing list