| 337 | static int h264_slice_header_init(H264Context *h); |
| 338 | |
| 339 | int ff_h264_update_thread_context(AVCodecContext *dst, |
| 340 | const AVCodecContext *src) |
| 341 | { |
| 342 | H264Context *h = dst->priv_data, *h1 = src->priv_data; |
| 343 | int inited = h->context_initialized, err = 0; |
| 344 | int need_reinit = 0; |
| 345 | int i, ret; |
| 346 | |
| 347 | if (dst == src) |
| 348 | return 0; |
| 349 | |
| 350 | if (inited && !h1->ps.sps) |
| 351 | return AVERROR_INVALIDDATA; |
| 352 | |
| 353 | if (inited && |
| 354 | (h->width != h1->width || |
| 355 | h->height != h1->height || |
| 356 | h->mb_width != h1->mb_width || |
| 357 | h->mb_height != h1->mb_height || |
| 358 | !h->ps.sps || |
| 359 | h->ps.sps->bit_depth_luma != h1->ps.sps->bit_depth_luma || |
| 360 | h->ps.sps->chroma_format_idc != h1->ps.sps->chroma_format_idc || |
| 361 | h->ps.sps->vui.matrix_coeffs != h1->ps.sps->vui.matrix_coeffs)) { |
| 362 | need_reinit = 1; |
| 363 | } |
| 364 | |
| 365 | /* copy block_offset since frame_start may not be called */ |
| 366 | memcpy(h->block_offset, h1->block_offset, sizeof(h->block_offset)); |
| 367 | |
| 368 | // SPS/PPS |
| 369 | for (int i = 0; i < FF_ARRAY_ELEMS(h->ps.sps_list); i++) |
| 370 | av_refstruct_replace(&h->ps.sps_list[i], h1->ps.sps_list[i]); |
| 371 | for (int i = 0; i < FF_ARRAY_ELEMS(h->ps.pps_list); i++) |
| 372 | av_refstruct_replace(&h->ps.pps_list[i], h1->ps.pps_list[i]); |
| 373 | |
| 374 | av_refstruct_replace(&h->ps.pps, h1->ps.pps); |
| 375 | h->ps.sps = h1->ps.sps; |
| 376 | |
| 377 | if (need_reinit || !inited) { |
| 378 | h->width = h1->width; |
| 379 | h->height = h1->height; |
| 380 | h->mb_height = h1->mb_height; |
| 381 | h->mb_width = h1->mb_width; |
| 382 | h->mb_num = h1->mb_num; |
| 383 | h->mb_stride = h1->mb_stride; |
| 384 | h->b_stride = h1->b_stride; |
| 385 | h->x264_build = h1->x264_build; |
| 386 | |
| 387 | if (h->context_initialized || h1->context_initialized) { |
| 388 | if ((err = h264_slice_header_init(h)) < 0) { |
| 389 | av_log(h->avctx, AV_LOG_ERROR, "h264_slice_header_init() failed"); |
| 390 | return err; |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | /* copy block_offset since frame_start may not be called */ |
| 395 | memcpy(h->block_offset, h1->block_offset, sizeof(h->block_offset)); |
| 396 | } |
nothing calls this directly
no test coverage detected