changeset 21531:a90aa203186c

Get rid of min/max macros from aviheader.h, they do not belong here. Replace their uses by FFMIN/FFMAX
author reimar
date Sat, 09 Dec 2006 12:24:11 +0000
parents b755687aa485
children 7e36c7edce3d
files libmpcodecs/ad_hwmpa.c libmpcodecs/ae_pcm.c libmpcodecs/vd_ffmpeg.c libmpcodecs/ve_x264.c libmpdemux/aviheader.h libmpdemux/demux_mpg.c libmpdemux/demux_ogg.c libmpdemux/demux_ts.c libmpdemux/demux_vqf.c libmpdemux/muxer_mpeg.c
diffstat 10 files changed, 22 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_hwmpa.c	Sat Dec 09 12:14:14 2006 +0000
+++ b/libmpcodecs/ad_hwmpa.c	Sat Dec 09 12:24:11 2006 +0000
@@ -96,7 +96,7 @@
 		if(start + len > sh->a_in_buffer_len)
 		{
 			int l;
-			l = min(sh->a_in_buffer_size - sh->a_in_buffer_len, start + len);
+			l = FFMIN(sh->a_in_buffer_size - sh->a_in_buffer_len, start + len);
 			l = demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len], l);
 			if(! l)
 				break;
--- a/libmpcodecs/ae_pcm.c	Sat Dec 09 12:14:14 2006 +0000
+++ b/libmpcodecs/ae_pcm.c	Sat Dec 09 12:24:11 2006 +0000
@@ -36,7 +36,7 @@
 
 static int encode_pcm(audio_encoder_t *encoder, uint8_t *dest, void *src, int nsamples, int max_size)
 {
-	max_size = min(nsamples, max_size);
+	max_size = FFMIN(nsamples, max_size);
 	memcpy(dest, src, max_size);
 	return max_size;
 }
--- a/libmpcodecs/vd_ffmpeg.c	Sat Dec 09 12:14:14 2006 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Sat Dec 09 12:24:11 2006 +0000
@@ -392,11 +392,11 @@
         if (sh->bih->biSize-sizeof(BITMAPINFOHEADER))
             /* Palette size in biSize */
             memcpy(avctx->palctrl->palette, sh->bih+1,
-                   min(sh->bih->biSize-sizeof(BITMAPINFOHEADER), AVPALETTE_SIZE));
+                   FFMIN(sh->bih->biSize-sizeof(BITMAPINFOHEADER), AVPALETTE_SIZE));
         else
             /* Palette size in biClrUsed */
             memcpy(avctx->palctrl->palette, sh->bih+1,
-                   min(sh->bih->biClrUsed * 4, AVPALETTE_SIZE));
+                   FFMIN(sh->bih->biClrUsed * 4, AVPALETTE_SIZE));
 	}
 
     if(sh->bih)
