| 303 | } |
| 304 | |
| 305 | static int chroma_smooth_init_thread(hb_filter_object_t *filter, int threads) |
| 306 | { |
| 307 | hb_filter_private_t * pv = filter->private_data; |
| 308 | |
| 309 | chroma_smooth_thread_close(pv); |
| 310 | pv->thread_ctx = calloc(threads, sizeof(chroma_smooth_thread_context3_t)); |
| 311 | if (pv->thread_ctx == NULL) |
| 312 | { |
| 313 | hb_error("Chroma Smooth calloc failed"); |
| 314 | return -1; |
| 315 | } |
| 316 | pv->threads = threads; |
| 317 | for (int c = 0; c < 3; c++) |
| 318 | { |
| 319 | chroma_smooth_plane_context_t * ctx = &pv->plane_ctx[c]; |
| 320 | int w = hb_image_width(ctx->pix_fmt, ctx->width, c); |
| 321 | |
| 322 | for (int t = 0; t < threads; t++) |
| 323 | { |
| 324 | chroma_smooth_thread_context_t * tctx = &pv->thread_ctx[t][c]; |
| 325 | |
| 326 | if (c) |
| 327 | { |
| 328 | int z; |
| 329 | for (z = 0; z < 2 * ctx->steps; z++) |
| 330 | { |
| 331 | tctx->SC[z] = malloc(sizeof(*(tctx->SC[z])) * |
| 332 | (w + 2 * ctx->steps)); |
| 333 | if (tctx->SC[z] == NULL) |
| 334 | { |
| 335 | hb_error("Chroma Smooth calloc failed"); |
| 336 | return -1; |
| 337 | } |
| 338 | } |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | static void chroma_smooth_close(hb_filter_object_t * filter) |
| 346 | { |
no test coverage detected