Mercurial > libavcodec.hg
comparison utils.c @ 1799:95612d423fde libavcodec
multithreaded/SMP motion estimation
multithreaded/SMP encoding for MPEG1/MPEG2/MPEG4/H263
all pthread specific code is in pthread.c
to try it, run configure --enable-pthreads and ffmpeg ... -threads <num>
the internal thread API is a simple AVCodecContext.execute() callback which executes a given function pointer with different arguments and returns after finishing all, that way no mutexes or other thread-mess is needed outside pthread.c
author | michael |
---|---|
date | Fri, 13 Feb 2004 17:54:10 +0000 |
parents | a3da4b429984 |
children | a660ef952580 |
comparison
equal
deleted
inserted
replaced
1798:a3da4b429984 | 1799:95612d423fde |
---|---|
322 s->height); | 322 s->height); |
323 s->release_buffer(s, &temp_pic); // Release old frame | 323 s->release_buffer(s, &temp_pic); // Release old frame |
324 return 0; | 324 return 0; |
325 } | 325 } |
326 | 326 |
327 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count){ | |
328 int i; | |
329 | |
330 for(i=0; i<count; i++){ | |
331 int r= func(c, arg[i]); | |
332 if(ret) ret[i]= r; | |
333 } | |
334 return 0; | |
335 } | |
336 | |
327 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum PixelFormat * fmt){ | 337 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum PixelFormat * fmt){ |
328 return fmt[0]; | 338 return fmt[0]; |
329 } | 339 } |
330 | 340 |
331 void avcodec_get_context_defaults(AVCodecContext *s){ | 341 void avcodec_get_context_defaults(AVCodecContext *s){ |
350 s->gop_size= 50; | 360 s->gop_size= 50; |
351 s->me_method= ME_EPZS; | 361 s->me_method= ME_EPZS; |
352 s->get_buffer= avcodec_default_get_buffer; | 362 s->get_buffer= avcodec_default_get_buffer; |
353 s->release_buffer= avcodec_default_release_buffer; | 363 s->release_buffer= avcodec_default_release_buffer; |
354 s->get_format= avcodec_default_get_format; | 364 s->get_format= avcodec_default_get_format; |
365 s->execute= avcodec_default_execute; | |
366 s->thread_count=1; | |
355 s->me_subpel_quality=8; | 367 s->me_subpel_quality=8; |
356 s->lmin= FF_QP2LAMBDA * s->qmin; | 368 s->lmin= FF_QP2LAMBDA * s->qmin; |
357 s->lmax= FF_QP2LAMBDA * s->qmax; | 369 s->lmax= FF_QP2LAMBDA * s->qmax; |
358 s->sample_aspect_ratio= (AVRational){0,1}; | 370 s->sample_aspect_ratio= (AVRational){0,1}; |
359 s->ildct_cmp= FF_CMP_VSAD; | 371 s->ildct_cmp= FF_CMP_VSAD; |