summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2008-11-06 20:41:40 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2008-11-06 20:41:40 +0200
commite46ce9c0ac88cdc3b4604c249576cfde0c5c4946 (patch)
tree6553efdc461e8d81ae2c9a7508b2dec5f116905a /libmpcodecs
parente51225dc3135e69d3f0fe6a5502c0c0e77952056 (diff)
parent14eb21fce00bfcab5145140f22bfd706d991c101 (diff)
downloadmpv-e46ce9c0ac88cdc3b4604c249576cfde0c5c4946.tar.bz2
mpv-e46ce9c0ac88cdc3b4604c249576cfde0c5c4946.tar.xz
Merge svn changes up to r27899
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ae_twolame.c6
-rw-r--r--libmpcodecs/vf_yadif.c36
2 files changed, 18 insertions, 24 deletions
diff --git a/libmpcodecs/ae_twolame.c b/libmpcodecs/ae_twolame.c
index 34b5e3123e..cb0330e18c 100644
--- a/libmpcodecs/ae_twolame.c
+++ b/libmpcodecs/ae_twolame.c
@@ -39,7 +39,7 @@ m_option_t twolameopts_conf[] = {
static int bind_twolame(audio_encoder_t *encoder, muxer_stream_t *mux_a)
{
- mpae_twolame_ctx *ctx = (mpae_twolame_ctx *) encoder->priv;
+ mpae_twolame_ctx *ctx = encoder->priv;
mux_a->wf = malloc(sizeof(WAVEFORMATEX)+256);
mux_a->wf->wFormatTag = 0x50;
@@ -83,7 +83,7 @@ static int bind_twolame(audio_encoder_t *encoder, muxer_stream_t *mux_a)
static int encode_twolame(audio_encoder_t *encoder, uint8_t *dest, void *src, int len, int max_size)
{
- mpae_twolame_ctx *ctx = (mpae_twolame_ctx *)encoder->priv;
+ mpae_twolame_ctx *ctx = encoder->priv;
int ret_size = 0, r2;
len /= (2*encoder->params.channels);
@@ -139,7 +139,7 @@ int mpae_init_twolame(audio_encoder_t *encoder)
else
mp_msg(MSGT_MENCODER, MSGL_ERR, "ae_twolame, Twolame can't encode > 2 channels, exiting\n");
- ctx = (mpae_twolame_ctx *) calloc(1, sizeof(mpae_twolame_ctx));
+ ctx = calloc(1, sizeof(mpae_twolame_ctx));
if(ctx == NULL)
{
mp_msg(MSGT_MENCODER, MSGL_ERR, "ae_twolame, couldn't alloc a %d bytes context, exiting\n", sizeof(mpae_twolame_ctx));
diff --git a/libmpcodecs/vf_yadif.c b/libmpcodecs/vf_yadif.c
index b4dbaa25c0..fd46f241cd 100644
--- a/libmpcodecs/vf_yadif.c
+++ b/libmpcodecs/vf_yadif.c
@@ -38,13 +38,7 @@
#include "mp_image.h"
#include "vf.h"
#include "libvo/fastmemcpy.h"
-
-#define MIN(a,b) ((a) > (b) ? (b) : (a))
-#define MAX(a,b) ((a) < (b) ? (b) : (a))
-#define ABS(a) ((a) > 0 ? (a) : (-(a)))
-
-#define MIN3(a,b,c) MIN(MIN(a,b),c)
-#define MAX3(a,b,c) MAX(MAX(a,b),c)
+#include "libavutil/common.h"
//===========================================================================//
@@ -298,18 +292,18 @@ static void filter_line_c(struct vf_priv_s *p, uint8_t *dst, uint8_t *prev, uint
int c= cur[-refs];
int d= (prev2[0] + next2[0])>>1;
int e= cur[+refs];
- int temporal_diff0= ABS(prev2[0] - next2[0]);
- int temporal_diff1=( ABS(prev[-refs] - c) + ABS(prev[+refs] - e) )>>1;
- int temporal_diff2=( ABS(next[-refs] - c) + ABS(next[+refs] - e) )>>1;
- int diff= MAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2);
+ int temporal_diff0= FFABS(prev2[0] - next2[0]);
+ int temporal_diff1=( FFABS(prev[-refs] - c) + FFABS(prev[+refs] - e) )>>1;
+ int temporal_diff2=( FFABS(next[-refs] - c) + FFABS(next[+refs] - e) )>>1;
+ int diff= FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2);
int spatial_pred= (c+e)>>1;
- int spatial_score= ABS(cur[-refs-1] - cur[+refs-1]) + ABS(c-e)
- + ABS(cur[-refs+1] - cur[+refs+1]) - 1;
+ int spatial_score= FFABS(cur[-refs-1] - cur[+refs-1]) + FFABS(c-e)
+ + FFABS(cur[-refs+1] - cur[+refs+1]) - 1;
#define CHECK(j)\
- { int score= ABS(cur[-refs-1+j] - cur[+refs-1-j])\
- + ABS(cur[-refs +j] - cur[+refs -j])\
- + ABS(cur[-refs+1+j] - cur[+refs+1-j]);\
+ { int score= FFABS(cur[-refs-1+j] - cur[+refs-1-j])\
+ + FFABS(cur[-refs +j] - cur[+refs -j])\
+ + FFABS(cur[-refs+1+j] - cur[+refs+1-j]);\
if(score < spatial_score){\
spatial_score= score;\
spatial_pred= (cur[-refs +j] + cur[+refs -j])>>1;\
@@ -323,14 +317,14 @@ static void filter_line_c(struct vf_priv_s *p, uint8_t *dst, uint8_t *prev, uint
#if 0
int a= cur[-3*refs];
int g= cur[+3*refs];
- int max= MAX3(d-e, d-c, MIN3(MAX(b-c,f-e),MAX(b-c,b-a),MAX(f-g,f-e)) );
- int min= MIN3(d-e, d-c, MAX3(MIN(b-c,f-e),MIN(b-c,b-a),MIN(f-g,f-e)) );
+ int max= FFMAX3(d-e, d-c, FFMIN3(FFMAX(b-c,f-e),FFMAX(b-c,b-a),FFMAX(f-g,f-e)) );
+ int min= FFMIN3(d-e, d-c, FFMAX3(FFMIN(b-c,f-e),FFMIN(b-c,b-a),FFMIN(f-g,f-e)) );
#else
- int max= MAX3(d-e, d-c, MIN(b-c, f-e));
- int min= MIN3(d-e, d-c, MAX(b-c, f-e));
+ int max= FFMAX3(d-e, d-c, FFMIN(b-c, f-e));
+ int min= FFMIN3(d-e, d-c, FFMAX(b-c, f-e));
#endif
- diff= MAX3(diff, min, -max);
+ diff= FFMAX3(diff, min, -max);
}
if(spatial_pred > d + diff)