diff utils.c @ 2967:ef2149182f1c libavcodec

COSMETICS: Remove all trailing whitespace.
author diego
date Sat, 17 Dec 2005 18:14:38 +0000
parents 2c4753d27834
children c9f6a0946672
line wrap: on
line diff
--- a/utils.c	Sat Dec 17 11:31:56 2005 +0000
+++ b/utils.c	Sat Dec 17 18:14:38 2005 +0000
@@ -18,12 +18,12 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
- 
+
 /**
  * @file utils.c
  * utils.
  */
- 
+
 #include "avcodec.h"
 #include "dsputil.h"
 #include "mpegvideo.h"
@@ -59,7 +59,7 @@
 void *av_mallocz(unsigned int size)
 {
     void *ptr;
-    
+
     ptr = av_malloc(size);
     if (!ptr)
         return NULL;
@@ -84,9 +84,9 @@
  */
 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
 {
-    if(min_size < *size) 
+    if(min_size < *size)
         return ptr;
-    
+
     *size= FFMAX(17*min_size/16 + 32, min_size);
 
     return av_realloc(ptr, *size);
@@ -104,7 +104,7 @@
 {
     void *ptr = av_mallocz(size);
 
-    if(ptr){ 
+    if(ptr){
         array_static =av_fast_realloc(array_static, &allocated_static, sizeof(void*)*(last_static+1));
         if(!array_static)
             return NULL;
@@ -198,9 +198,9 @@
 #define ALIGN(x, a) (((x)+(a)-1)&~((a)-1))
 
 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
-    int w_align= 1;    
-    int h_align= 1;    
-    
+    int w_align= 1;
+    int h_align= 1;
+
     switch(s->pix_fmt){
     case PIX_FMT_YUV420P:
     case PIX_FMT_YUV422:
@@ -254,7 +254,7 @@
 int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
     if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/4)
         return 0;
-    
+
     av_log(av_log_ctx, AV_LOG_ERROR, "picture size invalid (%ux%u)\n", w, h);
     return -1;
 }
@@ -277,16 +277,16 @@
     }
 #if 0
     s->internal_buffer= av_fast_realloc(
-        s->internal_buffer, 
-        &s->internal_buffer_size, 
+        s->internal_buffer,
+        &s->internal_buffer_size,
         sizeof(InternalBuffer)*FFMAX(99,  s->internal_buffer_count+1)/*FIXME*/
         );
 #endif
-     
+
     buf= &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
     picture_number= &(((InternalBuffer*)s->internal_buffer)[INTERNAL_BUFFER_SIZE-1]).last_pic_num; //FIXME ugly hack
     (*picture_number)++;
-    
+
     if(buf->base[0]){
         pic->age= *picture_number - buf->last_pic_num;
         buf->last_pic_num= *picture_number;
@@ -298,7 +298,7 @@
         avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift);
 
         avcodec_align_dimensions(s, &w, &h);
-            
+
         if(!(s->flags&CODEC_FLAG_EMU_EDGE)){
             w+= EDGE_WIDTH*2;
             h+= EDGE_WIDTH*2;
@@ -335,7 +335,7 @@
             memset(buf->base[i], 128, size[i]);
 
             // no edge if EDEG EMU or not planar YUV, we check for PAL8 redundantly to protect against a exploitable bug regression ...
-            if((s->flags&CODEC_FLAG_EMU_EDGE) || (s->pix_fmt == PIX_FMT_PAL8) || !size[2]) 
+            if((s->flags&CODEC_FLAG_EMU_EDGE) || (s->pix_fmt == PIX_FMT_PAL8) || !size[2])
                 buf->data[i] = buf->base[i];
             else
                 buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), STRIDE_ALIGN);
@@ -432,7 +432,7 @@
     AVCodecContext *avc= ptr;
 
     if(avc && avc->codec && avc->codec->name)
-        return avc->codec->name; 
+        return avc->codec->name;
     else
         return "NULL";
 }
@@ -443,7 +443,7 @@
 #define V AV_OPT_FLAG_VIDEO_PARAM
 #define A AV_OPT_FLAG_AUDIO_PARAM
 #define S AV_OPT_FLAG_SUBTITLE_PARAM
-#define E AV_OPT_FLAG_ENCODING_PARAM 
+#define E AV_OPT_FLAG_ENCODING_PARAM
 #define D AV_OPT_FLAG_DECODING_PARAM
 
 static AVOption options[]={
@@ -754,7 +754,7 @@
     s->pix_fmt= PIX_FMT_NONE;
     s->frame_skip_cmp= FF_CMP_DCTMAX;
     s->nsse_weight= 8;
-    
+
     s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS;
     s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS;
     s->palctrl = NULL;
@@ -763,15 +763,15 @@
 
 /**
  * allocates a AVCodecContext and set it to defaults.
- * this can be deallocated by simply calling free() 
+ * this can be deallocated by simply calling free()
  */
 AVCodecContext *avcodec_alloc_context(void){
     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
-    
+
     if(avctx==NULL) return NULL;
-    
+
     avcodec_get_context_defaults(avctx);
-    
+
     return avctx;
 }
 
@@ -784,22 +784,22 @@
 
 /**
  * allocates a AVPFrame and set it to defaults.
- * this can be deallocated by simply calling free() 
+ * this can be deallocated by simply calling free()
  */
 AVFrame *avcodec_alloc_frame(void){
     AVFrame *pic= av_malloc(sizeof(AVFrame));
-    
+
     if(pic==NULL) return NULL;
-    
+
     avcodec_get_frame_defaults(pic);
-    
+
     return pic;
 }
 
 int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
 {
     int ret= -1;
-    
+
     entangled_thread_counter++;
     if(entangled_thread_counter != 1){
         av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n");
@@ -814,7 +814,7 @@
     avctx->frame_number = 0;
     if (codec->priv_data_size > 0) {
         avctx->priv_data = av_mallocz(codec->priv_data_size);
-        if (!avctx->priv_data) 
+        if (!avctx->priv_data)
             goto end;
     } else {
         avctx->priv_data = NULL;
@@ -841,7 +841,7 @@
     return ret;
 }
 
-int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, 
+int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
                          const short *samples)
 {
     if(buf_size < FF_MIN_BUFFER_SIZE && 0){
@@ -856,7 +856,7 @@
         return 0;
 }
 
-int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, 
+int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
                          const AVFrame *pict)
 {
     if(buf_size < FF_MIN_BUFFER_SIZE){
@@ -869,13 +869,13 @@
         int ret = avctx->codec->encode(avctx, buf, buf_size, (void *)pict);
         avctx->frame_number++;
         emms_c(); //needed to avoid an emms_c() call before every return;
-    
+
         return ret;
     }else
         return 0;
 }
 
-int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, 
+int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
                             const AVSubtitle *sub)
 {
     int ret;
@@ -884,31 +884,31 @@
     return ret;
 }
 
-/** 
- * decode a frame. 
+/**
+ * decode a frame.
  * @param buf bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE larger then the actual read bytes
  * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end
  * @param buf_size the size of the buffer in bytes
  * @param got_picture_ptr zero if no frame could be decompressed, Otherwise, it is non zero
  * @return -1 if error, otherwise return the number of
- * bytes used. 
+ * bytes used.
  */
-int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, 
+int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
                          int *got_picture_ptr,
                          uint8_t *buf, int buf_size)
 {
     int ret;
-    
+
     *got_picture_ptr= 0;
     if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height))
         return -1;
     if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){
-        ret = avctx->codec->decode(avctx, picture, got_picture_ptr, 
+        ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
                                 buf, buf_size);
 
         emms_c(); //needed to avoid an emms_c() call before every return;
-    
-        if (*got_picture_ptr)                           
+
+        if (*got_picture_ptr)
             avctx->frame_number++;
     }else
         ret= 0;
