annotate pthread.c @ 1931:902556e6d21d libavcodec

writing corrupt files on MinGW patch by (Matthias Fritschi <choi at netlabs dot org>)
author michael
date Fri, 09 Apr 2004 15:04:51 +0000
parents 00a6bfc81010
children 50e92cec1b84
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
1 /*
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
2 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
3 *
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
4 * This library is free software; you can redistribute it and/or
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
5 * modify it under the terms of the GNU Lesser General Public
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
7 * version 2 of the License, or (at your option) any later version.
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
8 *
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
9 * This library is distributed in the hope that it will be useful,
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
12 * Lesser General Public License for more details.
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
13 *
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
14 * You should have received a copy of the GNU Lesser General Public
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
15 * License along with this library; if not, write to the Free Software
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
17 *
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
18 */
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
19 #include <semaphore.h>
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
20 #include <pthread.h>
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
21
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
22 //#define DEBUG
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
23
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
24 #include "avcodec.h"
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
25 #include "common.h"
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
26
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
27 typedef struct JobContext{
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
28 sem_t available_sem;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
29 int assigned;
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
30 int (*func)(AVCodecContext *c, void *arg);
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
31 void *arg;
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
32 int ret;
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
33 }JobContext;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
34
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
35 typedef struct WorkerContext{
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
36 AVCodecContext *avctx;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
37 pthread_t thread;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
38 int start_index;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
39 sem_t work_sem;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
40 sem_t done_sem;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
41 }WorkerContext;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
42
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
43 typedef struct ThreadContext{
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
44 WorkerContext *worker;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
45 JobContext *job;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
46 int job_count;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
47 int allocated_job_count;
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
48 }ThreadContext;
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
49
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
50 static void * thread_func(void *v){
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
51 WorkerContext *w= v;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
52 ThreadContext *c= w->avctx->thread_opaque;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
53 int i;
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
54
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
55 for(;;){
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
56 //av_log(w->avctx, AV_LOG_DEBUG, "thread_func %X enter wait\n", (int)v);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
57 sem_wait(&w->work_sem);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
58 //av_log(w->avctx, AV_LOG_DEBUG, "thread_func %X after wait\n", (int)v);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
59 if(c->job_count == 0)
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
60 break;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
61
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
62 for(i=0; i<c->job_count; i++){
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
63 int index= (i + w->start_index) % c->job_count;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
64 JobContext *j= &c->job[index];
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
65
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
66 //av_log(w->avctx, AV_LOG_DEBUG, "thread_func %X first check of %d\n", (int)v, index);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
67 if(j->assigned) continue; //unsynced check, if != 0 it is already given to another worker, it never becomes available before the next execute() call so this should be safe
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
68
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
69 //av_log(w->avctx, AV_LOG_DEBUG, "thread_func %X second check of %d\n", (int)v, index);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
70 if(sem_trywait(&j->available_sem) == 0){
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
71 j->assigned=1;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
72 j->ret= j->func(w->avctx, j->arg);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
73 //av_log(w->avctx, AV_LOG_DEBUG, "thread_func %X done %d\n", (int)v, index);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
74 }
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
75 }
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
76 //av_log(w->avctx, AV_LOG_DEBUG, "thread_func %X complete\n", (int)v);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
77 sem_post(&w->done_sem);
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
78 }
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
79
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
80 return NULL;
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
81 }
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
82
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
83 /**
1822
7366bb5c363f w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents: 1799
diff changeset
84 * free what has been allocated by avcodec_thread_init().
7366bb5c363f w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents: 1799
diff changeset
85 * must be called after decoding has finished, especially dont call while avcodec_thread_execute() is running
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
86 */
1822
7366bb5c363f w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents: 1799
diff changeset
87 void avcodec_thread_free(AVCodecContext *s){
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
88 ThreadContext *c= s->thread_opaque;
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
89 int i, val;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
90
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
91 for(i=0; i<c->allocated_job_count; i++){
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
92 sem_getvalue(&c->job[i].available_sem, &val); assert(val == 0);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
93 sem_destroy(&c->job[i].available_sem);
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
94 }
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
95
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
96 c->job_count= 0;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
97 for(i=0; i<s->thread_count; i++){
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
98 sem_getvalue(&c->worker[i].work_sem, &val); assert(val == 0);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
99 sem_getvalue(&c->worker[i].done_sem, &val); assert(val == 0);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
100
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
101 sem_post(&c->worker[i].work_sem);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
102 pthread_join(c->worker[i].thread, NULL);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
103 sem_destroy(&c->worker[i].work_sem);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
104 sem_destroy(&c->worker[i].done_sem);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
105 }
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
106
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
107 av_freep(&c->job);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
108 av_freep(&c->worker);
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
109 av_freep(&s->thread_opaque);
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
110 }
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
111
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
112 int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int job_count){
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
113 ThreadContext *c= s->thread_opaque;
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
114 int i, val;
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
115
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
116 assert(s == c->avctx);
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
117 if(job_count > c->allocated_job_count){
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
118 c->job= av_realloc(c->job, job_count*sizeof(JobContext));
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
119
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
120 for(i=c->allocated_job_count; i<job_count; i++){
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
121 memset(&c->job[i], 0, sizeof(JobContext));
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
122 c->allocated_job_count++;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
123
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
124 if(sem_init(&c->job[i].available_sem, 0, 0))
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
125 return -1;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
126 }
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
127 }
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
128 c->job_count= job_count;
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
129
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
130 /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
131
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
132 for(i=0; i<job_count; i++){
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
133 sem_getvalue(&c->job[i].available_sem, &val); assert(val == 0);
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
134
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
135 c->job[i].arg= arg[i];
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
136 c->job[i].func= func;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
137 c->job[i].ret= 12345;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
138 c->job[i].assigned= 0;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
139 sem_post(&c->job[i].available_sem);
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
140 }
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
141
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
142 for(i=0; i<s->thread_count && i<job_count; i++){
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
143 sem_getvalue(&c->worker[i].work_sem, &val); assert(val == 0);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
144 sem_getvalue(&c->worker[i].done_sem, &val); assert(val == 0);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
145
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
146 c->worker[i].start_index= (i + job_count/2)/job_count;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
147 //av_log(s, AV_LOG_DEBUG, "start worker %d\n", i);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
148 sem_post(&c->worker[i].work_sem);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
149 }
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
150
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
151 for(i=0; i<s->thread_count && i<job_count; i++){
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
152 //av_log(s, AV_LOG_DEBUG, "wait for worker %d\n", i);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
153 sem_wait(&c->worker[i].done_sem);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
154
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
155 sem_getvalue(&c->worker[i].work_sem, &val); assert(val == 0);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
156 sem_getvalue(&c->worker[i].done_sem, &val); assert(val == 0);
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
157 }
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
158
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
159 for(i=0; i<job_count; i++){
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
160 sem_getvalue(&c->job[i].available_sem, &val); assert(val == 0);
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
161
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
162 c->job[i].func= NULL;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
163 if(ret) ret[i]= c->job[i].ret;
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
164 }
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
165
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
166 return 0;
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
167 }
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
168
1822
7366bb5c363f w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents: 1799
diff changeset
169 int avcodec_thread_init(AVCodecContext *s, int thread_count){
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
170 int i;
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
171 ThreadContext *c;
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
172 WorkerContext *worker;
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
173
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
174 s->thread_count= thread_count;
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
175
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
176 assert(!s->thread_opaque);
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
177 c= av_mallocz(sizeof(ThreadContext));
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
178 worker= av_mallocz(sizeof(WorkerContext)*thread_count);
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
179 s->thread_opaque= c;
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
180 c->worker= worker;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
181
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
182 for(i=0; i<thread_count; i++){
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
183 //printf("init semaphors %d\n", i); fflush(stdout);
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
184 worker[i].avctx= s;
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
185 if(sem_init(&worker[i].work_sem, 0, 0))
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
186 goto fail;
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
187 if(sem_init(&worker[i].done_sem, 0, 0))
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
188 goto fail;
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
189 //printf("create thread %d\n", i); fflush(stdout);
1857
00a6bfc81010 count > thread_count for execute()
michael
parents: 1822
diff changeset
190 if(pthread_create(&worker[i].thread, NULL, thread_func, &worker[i]))
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
191 goto fail;
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
192 }
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
193 //printf("init done\n"); fflush(stdout);
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
194
1822
7366bb5c363f w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents: 1799
diff changeset
195 s->execute= avcodec_thread_execute;
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
196
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
197 return 0;
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
198 fail:
1822
7366bb5c363f w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents: 1799
diff changeset
199 avcodec_thread_free(s);
1799
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
200 return -1;
95612d423fde multithreaded/SMP motion estimation
michael
parents:
diff changeset
201 }