--- a/libmpcodecs/ve_x264.c	Sat Dec 09 12:14:14 2006 +0000
+++ b/libmpcodecs/ve_x264.c	Sat Dec 09 12:24:11 2006 +0000
@@ -124,7 +124,7 @@
         if(turbo == 1)
         {
             param.i_frame_reference = ( param.i_frame_reference + 1 ) >> 1;
-            param.analyse.i_subpel_refine = max( min( 3, param.analyse.i_subpel_refine - 1 ), 1 );
+            param.analyse.i_subpel_refine = FFMAX( FFMIN( 3, param.analyse.i_subpel_refine - 1 ), 1 );
             param.analyse.inter &= ( ~X264_ANALYSE_PSUB8x8 );
             param.analyse.inter &= ( ~X264_ANALYSE_BSUB16x16 );
             param.analyse.i_trellis = 0;
--- a/libmpdemux/aviheader.h	Sat Dec 09 12:14:14 2006 +0000
+++ b/libmpdemux/aviheader.h	Sat Dec 09 12:24:11 2006 +0000
@@ -5,18 +5,6 @@
 #include "libavutil/common.h"
 #include "mpbswap.h"
 
-#ifndef MIN
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#endif
-
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-
-#ifndef max
-#define max(a,b) (((a)>(b))?(a):(b))
-#endif
-
 #ifndef mmioFOURCC
 #define mmioFOURCC( ch0, ch1, ch2, ch3 )				\
 		( (uint32_t)(uint8_t)(ch0) | ( (uint32_t)(uint8_t)(ch1) << 8 ) |	\
--- a/libmpdemux/demux_mpg.c	Sat Dec 09 12:14:14 2006 +0000
+++ b/libmpdemux/demux_mpg.c	Sat Dec 09 12:24:11 2006 +0000
@@ -57,7 +57,7 @@
   prog_len = stream_read_word(demux->stream);		//length of program descriptors
   stream_skip(demux->stream, prog_len);			//.. that we ignore
   es_map_len = stream_read_word(demux->stream);		//length of elementary streams map
-  es_map_len = min(es_map_len, len - prog_len - 8);	//sanity check
+  es_map_len = FFMIN(es_map_len, len - prog_len - 8);	//sanity check
   while(es_map_len > 0) {
     type = stream_read_char(demux->stream);
     id = stream_read_char(demux->stream);
@@ -91,7 +91,7 @@
       mp_dbg(MSGT_DEMUX,MSGL_V, "PSM ES, id=0x%x, type=%x, stype: %x\n", id, type, priv->es_map[idoffset]);
     }
     plen = stream_read_word(demux->stream);		//length of elementary stream descriptors
-    plen = min(plen, es_map_len);			//sanity check
+    plen = FFMIN(plen, es_map_len);			//sanity check
     stream_skip(demux->stream, plen);			//skip descriptors for now
     es_map_len -= 4 + plen;
   }
--- a/libmpdemux/demux_ogg.c	Sat Dec 09 12:14:14 2006 +0000
+++ b/libmpdemux/demux_ogg.c	Sat Dec 09 12:24:11 2006 +0000
@@ -593,7 +593,7 @@
   stream_seek(s,demuxer->movi_start);
   } else {
     //the 270000 are just a wild guess
-    stream_seek(s,max(ogg_d->pos,demuxer->movi_end-270000));
+    stream_seek(s,FFMAX(ogg_d->pos,demuxer->movi_end-270000));
   }
   ogg_sync_reset(sync);
 
