| 291 | } |
| 292 | |
| 293 | static int unsharp_init_thread(hb_filter_object_t *filter, int threads) |
| 294 | { |
| 295 | hb_filter_private_t * pv = filter->private_data; |
| 296 | |
| 297 | unsharp_thread_close(pv); |
| 298 | pv->thread_ctx = calloc(threads, sizeof(unsharp_thread_context3_t)); |
| 299 | if (pv->thread_ctx == NULL) |
| 300 | { |
| 301 | hb_error("Unsharp calloc failed"); |
| 302 | return -1; |
| 303 | } |
| 304 | pv->threads = threads; |
| 305 | for (int c = 0; c < 3; c++) |
| 306 | { |
| 307 | unsharp_plane_context_t * ctx = &pv->plane_ctx[c]; |
| 308 | int w = hb_image_width(ctx->pix_fmt, ctx->width, c); |
| 309 | |
| 310 | for (int t = 0; t < threads; t++) |
| 311 | { |
| 312 | unsharp_thread_context_t * tctx = &pv->thread_ctx[t][c]; |
| 313 | int z; |
| 314 | for (z = 0; z < 2 * ctx->steps; z++) |
| 315 | { |
| 316 | tctx->SC[z] = malloc(sizeof(*(tctx->SC[z])) * |
| 317 | (w + 2 * ctx->steps)); |
| 318 | if (tctx->SC[z] == NULL) |
| 319 | { |
| 320 | hb_error("Unsharp calloc failed"); |
| 321 | return -1; |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | return 0; |
| 327 | } |
| 328 | |
| 329 | static void unsharp_close(hb_filter_object_t * filter) |
| 330 | { |
no test coverage detected