@@ -920,7 +920,7 @@
    *number of bytes used. If no frame could be decompressed,
    *frame_size_ptr is zero. Otherwise, it is the decompressed frame
    *size in BYTES. */
-int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, 
+int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
                          int *frame_size_ptr,
                          uint8_t *buf, int buf_size)
 {
@@ -928,7 +928,7 @@
 
     *frame_size_ptr= 0;
     if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){
-        ret = avctx->codec->decode(avctx, samples, frame_size_ptr, 
+        ret = avctx->codec->decode(avctx, samples, frame_size_ptr,
                                 buf, buf_size);
         avctx->frame_number++;
     }else
@@ -946,7 +946,7 @@
     int ret;
 
     *got_sub_ptr = 0;
-    ret = avctx->codec->decode(avctx, sub, got_sub_ptr, 
+    ret = avctx->codec->decode(avctx, sub, got_sub_ptr,
                                (uint8_t *)buf, buf_size);
     if (*got_sub_ptr)
         avctx->frame_number++;
@@ -1048,9 +1048,9 @@
         codec_name = enc->codec_name;
     } else {
         /* output avi tags */
-        if(   isprint(enc->codec_tag&0xFF) && isprint((enc->codec_tag>>8)&0xFF) 
+        if(   isprint(enc->codec_tag&0xFF) && isprint((enc->codec_tag>>8)&0xFF)
            && isprint((enc->codec_tag>>16)&0xFF) && isprint((enc->codec_tag>>24)&0xFF)){
-            snprintf(buf1, sizeof(buf1), "%c%c%c%c / 0x%04X", 
+            snprintf(buf1, sizeof(buf1), "%c%c%c%c / 0x%04X",
                      enc->codec_tag & 0xff,
                      (enc->codec_tag >> 8) & 0xff,
                      (enc->codec_tag >> 16) & 0xff,
@@ -1113,7 +1113,7 @@
                      enc->sample_rate,
                      channels_str);
         }
-        
+
         /* for PCM codecs, compute bitrate directly */
         switch(enc->codec_id) {
         case CODEC_ID_PCM_S32LE:
@@ -1167,7 +1167,7 @@
                      ", pass 2");
     }
     if (bitrate != 0) {
-        snprintf(buf + strlen(buf), buf_size - strlen(buf), 
+        snprintf(buf + strlen(buf), buf_size - strlen(buf),
                  ", %d kb/s", bitrate / 1000);
     }
 }
@@ -1207,7 +1207,7 @@
     int i, j;
 
     if(s->internal_buffer==NULL) return;
-    
+
     for(i=0; i<INTERNAL_BUFFER_SIZE; i++){
         InternalBuffer *buf= &((InternalBuffer*)s->internal_buffer)[i];
         for(j=0; j<4; j++){
@@ -1216,18 +1216,18 @@
         }
     }
     av_freep(&s->internal_buffer);
-    
+
     s->internal_buffer_count=0;
 }
 
 char av_get_pict_type_char(int pict_type){
     switch(pict_type){
-    case I_TYPE: return 'I'; 
-    case P_TYPE: return 'P'; 
-    case B_TYPE: return 'B'; 
-    case S_TYPE: return 'S'; 
-    case SI_TYPE:return 'i'; 
-    case SP_TYPE:return 'p'; 
+    case I_TYPE: return 'I';
+    case P_TYPE: return 'P';
+    case B_TYPE: return 'B';
+    case S_TYPE: return 'S';
+    case SI_TYPE:return 'i';
+    case SP_TYPE:return 'p';
     default:     return '?';
     }
 }
@@ -1247,9 +1247,9 @@
 	    fprintf(stderr, "[%s @ %p]", avc->item_name(ptr), avc);
     }
 #define fprintf please_use_av_log
-        
+
     print_prefix= strstr(fmt, "\n") != NULL;
-        
+
     vfprintf(stderr, fmt, vl);
 }