Commit 3f1ed7ce authored by Loren Merritt's avatar Loren Merritt

cosmetics: XCHG macro



git-svn-id: svn://svn.videolan.org/x264/trunk@359 df754926-b1dd-0310-bc7b-ec298dee348c
parent 662e56b5
......@@ -36,6 +36,21 @@
#define X264_VERSION "" // no configure script for msvc
#endif
/****************************************************************************
* Macros
****************************************************************************/
#define X264_MIN(a,b) ( (a)<(b) ? (a) : (b) )
#define X264_MAX(a,b) ( (a)>(b) ? (a) : (b) )
#define X264_MIN3(a,b,c) X264_MIN((a),X264_MIN((b),(c)))
#define X264_MAX3(a,b,c) X264_MAX((a),X264_MAX((b),(c)))
#define X264_MIN4(a,b,c,d) X264_MIN((a),X264_MIN3((b),(c),(d)))
#define X264_MAX4(a,b,c,d) X264_MAX((a),X264_MAX3((b),(c),(d)))
#define XCHG(type,a,b) { type t = a; a = b; b = t; }
#define FIX8(f) ((int)(f*(1<<8)+.5))
/****************************************************************************
* Includes
****************************************************************************/
#include "x264.h"
#include "bs.h"
#include "set.h"
......@@ -48,17 +63,6 @@
#include "csp.h"
#include "quant.h"
/****************************************************************************
* Macros
****************************************************************************/
#define X264_MIN(a,b) ( (a)<(b) ? (a) : (b) )
#define X264_MAX(a,b) ( (a)>(b) ? (a) : (b) )
#define X264_MIN3(a,b,c) X264_MIN((a),X264_MIN((b),(c)))
#define X264_MAX3(a,b,c) X264_MAX((a),X264_MAX((b),(c)))
#define X264_MIN4(a,b,c,d) X264_MIN((a),X264_MIN3((b),(c),(d)))
#define X264_MAX4(a,b,c,d) X264_MAX((a),X264_MAX3((b),(c),(d)))
#define FIX8(f) ((int)(f*(1<<8)+.5))
/****************************************************************************
* Generals functions
****************************************************************************/
......
......@@ -31,7 +31,7 @@
#include "x264.h"
#include "dct.h"
#include "common.h"
#ifdef HAVE_MMXEXT
# include "i386/dct.h"
#endif
......
......@@ -31,7 +31,6 @@
#include "x264.h"
#include "common/dct.h"
#include "dct.h"
......
......@@ -706,9 +706,7 @@ static void x264_frame_sort( x264_frame_t *list[X264_BFRAME_MAX+1], int b_dts )
: dtime > 0;
if( swap )
{
x264_frame_t *tmp = list[i+1];
list[i+1] = list[i];
list[i] = tmp;
XCHG( x264_frame_t*, list[i], list[i+1] );
b_ok = 0;
}
}
......@@ -748,10 +746,7 @@ static inline void x264_reference_build_list( x264_t *h, int i_poc, int i_slice_
{
if( h->fref0[i]->i_poc < h->fref0[i+1]->i_poc )
{
x264_frame_t *tmp = h->fref0[i+1];
h->fref0[i+1] = h->fref0[i];
h->fref0[i] = tmp;
XCHG( x264_frame_t*, h->fref0[i], h->fref0[i+1] );
b_ok = 0;
break;
}
......@@ -765,10 +760,7 @@ static inline void x264_reference_build_list( x264_t *h, int i_poc, int i_slice_
{
if( h->fref1[i]->i_poc > h->fref1[i+1]->i_poc )
{
x264_frame_t *tmp = h->fref1[i+1];
h->fref1[i+1] = h->fref1[i];
h->fref1[i] = tmp;
XCHG( x264_frame_t*, h->fref1[i], h->fref1[i+1] );
b_ok = 0;
break;
}
......@@ -816,11 +808,7 @@ static inline void x264_reference_update( x264_t *h )
/* move lowres copy of the image to the ref frame */
for( i = 0; i < 4; i++)
{
uint8_t *tmp = h->fdec->lowres[i];
h->fdec->lowres[i] = h->fenc->lowres[i];
h->fenc->lowres[i] = tmp;
}
XCHG( uint8_t*, h->fdec->lowres[i], h->fenc->lowres[i] );
/* adaptive B decision needs a pointer, since it can't use the ref lists */
if( h->sh.i_type != SLICE_TYPE_B )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment