20 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
21 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 |
* |
* |
23 |
* $Id: postprocessing.c,v 1.6 2010-12-18 10:13:38 Isibaar Exp $ |
* $Id: postprocessing.c,v 1.6.2.1 2011-04-07 19:07:36 Isibaar Exp $ |
24 |
* |
* |
25 |
****************************************************************************/ |
****************************************************************************/ |
26 |
|
|
132 |
const MACROBLOCK * mbs, int mb_width, int mb_height, int mb_stride, |
const MACROBLOCK * mbs, int mb_width, int mb_height, int mb_stride, |
133 |
int flags, int brightness, int frame_num, int bvop, int threads) |
int flags, int brightness, int frame_num, int bvop, int threads) |
134 |
{ |
{ |
135 |
int k, num_threads = MAX(1, MIN(threads, 4)); |
int k; |
136 |
SMPDeblock data[4]; |
#ifndef HAVE_PTHREAD |
137 |
|
int num_threads = 1; |
138 |
|
#else |
139 |
|
int num_threads = MAX(1, MIN(threads, 4)); |
140 |
void *status = NULL; |
void *status = NULL; |
141 |
|
#endif |
142 |
|
SMPDeblock data[4]; |
143 |
|
|
144 |
/* horizontal deblocking, dispatch threads */ |
/* horizontal deblocking, dispatch threads */ |
145 |
for (k = 0; k < num_threads; k++) { |
for (k = 0; k < num_threads; k++) { |
155 |
|
|
156 |
data[k].stop_y = mb_height*2; |
data[k].stop_y = mb_height*2; |
157 |
} |
} |
158 |
|
#ifdef HAVE_PTHREAD |
159 |
/* create threads */ |
/* create threads */ |
160 |
for (k = 1; k < num_threads; k++) { |
for (k = 1; k < num_threads; k++) { |
161 |
pthread_create(&data[k].handle, NULL, |
pthread_create(&data[k].handle, NULL, |
162 |
(void*)stripe_deblock_h, (void*)&data[k]); |
(void*)stripe_deblock_h, (void*)&data[k]); |
163 |
} |
} |
164 |
|
#endif |
165 |
stripe_deblock_h(&data[0]); |
stripe_deblock_h(&data[0]); |
166 |
|
|
167 |
|
#ifdef HAVE_PTHREAD |
168 |
/* wait until all threads are finished */ |
/* wait until all threads are finished */ |
169 |
for (k = 1; k < num_threads; k++) { |
for (k = 1; k < num_threads; k++) { |
170 |
pthread_join(data[k].handle, &status); |
pthread_join(data[k].handle, &status); |
171 |
} |
} |
172 |
|
#endif |
173 |
|
|
174 |
/* vertical deblocking, dispatch threads */ |
/* vertical deblocking, dispatch threads */ |
175 |
for (k = 0; k < num_threads; k++) { |
for (k = 0; k < num_threads; k++) { |
178 |
data[k].stop_x = mb_width*2; |
data[k].stop_x = mb_width*2; |
179 |
} |
} |
180 |
|
|
181 |
|
#ifdef HAVE_PTHREAD |
182 |
/* create threads */ |
/* create threads */ |
183 |
for (k = 1; k < num_threads; k++) { |
for (k = 1; k < num_threads; k++) { |
184 |
pthread_create(&data[k].handle, NULL, |
pthread_create(&data[k].handle, NULL, |
185 |
(void*)stripe_deblock_v, (void*)&data[k]); |
(void*)stripe_deblock_v, (void*)&data[k]); |
186 |
} |
} |
187 |
|
#endif |
188 |
stripe_deblock_v(&data[0]); |
stripe_deblock_v(&data[0]); |
189 |
|
|
190 |
|
#ifdef HAVE_PTHREAD |
191 |
/* wait until all threads are finished */ |
/* wait until all threads are finished */ |
192 |
for (k = 1; k < num_threads; k++) { |
for (k = 1; k < num_threads; k++) { |
193 |
pthread_join(data[k].handle, &status); |
pthread_join(data[k].handle, &status); |
194 |
} |
} |
195 |
|
#endif |
196 |
|
|
197 |
if (!bvop) |
if (!bvop) |
198 |
tbls->prev_quant = mbs->quant; |
tbls->prev_quant = mbs->quant; |