Originally committed as revision 15804 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
@@ -1876,7 +1876,7 @@ typedef struct AVCodecContext { | |||||
* - encoding: Set by libavcodec, user can override. | * - encoding: Set by libavcodec, user can override. | ||||
* - decoding: Set by libavcodec, user can override. | * - decoding: Set by libavcodec, user can override. | ||||
*/ | */ | ||||
int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void **arg2, int *ret, int count); | |||||
int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size); | |||||
/** | /** | ||||
* thread opaque | * thread opaque | ||||
@@ -2642,8 +2642,8 @@ enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum | |||||
int avcodec_thread_init(AVCodecContext *s, int thread_count); | int avcodec_thread_init(AVCodecContext *s, int thread_count); | ||||
void avcodec_thread_free(AVCodecContext *s); | void avcodec_thread_free(AVCodecContext *s); | ||||
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count); | |||||
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count); | |||||
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); | |||||
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); | |||||
//FIXME func typedef | //FIXME func typedef | ||||
/** | /** | ||||
@@ -92,7 +92,7 @@ void avcodec_thread_free(AVCodecContext *s){ | |||||
av_freep(&s->thread_opaque); | av_freep(&s->thread_opaque); | ||||
} | } | ||||
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count){ | |||||
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){ | |||||
ThreadContext *c= s->thread_opaque; | ThreadContext *c= s->thread_opaque; | ||||
int i; | int i; | ||||
@@ -102,7 +102,7 @@ int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, vo | |||||
/* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */ | /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */ | ||||
for(i=0; i<count; i++){ | for(i=0; i<count; i++){ | ||||
c[i].arg= arg[i]; | |||||
c[i].arg= (char*)arg + i*size; | |||||
c[i].func= func; | c[i].func= func; | ||||
c[i].ret= 12345; | c[i].ret= 12345; | ||||
@@ -449,7 +449,7 @@ static av_always_inline int dnxhd_switch_matrix(DNXHDEncContext *ctx, int i) | |||||
static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg) | static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg) | ||||
{ | { | ||||
DNXHDEncContext *ctx = arg; | |||||
DNXHDEncContext *ctx = *(void**)arg; | |||||
int mb_y, mb_x; | int mb_y, mb_x; | ||||
int qscale = ctx->thread[0]->qscale; | int qscale = ctx->thread[0]->qscale; | ||||
@@ -499,7 +499,7 @@ static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg) | |||||
static int dnxhd_encode_thread(AVCodecContext *avctx, void *arg) | static int dnxhd_encode_thread(AVCodecContext *avctx, void *arg) | ||||
{ | { | ||||
DNXHDEncContext *ctx = arg; | |||||
DNXHDEncContext *ctx = *(void**)arg; | |||||
int mb_y, mb_x; | int mb_y, mb_x; | ||||
for (mb_y = ctx->m.start_mb_y; mb_y < ctx->m.end_mb_y; mb_y++) { | for (mb_y = ctx->m.start_mb_y; mb_y < ctx->m.end_mb_y; mb_y++) { | ||||
@@ -555,7 +555,7 @@ static void dnxhd_setup_threads_slices(DNXHDEncContext *ctx, uint8_t *buf) | |||||
static int dnxhd_mb_var_thread(AVCodecContext *avctx, void *arg) | static int dnxhd_mb_var_thread(AVCodecContext *avctx, void *arg) | ||||
{ | { | ||||
DNXHDEncContext *ctx = arg; | |||||
DNXHDEncContext *ctx = *(void**)arg; | |||||
int mb_y, mb_x; | int mb_y, mb_x; | ||||
for (mb_y = ctx->m.start_mb_y; mb_y < ctx->m.end_mb_y; mb_y++) { | for (mb_y = ctx->m.start_mb_y; mb_y < ctx->m.end_mb_y; mb_y++) { | ||||
for (mb_x = 0; mb_x < ctx->m.mb_width; mb_x++) { | for (mb_x = 0; mb_x < ctx->m.mb_width; mb_x++) { | ||||
@@ -578,7 +578,7 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx) | |||||
for (q = 1; q < avctx->qmax; q++) { | for (q = 1; q < avctx->qmax; q++) { | ||||
ctx->qscale = q; | ctx->qscale = q; | ||||
avctx->execute(avctx, dnxhd_calc_bits_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count); | |||||
avctx->execute(avctx, dnxhd_calc_bits_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count, sizeof(void*)); | |||||
} | } | ||||
up_step = down_step = 2<<LAMBDA_FRAC_BITS; | up_step = down_step = 2<<LAMBDA_FRAC_BITS; | ||||
lambda = ctx->lambda; | lambda = ctx->lambda; | ||||
@@ -658,7 +658,7 @@ static int dnxhd_find_qscale(DNXHDEncContext *ctx) | |||||
bits = 0; | bits = 0; | ||||
ctx->qscale = qscale; | ctx->qscale = qscale; | ||||
// XXX avoid recalculating bits | // XXX avoid recalculating bits | ||||
ctx->m.avctx->execute(ctx->m.avctx, dnxhd_calc_bits_thread, (void**)&ctx->thread[0], NULL, ctx->m.avctx->thread_count); | |||||
ctx->m.avctx->execute(ctx->m.avctx, dnxhd_calc_bits_thread, (void**)&ctx->thread[0], NULL, ctx->m.avctx->thread_count, sizeof(void*)); | |||||
for (y = 0; y < ctx->m.mb_height; y++) { | for (y = 0; y < ctx->m.mb_height; y++) { | ||||
for (x = 0; x < ctx->m.mb_width; x++) | for (x = 0; x < ctx->m.mb_width; x++) | ||||
bits += ctx->mb_rc[qscale][y*ctx->m.mb_width+x].bits; | bits += ctx->mb_rc[qscale][y*ctx->m.mb_width+x].bits; | ||||
@@ -731,7 +731,7 @@ static int dnxhd_encode_fast(AVCodecContext *avctx, DNXHDEncContext *ctx) | |||||
} | } | ||||
if (!ret) { | if (!ret) { | ||||
if (RC_VARIANCE) | if (RC_VARIANCE) | ||||
avctx->execute(avctx, dnxhd_mb_var_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count); | |||||
avctx->execute(avctx, dnxhd_mb_var_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count, sizeof(void*)); | |||||
qsort(ctx->mb_cmp, ctx->m.mb_num, sizeof(RCEntry), dnxhd_rc_cmp); | qsort(ctx->mb_cmp, ctx->m.mb_num, sizeof(RCEntry), dnxhd_rc_cmp); | ||||
for (x = 0; x < ctx->m.mb_num && max_bits > ctx->frame_bits; x++) { | for (x = 0; x < ctx->m.mb_num && max_bits > ctx->frame_bits; x++) { | ||||
int mb = ctx->mb_cmp[x].mb; | int mb = ctx->mb_cmp[x].mb; | ||||
@@ -803,7 +803,7 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int b | |||||
assert(!(ctx->slice_size[i] & 3)); | assert(!(ctx->slice_size[i] & 3)); | ||||
} | } | ||||
avctx->execute(avctx, dnxhd_encode_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count); | |||||
avctx->execute(avctx, dnxhd_encode_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count, sizeof(void*)); | |||||
AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE); // EOF | AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE); // EOF | ||||
@@ -1013,14 +1013,14 @@ static inline void dv_encode_video_segment(DVVideoContext *s, int work_chunk) | |||||
static int dv_decode_mt(AVCodecContext *avctx, void* sl) | static int dv_decode_mt(AVCodecContext *avctx, void* sl) | ||||
{ | { | ||||
dv_decode_video_segment((DVVideoContext *)avctx->priv_data, (size_t)sl); | |||||
dv_decode_video_segment((DVVideoContext *)avctx->priv_data, *(size_t*)sl); | |||||
return 0; | return 0; | ||||
} | } | ||||
#ifdef CONFIG_DVVIDEO_ENCODER | #ifdef CONFIG_DVVIDEO_ENCODER | ||||
static int dv_encode_mt(AVCodecContext *avctx, void* sl) | static int dv_encode_mt(AVCodecContext *avctx, void* sl) | ||||
{ | { | ||||
dv_encode_video_segment((DVVideoContext *)avctx->priv_data, (size_t)sl); | |||||
dv_encode_video_segment((DVVideoContext *)avctx->priv_data, *(size_t*)sl); | |||||
return 0; | return 0; | ||||
} | } | ||||
#endif | #endif | ||||
@@ -1056,7 +1056,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, | |||||
s->buf = buf; | s->buf = buf; | ||||
avctx->execute(avctx, dv_decode_mt, s->sys->work_chunks, NULL, | avctx->execute(avctx, dv_decode_mt, s->sys->work_chunks, NULL, | ||||
dv_work_pool_size(s->sys)); | |||||
dv_work_pool_size(s->sys), sizeof(void*)); | |||||
emms_c(); | emms_c(); | ||||
@@ -1209,7 +1209,7 @@ static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size, | |||||
s->buf = buf; | s->buf = buf; | ||||
c->execute(c, dv_encode_mt, s->sys->work_chunks, NULL, | c->execute(c, dv_encode_mt, s->sys->work_chunks, NULL, | ||||
dv_work_pool_size(s->sys)); | |||||
dv_work_pool_size(s->sys), sizeof(void*)); | |||||
emms_c(); | emms_c(); | ||||
@@ -6626,7 +6626,8 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8 | |||||
} | } | ||||
} | } | ||||
static int decode_slice(struct AVCodecContext *avctx, H264Context *h){ | |||||
static int decode_slice(struct AVCodecContext *avctx, void *arg){ | |||||
H264Context *h = *(void**)arg; | |||||
MpegEncContext * const s = &h->s; | MpegEncContext * const s = &h->s; | ||||
const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F; | const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F; | ||||
@@ -7346,7 +7347,7 @@ static void execute_decode_slices(H264Context *h, int context_count){ | |||||
} | } | ||||
avctx->execute(avctx, (void *)decode_slice, | avctx->execute(avctx, (void *)decode_slice, | ||||
(void **)h->thread_context, NULL, context_count); | |||||
(void **)h->thread_context, NULL, context_count, sizeof(void*)); | |||||
/* pull back stuff from slices to master context */ | /* pull back stuff from slices to master context */ | ||||
hx = h->thread_context[context_count - 1]; | hx = h->thread_context[context_count - 1]; | ||||
@@ -1866,7 +1866,7 @@ eos: // end of slice | |||||
} | } | ||||
static int slice_decode_thread(AVCodecContext *c, void *arg){ | static int slice_decode_thread(AVCodecContext *c, void *arg){ | ||||
MpegEncContext *s= arg; | |||||
MpegEncContext *s= *(void**)arg; | |||||
const uint8_t *buf= s->gb.buffer; | const uint8_t *buf= s->gb.buffer; | ||||
int mb_y= s->start_mb_y; | int mb_y= s->start_mb_y; | ||||
@@ -2299,7 +2299,7 @@ static int decode_chunks(AVCodecContext *avctx, | |||||
if(avctx->thread_count > 1){ | if(avctx->thread_count > 1){ | ||||
int i; | int i; | ||||
avctx->execute(avctx, slice_decode_thread, (void**)&(s2->thread_context[0]), NULL, s->slice_count); | |||||
avctx->execute(avctx, slice_decode_thread, (void**)&(s2->thread_context[0]), NULL, s->slice_count, sizeof(void*)); | |||||
for(i=0; i<s->slice_count; i++) | for(i=0; i<s->slice_count; i++) | ||||
s2->error_count += s2->thread_context[i]->error_count; | s2->error_count += s2->thread_context[i]->error_count; | ||||
} | } | ||||
@@ -1917,7 +1917,7 @@ static int sse_mb(MpegEncContext *s){ | |||||
} | } | ||||
static int pre_estimate_motion_thread(AVCodecContext *c, void *arg){ | static int pre_estimate_motion_thread(AVCodecContext *c, void *arg){ | ||||
MpegEncContext *s= arg; | |||||
MpegEncContext *s= *(void**)arg; | |||||
s->me.pre_pass=1; | s->me.pre_pass=1; | ||||
@@ -1936,7 +1936,7 @@ static int pre_estimate_motion_thread(AVCodecContext *c, void *arg){ | |||||
} | } | ||||
static int estimate_motion_thread(AVCodecContext *c, void *arg){ | static int estimate_motion_thread(AVCodecContext *c, void *arg){ | ||||
MpegEncContext *s= arg; | |||||
MpegEncContext *s= *(void**)arg; | |||||
ff_check_alignment(); | ff_check_alignment(); | ||||
@@ -1963,7 +1963,7 @@ static int estimate_motion_thread(AVCodecContext *c, void *arg){ | |||||
} | } | ||||
static int mb_var_thread(AVCodecContext *c, void *arg){ | static int mb_var_thread(AVCodecContext *c, void *arg){ | ||||
MpegEncContext *s= arg; | |||||
MpegEncContext *s= *(void**)arg; | |||||
int mb_x, mb_y; | int mb_x, mb_y; | ||||
ff_check_alignment(); | ff_check_alignment(); | ||||
@@ -2005,7 +2005,7 @@ static void write_slice_end(MpegEncContext *s){ | |||||
} | } | ||||
static int encode_thread(AVCodecContext *c, void *arg){ | static int encode_thread(AVCodecContext *c, void *arg){ | ||||
MpegEncContext *s= arg; | |||||
MpegEncContext *s= *(void**)arg; | |||||
int mb_x, mb_y, pdif = 0; | int mb_x, mb_y, pdif = 0; | ||||
int chr_h= 16>>s->chroma_y_shift; | int chr_h= 16>>s->chroma_y_shift; | ||||
int i, j; | int i, j; | ||||
@@ -2779,11 +2779,11 @@ static int encode_picture(MpegEncContext *s, int picture_number) | |||||
s->lambda2= (s->lambda2* (int64_t)s->avctx->me_penalty_compensation + 128)>>8; | s->lambda2= (s->lambda2* (int64_t)s->avctx->me_penalty_compensation + 128)>>8; | ||||
if(s->pict_type != FF_B_TYPE && s->avctx->me_threshold==0){ | if(s->pict_type != FF_B_TYPE && s->avctx->me_threshold==0){ | ||||
if((s->avctx->pre_me && s->last_non_b_pict_type==FF_I_TYPE) || s->avctx->pre_me==2){ | if((s->avctx->pre_me && s->last_non_b_pict_type==FF_I_TYPE) || s->avctx->pre_me==2){ | ||||
s->avctx->execute(s->avctx, pre_estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count); | |||||
s->avctx->execute(s->avctx, pre_estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count, sizeof(void*)); | |||||
} | } | ||||
} | } | ||||
s->avctx->execute(s->avctx, estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count); | |||||
s->avctx->execute(s->avctx, estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count, sizeof(void*)); | |||||
}else /* if(s->pict_type == FF_I_TYPE) */{ | }else /* if(s->pict_type == FF_I_TYPE) */{ | ||||
/* I-Frame */ | /* I-Frame */ | ||||
for(i=0; i<s->mb_stride*s->mb_height; i++) | for(i=0; i<s->mb_stride*s->mb_height; i++) | ||||
@@ -2791,7 +2791,7 @@ static int encode_picture(MpegEncContext *s, int picture_number) | |||||
if(!s->fixed_qscale){ | if(!s->fixed_qscale){ | ||||
/* finding spatial complexity for I-frame rate control */ | /* finding spatial complexity for I-frame rate control */ | ||||
s->avctx->execute(s->avctx, mb_var_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count); | |||||
s->avctx->execute(s->avctx, mb_var_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count, sizeof(void*)); | |||||
} | } | ||||
} | } | ||||
for(i=1; i<s->avctx->thread_count; i++){ | for(i=1; i<s->avctx->thread_count; i++){ | ||||
@@ -2931,7 +2931,7 @@ static int encode_picture(MpegEncContext *s, int picture_number) | |||||
for(i=1; i<s->avctx->thread_count; i++){ | for(i=1; i<s->avctx->thread_count; i++){ | ||||
update_duplicate_context_after_me(s->thread_context[i], s); | update_duplicate_context_after_me(s->thread_context[i], s); | ||||
} | } | ||||
s->avctx->execute(s->avctx, encode_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count); | |||||
s->avctx->execute(s->avctx, encode_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count, sizeof(void*)); | |||||
for(i=1; i<s->avctx->thread_count; i++){ | for(i=1; i<s->avctx->thread_count; i++){ | ||||
merge_context_after_encode(s, s->thread_context[i]); | merge_context_after_encode(s, s->thread_context[i]); | ||||
} | } | ||||
@@ -81,7 +81,7 @@ void avcodec_thread_free(AVCodecContext *s){ | |||||
av_freep(&s->thread_opaque); | av_freep(&s->thread_opaque); | ||||
} | } | ||||
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count){ | |||||
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){ | |||||
ThreadContext *c= s->thread_opaque; | ThreadContext *c= s->thread_opaque; | ||||
int i; | int i; | ||||
@@ -92,7 +92,7 @@ int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, vo | |||||
for(i=0; i<count; i++){ | for(i=0; i<count; i++){ | ||||
c[i].arg= arg[i]; | |||||
c[i].arg= (char*)arg + i*size; | |||||
c[i].func= func; | c[i].func= func; | ||||
c[i].ret= 12345; | c[i].ret= 12345; | ||||
@@ -30,10 +30,11 @@ typedef int (action_t)(AVCodecContext *c, void *arg); | |||||
typedef struct ThreadContext { | typedef struct ThreadContext { | ||||
pthread_t *workers; | pthread_t *workers; | ||||
action_t *func; | action_t *func; | ||||
void **args; | |||||
void *args; | |||||
int *rets; | int *rets; | ||||
int rets_count; | int rets_count; | ||||
int job_count; | int job_count; | ||||
int job_size; | |||||
pthread_cond_t last_job_cond; | pthread_cond_t last_job_cond; | ||||
pthread_cond_t current_job_cond; | pthread_cond_t current_job_cond; | ||||
@@ -67,7 +68,7 @@ static void* attribute_align_arg worker(void *v) | |||||
} | } | ||||
pthread_mutex_unlock(&c->current_job_lock); | pthread_mutex_unlock(&c->current_job_lock); | ||||
c->rets[our_job%c->rets_count] = c->func(avctx, c->args[our_job]); | |||||
c->rets[our_job%c->rets_count] = c->func(avctx, (char*)c->args + our_job*c->job_size); | |||||
pthread_mutex_lock(&c->current_job_lock); | pthread_mutex_lock(&c->current_job_lock); | ||||
our_job = c->current_job++; | our_job = c->current_job++; | ||||
@@ -100,7 +101,7 @@ void avcodec_thread_free(AVCodecContext *avctx) | |||||
av_freep(&avctx->thread_opaque); | av_freep(&avctx->thread_opaque); | ||||
} | } | ||||
int avcodec_thread_execute(AVCodecContext *avctx, action_t* func, void **arg, int *ret, int job_count) | |||||
int avcodec_thread_execute(AVCodecContext *avctx, action_t* func, void *arg, int *ret, int job_count, int job_size) | |||||
{ | { | ||||
ThreadContext *c= avctx->thread_opaque; | ThreadContext *c= avctx->thread_opaque; | ||||
int dummy_ret; | int dummy_ret; | ||||
@@ -112,6 +113,7 @@ int avcodec_thread_execute(AVCodecContext *avctx, action_t* func, void **arg, in | |||||
c->current_job = avctx->thread_count; | c->current_job = avctx->thread_count; | ||||
c->job_count = job_count; | c->job_count = job_count; | ||||
c->job_size = job_size; | |||||
c->args = arg; | c->args = arg; | ||||
c->func = func; | c->func = func; | ||||
if (ret) { | if (ret) { | ||||
@@ -147,6 +149,7 @@ int avcodec_thread_init(AVCodecContext *avctx, int thread_count) | |||||
avctx->thread_count = thread_count; | avctx->thread_count = thread_count; | ||||
c->current_job = 0; | c->current_job = 0; | ||||
c->job_count = 0; | c->job_count = 0; | ||||
c->job_size = 0; | |||||
c->done = 0; | c->done = 0; | ||||
pthread_cond_init(&c->current_job_cond, NULL); | pthread_cond_init(&c->current_job_cond, NULL); | ||||
pthread_cond_init(&c->last_job_cond, NULL); | pthread_cond_init(&c->last_job_cond, NULL); | ||||
@@ -368,11 +368,11 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){ | |||||
return 0; | return 0; | ||||
} | } | ||||
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count){ | |||||
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){ | |||||
int i; | int i; | ||||
for(i=0; i<count; i++){ | for(i=0; i<count; i++){ | ||||
int r= func(c, arg[i]); | |||||
int r= func(c, (char*)arg + i*size); | |||||
if(ret) ret[i]= r; | if(ret) ret[i]= r; | ||||
} | } | ||||
return 0; | return 0; | ||||
@@ -74,7 +74,7 @@ void avcodec_thread_free(AVCodecContext *s){ | |||||
av_freep(&s->thread_opaque); | av_freep(&s->thread_opaque); | ||||
} | } | ||||
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count){ | |||||
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){ | |||||
ThreadContext *c= s->thread_opaque; | ThreadContext *c= s->thread_opaque; | ||||
int i; | int i; | ||||
@@ -84,7 +84,7 @@ int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, vo | |||||
/* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */ | /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */ | ||||
for(i=0; i<count; i++){ | for(i=0; i<count; i++){ | ||||
c[i].arg= arg[i]; | |||||
c[i].arg= (char*)arg + i*size; | |||||
c[i].func= func; | c[i].func= func; | ||||
c[i].ret= 12345; | c[i].ret= 12345; | ||||