MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / update_thread_context

Function update_thread_context

libavcodec/ffv1dec.c:906–968  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

904
905#if HAVE_THREADS
906static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
907{
908 FFV1Context *fsrc = src->priv_data;
909 FFV1Context *fdst = dst->priv_data;
910
911 if (dst == src)
912 return 0;
913
914 fdst->version = fsrc->version;
915 fdst->micro_version = fsrc->micro_version;
916 fdst->combined_version = fsrc->combined_version;
917 fdst->chroma_planes = fsrc->chroma_planes;
918 fdst->chroma_h_shift = fsrc->chroma_h_shift;
919 fdst->chroma_v_shift = fsrc->chroma_v_shift;
920 fdst->transparency = fsrc->transparency;
921 fdst->plane_count = fsrc->plane_count;
922 fdst->ac = fsrc->ac;
923 fdst->colorspace = fsrc->colorspace;
924 fdst->pix_fmt = fsrc->pix_fmt;
925 fdst->configured_pix_fmt = fsrc->configured_pix_fmt;
926 fdst->configured_ac = fsrc->configured_ac;
927 fdst->configured_width = fsrc->configured_width;
928 fdst->configured_height = fsrc->configured_height;
929
930 fdst->ec = fsrc->ec;
931 fdst->intra = fsrc->intra;
932 fdst->key_frame_ok = fsrc->key_frame_ok;
933
934 fdst->packed_at_lsb = fsrc->packed_at_lsb;
935 fdst->slice_count = fsrc->slice_count;
936 fdst->use32bit = fsrc->use32bit;
937 memcpy(fdst->state_transition, fsrc->state_transition,
938 sizeof(fdst->state_transition));
939
940 // in version 1 there is a single per-keyframe quant table, so
941 // we need to propagate it between threads
942 if (fsrc->version < 2)
943 memcpy(fdst->quant_tables[0], fsrc->quant_tables[0], sizeof(fsrc->quant_tables[0]));
944
945 for (int i = 0; i < fdst->num_h_slices * fdst->num_v_slices; i++) {
946 FFV1SliceContext *sc = &fdst->slices[i];
947 const FFV1SliceContext *sc0 = &fsrc->slices[i];
948
949 av_refstruct_replace(&sc->plane, sc0->plane);
950
951 if (fsrc->version < 3) {
952 sc->slice_x = sc0->slice_x;
953 sc->slice_y = sc0->slice_y;
954 sc->slice_width = sc0->slice_width;
955 sc->slice_height = sc0->slice_height;
956 }
957 }
958
959 av_refstruct_replace(&fdst->slice_damaged, fsrc->slice_damaged);
960
961 av_assert1(fdst->max_slice_count == fsrc->max_slice_count);
962
963 ff_progress_frame_replace(&fdst->picture, &fsrc->picture);

Callers

nothing calls this directly

Calls 2

av_refstruct_replaceFunction · 0.85

Tested by

no test coverage detected