--- a/libmpdemux/demux_ts.c	Sat Dec 09 12:14:14 2006 +0000
+++ b/libmpdemux/demux_ts.c	Sat Dec 09 12:24:11 2006 +0000
@@ -1174,7 +1174,7 @@
 			
 			while(i < sl->ts_len)
 			{
-				m = min(8, sl->ts_len - i);
+				m = FFMIN(8, sl->ts_len - i);
 				v |= getbits(buf, n, m);
 				if(sl->ts_len - i > 8)
 					v <<= 8;
@@ -1193,7 +1193,7 @@
 		pl_size = 0;
 		while(i < sl->au_len)
 		{
-			m = min(8, sl->au_len - i);
+			m = FFMIN(8, sl->au_len - i);
 			pl_size |= getbits(buf, n, m);
 			if(sl->au_len - i > 8)
 				pl_size <<= 8;
@@ -1662,7 +1662,7 @@
 	int i = 0, j, size = 0;
 	
 	mp_msg(MSGT_DEMUX, MSGL_DBG2, "PARSE_MP4_DESC_LEN(%d), bytes: ", *len);
-	j = min(*len, 4);
+	j = FFMIN(*len, 4);
 	while(i < j)
 	{
 		mp_msg(MSGT_DEMUX, MSGL_DBG2, " %x ", buf[i]);
@@ -2957,7 +2957,7 @@
 
 			if(tss->payload_size > 0)
 			{
-				sz = min(tss->payload_size, buf_size);
+				sz = FFMIN(tss->payload_size, buf_size);
 				tss->payload_size -= sz;
 				es->size = sz;
 			}
--- a/libmpdemux/demux_vqf.c	Sat Dec 09 12:14:14 2006 +0000
+++ b/libmpdemux/demux_vqf.c	Sat Dec 09 12:24:11 2006 +0000
@@ -98,31 +98,31 @@
         memcpy(sdata,&buf[i],slen); sdata[slen]=0; i+=slen;
         if(sid==mmioFOURCC('N','A','M','E'))
         {
-        memcpy(hi->Name,sdata,min(BUFSIZ,slen));
+        memcpy(hi->Name,sdata,FFMIN(BUFSIZ,slen));
         demux_info_add(demuxer,"Title",sdata);
         }
         else
         if(sid==mmioFOURCC('A','U','T','H'))
         {
-        memcpy(hi->Auth,sdata,min(BUFSIZ,slen));
+        memcpy(hi->Auth,sdata,FFMIN(BUFSIZ,slen));
         demux_info_add(demuxer,"Author",sdata);
         }
         else
         if(sid==mmioFOURCC('C','O','M','T'))
         {
-        memcpy(hi->Comt,sdata,min(BUFSIZ,slen));
+        memcpy(hi->Comt,sdata,FFMIN(BUFSIZ,slen));
         demux_info_add(demuxer,"Comment",sdata);
         }
         else
         if(sid==mmioFOURCC('(','c',')',' '))
         {
-        memcpy(hi->Cpyr,sdata,min(BUFSIZ,slen));
+        memcpy(hi->Cpyr,sdata,FFMIN(BUFSIZ,slen));
         demux_info_add(demuxer,"Copyright",sdata);
         }
         else
         if(sid==mmioFOURCC('F','I','L','E'))
         {
-        memcpy(hi->File,sdata,min(BUFSIZ,slen));
+        memcpy(hi->File,sdata,FFMIN(BUFSIZ,slen));
         }
         else
         if(sid==mmioFOURCC('A','L','B','M')) demux_info_add(demuxer,"Album",sdata);
--- a/libmpdemux/muxer_mpeg.c	Sat Dec 09 12:14:14 2006 +0000
+++ b/libmpdemux/muxer_mpeg.c	Sat Dec 09 12:24:11 2006 +0000
@@ -936,7 +936,7 @@
 	{
 		if(!frpos && len>0 && s->type == MUXER_TYPE_VIDEO && spriv->framebuf[n].type==I_FRAME)
 			return len;
-		m = min(spriv->framebuf[n].size - frpos, psize - len);
+		m = FFMIN(spriv->framebuf[n].size - frpos, psize - len);
 		len += m;
 		frpos += m;
 		if(frpos == spriv->framebuf[n].size)
@@ -997,8 +997,8 @@
 
 	if(i > -1)
 	{
-		dpts = max(spriv->last_saved_pts, spriv->framebuf[i].pts) - 
-			min(spriv->last_saved_pts, spriv->framebuf[i].pts) +
+		dpts = FFMAX(spriv->last_saved_pts, spriv->framebuf[i].pts) - 
+			FFMIN(spriv->last_saved_pts, spriv->framebuf[i].pts) +
 			spriv->framebuf[0].idur;
 
 		if(s->type != MUXER_TYPE_VIDEO)
@@ -1218,7 +1218,7 @@
 			update_demux_bufsize(spriv, frm->dts, frm->size, s->type);
 		}
 
-		m = min(frm->size - frm->pos, priv->packet_size - spriv->pack_offset);
+		m = FFMIN(frm->size - frm->pos, priv->packet_size - spriv->pack_offset);
 		memcpy(&(spriv->pack[spriv->pack_offset]), &(frm->buffer[frm->pos]), m);
 
 		len += m;
@@ -2215,7 +2215,7 @@
 		{
 			stream->ckid = be2me_32 (0x1bd);
 			if(priv->is_genmpeg1 || priv->is_genmpeg2)
-				fix_audio_sys_header(priv, spriv->id, 0xbd, max(conf_abuf_size, 58)*1024);	//only one audio at the moment
+				fix_audio_sys_header(priv, spriv->id, 0xbd, FFMAX(conf_abuf_size, 58)*1024);	//only one audio at the moment
 			spriv->id = 0xbd;
 			if(!conf_abuf_size)
 			spriv->max_buffer_size = 16*1024;