aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2005-12-17 18:14:38 +0000
committerDiego Biurrun <diego@biurrun.de>2005-12-17 18:14:38 +0000
commit115329f16062074e11ccf3b89ead6176606c9696 (patch)
treee98aa993905a702688bf821737ab9a443969fc28 /libavcodec/utils.c
parentd76319b1ab716320f6e6a4d690b85fe4504ebd5b (diff)
downloadffmpeg-115329f16062074e11ccf3b89ead6176606c9696.tar.gz
COSMETICS: Remove all trailing whitespace.
Originally committed as revision 4749 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c116
1 files changed, 58 insertions, 58 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 76c63ba032..461a104447 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -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 avcodec_default_free_buffers(AVCodecContext *s);
void *av_mallocz(unsigned int size)
{
void *ptr;
-
+
ptr = av_malloc(size);
if (!ptr)
return NULL;
@@ -84,9 +84,9 @@ char *av_strdup(const char *s)
*/
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 *av_mallocz_static(unsigned int size)
{
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 @@ typedef struct InternalBuffer{
#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 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
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 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
}
#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 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
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 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
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 @@ static const char* context_to_name(void* ptr) {
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 @@ static const char* context_to_name(void* ptr) {
#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 @@ void avcodec_get_context_defaults(AVCodecContext *s){
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 @@ void avcodec_get_context_defaults(AVCodecContext *s){
/**
* 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 @@ void avcodec_get_frame_defaults(AVFrame *pic){
/**
* 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 @@ int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
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 @@ end:
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 @@ int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
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 avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
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 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
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 @@ int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
*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 @@ int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
*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 avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub,
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 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
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 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
enc->sample_rate,
channels_str);
}
-
+
/* for PCM codecs, compute bitrate directly */
switch(enc->codec_id) {
case CODEC_ID_PCM_S32LE:
@@ -1167,7 +1167,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
", 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 @@ void avcodec_default_free_buffers(AVCodecContext *s){
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 @@ void avcodec_default_free_buffers(AVCodecContext *s){
}
}
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 @@ static void av_log_default_callback(void* ptr, int level, const char* fmt, va_li
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);
}