comparison utils.c @ 9686:bc32976d6d9d libavcodec

Move ALIGN macro to libavutil/common.h and use it in various places
author conrad
date Fri, 22 May 2009 21:32:13 +0000
parents 59073f92f0e2
children 0d6f887d91fb
comparison
equal deleted inserted replaced
9685:ab8b3b2e4d49 9686:bc32976d6d9d
131 int width, height; 131 int width, height;
132 enum PixelFormat pix_fmt; 132 enum PixelFormat pix_fmt;
133 }InternalBuffer; 133 }InternalBuffer;
134 134
135 #define INTERNAL_BUFFER_SIZE 32 135 #define INTERNAL_BUFFER_SIZE 32
136
137 #define ALIGN(x, a) (((x)+(a)-1)&~((a)-1))
138 136
139 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){ 137 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
140 int w_align= 1; 138 int w_align= 1;
141 int h_align= 1; 139 int h_align= 1;
142 140
191 w_align= 1; 189 w_align= 1;
192 h_align= 1; 190 h_align= 1;
193 break; 191 break;
194 } 192 }
195 193
196 *width = ALIGN(*width , w_align); 194 *width = FFALIGN(*width , w_align);
197 *height= ALIGN(*height, h_align); 195 *height= FFALIGN(*height, h_align);
198 if(s->codec_id == CODEC_ID_H264) 196 if(s->codec_id == CODEC_ID_H264)
199 *height+=2; // some of the optimized chroma MC reads one line too much 197 *height+=2; // some of the optimized chroma MC reads one line too much
200 } 198 }
201 199
202 int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){ 200 int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
315 313
316 // no edge if EDEG EMU or not planar YUV 314 // no edge if EDEG EMU or not planar YUV
317 if((s->flags&CODEC_FLAG_EMU_EDGE) || !size[2]) 315 if((s->flags&CODEC_FLAG_EMU_EDGE) || !size[2])
318 buf->data[i] = buf->base[i]; 316 buf->data[i] = buf->base[i];
319 else 317 else
320 buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), stride_align[i]); 318 buf->data[i] = buf->base[i] + FFALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), stride_align[i]);
321 } 319 }
322 if(size[1] && !size[2]) 320 if(size[1] && !size[2])
323 ff_set_systematic_pal((uint32_t*)buf->data[1], s->pix_fmt); 321 ff_set_systematic_pal((uint32_t*)buf->data[1], s->pix_fmt);
324 buf->width = s->width; 322 buf->width = s->width;
325 buf->height = s->height; 323 buf->height = s->height;