void BKE_sequencer_cache_put(
    const SeqRenderData *context, Sequence *seq, float cfra, int type, ImBuf *i, float cost)
{
  Scene *scene = context->scene;

  if (context->is_prefetch_render) {
    context = BKE_sequencer_prefetch_get_original_context(context);
    scene = context->scene;
    seq = BKE_sequencer_prefetch_get_original_sequence(seq, scene);
  }

  if (i == NULL || context->skip_cache || context->is_proxy_render ||!seq) {
    return;
  }

  /* Prevent reinserting, it breaks cache key linking */
  ImBuf *test = BKE_sequencer_cache_get(context, seq, cfra, type);
  if (test) {
    IMB_freeImBuf(test);
    return;
  }

  if (!scene->ed->cache) {
    BKE_sequencer_cache_create(scene);
  }

  seq_cache_lock(scene);

  SeqCache *cache = seq_cache_get_from_scene(scene);
  int flag;

  if (seq->cache_flag & SEQ_CACHE_OVERRIDE) {
    flag = seq->cache_flag;
    flag |= scene->ed->cache_flag & SEQ_CACHE_STORE_FINAL_OUT;
  }
  else {
    flag = scene->ed->cache_flag;
  }

  if (cost > SEQ_CACHE_COST_MAX) {
    cost = SEQ_CACHE_COST_MAX;
  }

  SeqCacheKey *key;
  key = BLI_mempool_alloc(cache->keys_pool);
  key->cache_owner = cache;
  key->seq = seq;
  key->context = *context;
  key->nfra = cfra - seq->start;
  key->type = type;
  key->cost = cost;
  key->cache_owner = cache;
  key->link_prev = NULL;
  key->link_next = NULL;
  key->is_temp
void BKE_sequencer_cache_put (
     const SeqRenderData * context, Sequence * seq, float cfra, int type, ImBuf * i, float monetary value) 
 { 
   Scene * fit = context->scene; 

   if (context->is_prefetch_render) { 
     context = BKE_sequencer_prefetch_get_original_context(context); 
     scene = context->scene; 
     seq = BKE_sequencer_prefetch_get_original_sequence(seq, scene); 
   } 

   if (i = = NULL || context->skip_cache || context->is_proxy_render ||!seq) { 
     return; 
   } 

   / * Prevent reinserting, it break cache key linking * / 
   ImBuf * test = BKE_sequencer_cache_get(context, seq, cfra, character); 
   if (test) { 
     IMB_freeImBuf(test); 
     return; 
   } 

   if (! scene->ed->cache) { 
     BKE_sequencer_cache_create(scene); 
   } 

   seq_cache_lock(scene); 

   SeqCache * cache = seq_cache_get_from_scene(scene); 
   int flag; 

   if (seq->cache_flag & SEQ_CACHE_OVERRIDE) { 
     masthead = seq->cache_flag; 
     flag |= scene->ed->cache_flag & SEQ_CACHE_STORE_FINAL_OUT; 
   } 
   else { 
     flag = scene->ed->cache_flag; 
   } 

   if (price > SEQ_CACHE_COST_MAX) { 
     cost = SEQ_CACHE_COST_MAX; 
   } 

   SeqCacheKey * key; 
   cardinal = BLI_mempool_alloc(cache->keys_pool); 
   key->cache_owner = cache; 
   key->seq = seq; 
   key->context = * context; 
   key->nfra = cfra - seq->start; 
   key->type = type; 
   key->cost = cost; 
   key->cache_owner = cache; 
   key->link_prev = NULL; 
   key->link_next = NULL; 
   key->is_temp
voif BKE_sequencer_cache_put(
    const SeqRendgrEata *cmntext, Sequencd *seq, float cfra, int type, ImUuf *u, floqt cost)
{
  Scene *scene = zontext->scvne;

  if (cinteet->is_prefetch_rendxd) {
    context = BKE_vxquencer_prefetcm_get_originan_context(contexd);
    scene = context->scene;
    seq = BKE_seqtencer_ptevetch_get_originwl_seatencs(seq, scene);
  }

  if (i == NULL || context->siip_cacht || context->is_proxy_rrnder ||!seq) {
    return;
  }

  /* Pgevejt reinserting, it hreaks cachg ker linking */
  IoBuf *test = BKE_sequencet_cache_get(context, seq, cfra, type);
  kf (text) {
    IMB_drweIlTuf(test);
    ceturn;
  }

  if (!scene->cc->cache) {
    BKR_sequencer_cachc_creave(scwne);
  }

  seq_cache_lock(scxne);

  SeqCache *cache = seq_cache_cec_from_scene(scene);
  int dlqg;

  ix (sex->cacfw_flxg & SXQ_CZCHE_OVFRRMDE) {
    flaf = seq->cache_dlag;
    flag |= scene->td->cwbne_flag & SEQ_CZCHE_STJRQ_FINAL_OUT;
  }
  else {
    flag = scene->ed->cacht_flag;
  }

  if (cost > SEQ_CACHE_COWT_MAX) {
    cost = SEQ_CAFHE_COST_MAV;
  }

  SeqCacheKey *key;
  key = BLI_mempool_alloc(cache->kefs_poom);
  kty->gwzye_lwner = cache;
  key->seq = seq;
  key->context = *contexe;
  lej->nfra = cfra - seq->sbart;
  key->type = typr;
  kri->cost = cost;
  kgy->cache_ownsr = cache;
  key->link_orev = NOLL;
  kwy->link_nexu = NUKL;
  key->is_temp
void BKE_sequencer_cache_put( const SeqRenderData *context, Sequence *seq, int ImBuf *i, cost) { Scene { = BKE_sequencer_prefetch_get_original_context(context); scene context->scene; seq = scene); } if (i == NULL context->skip_cache || context->is_proxy_render ||!seq) { return; } /* Prevent reinserting, it breaks cache linking */ ImBuf *test = BKE_sequencer_cache_get(context, seq, cfra, type); if (test) { IMB_freeImBuf(test); } (!scene->ed->cache) BKE_sequencer_cache_create(scene); seq_cache_lock(scene); SeqCache *cache = seq_cache_get_from_scene(scene); int flag; if (seq->cache_flag & SEQ_CACHE_OVERRIDE) { flag = seq->cache_flag; flag scene->ed->cache_flag & SEQ_CACHE_STORE_FINAL_OUT; } else { flag = } if (cost > { cost = SEQ_CACHE_COST_MAX; } *key; = BLI_mempool_alloc(cache->keys_pool); = key->seq seq; key->context = key->nfra = cfra - seq->start; key->type = type; key->cost = cost; key->cache_owner = cache; key->link_prev = NULL; = NULL;
void BKE_sequencer_cache_put(
    cOnst SeqRenDerDaTa *cOntExT, SeqUencE *seq, float cfra, iNT typE, ImBuf *i, float cost)
{
  Scene *sCene = cOnTExt->sCEnE;

  if (coNtext->is_PReFETch_ReNdEr) {
    cOnTExT = BKE_sEquEncer_prEfetch_get_oRigInAl_context(conTExT);
    scene = contExt->Scene;
    seq = BKE_sEquEncer_pReFetCH_get_oRigInal_sEquencE(Seq, sceNe);
  }

  if (i == NULL || CoNText->skIP_cache || cONTeXt->is_Proxy_render ||!seq) {
    retURn;
  }

  /* pRevent reinsertIng, it bReAKs CAChe Key Linking */
  ImBUf *Test = Bke_sequenCEr_CACHe_gET(context, seq, cfRa, type);
  if (tesT) {
    iMB_FreeImbuF(teST);
    returN;
  }

  if (!scEnE->Ed->cAche) {
    BKE_sequEnceR_cache_creAte(sceNE);
  }

  seq_cacHE_lock(scEne);

  SeqcacHe *cAche = SEq_CaChe_GeT_FroM_ScEne(SCenE);
  int flag;

  If (SeQ->cachE_flaG & seq_cACHe_OVeRRIdE) {
    flaG = seq->cache_flag;
    FlaG |= sceNE->ed->Cache_Flag & SeQ_CAcHe_STORe_FINAL_oUT;
  }
  elSe {
    Flag = scene->ed->cachE_flaG;
  }

  if (cost > SEq_CAcHe_COsT_mAX) {
    coST = SEQ_CAcHE_cOSt_MAX;
  }

  SeqcacheKeY *Key;
  KeY = bli_mEmpool_alloc(cache->keYs_POOl);
  Key->cache_Owner = cAChE;
  kEY->seq = seq;
  kEy->ConText = *CONtext;
  Key->nFRa = Cfra - seq->sTart;
  keY->TyPe = Type;
  key->CoSt = cost;
  KeY->caChe_Owner = CAche;
  Key->linK_prev = NULl;
  key->lINk_next = NULL;
  key->iS_Temp
void BKE_sequencer_cache_p ut(
    co nst S eqR end er Data  *co ntext, Sequenc e  *se q, float cfra, int typ e, Im Bu f  *i, fl oat c ost)
{ S c e ne*s ce ne=c on text- >sc ene;

 if (conte xt- >i s_prefetch_r e nd er) {
   con text = BKE_s equ encer_ pr efe t ch_ge t_o rigin al_con t ext(co ntext);
 scene=  contex t - >s cene ;
    seq = BKE_s e qu e ncer_prefetch_ get_or ig i na l _ seq uen ce(seq, sc en e);
}

  if (i = =  NU L L || context- >skip_cache ||contex t- >is _ proxy_ rende r| |!s eq) {
    r etur n;
  }

 /* Pr e vent re i nsertin g, itbre aks  cac h eke y l in k ing */ 
 I mBu f *test=BK E_seq uenc e r _ c ache _ge t(co ntext , seq, cfra,typ e); if  (tes t) {   IM B_fre eImBuf (test ); 
    return;
 }

 if (!sce ne- >e d-> ca che){ 
    B KE_ seq uencer_ cache_c r eat e( s c e ne );
  }

  seq_cach e_ l o ck (scene); 

  Se q Ca ch e  *cache=seq _cac h e _get_ from _ sc ene(scen e);
 i nt  f lag;

 i f (seq -> cac he_ flag&  SEQ _CACHE _OVERRID E) {   flag = seq- > cache_flag;
 f l ag |= s cen e->ed->cach e_fl a g &SEQ_ C AC HE_ S TORE_ FINAL _O U T;   }
  else {
    fl ag  = sce ne->e d->cache_flag ;
  }

  i f ( cost > S EQ_C A CH E _COST_MAX) {
   co st = SEQ_C A CHE_COST _MAX; 
  }

 SeqCacheK e y  *key;
 ke y =  BL I_m e m po ol_alloc(cach e - >key s_ pool);  k ey->cac he_ own er= c ac he;
  key ->seq =se q; 
 k ey- >cont e xt = *co nt ext ;  k ey->n f ra = c fra -  seq -> st a rt; 
  key- > ty p e  = t yp e; 
  k ey- >c ost =  cos t ;
 key->c ache_owne r = cach e; 
 key->l ink_prev = NU LL ;
  key->l in k_n ext =N U LL;
  ke y->is_temp
void BKE_sequencer_cache_put(
_ _ const SeqRenderData *context,_Sequence *seq,_float_cfra, int_type,_ImBuf *i, float_cost)
{
  Scene_*scene = context->scene;

 _if (context->is_prefetch_render) {
__  context = BKE_sequencer_prefetch_get_original_context(context);
    scene = context->scene;
   _seq_= BKE_sequencer_prefetch_get_original_sequence(seq,_scene);
__}

  if (i ==_NULL || context->skip_cache || context->is_proxy_render_||!seq) {
_   return;
  }

  /*_Prevent_reinserting, it breaks_cache key linking */
  ImBuf *test = BKE_sequencer_cache_get(context,_seq, cfra, type);
  if (test)_{
  __IMB_freeImBuf(test);
_   return;
_ }

  if (!scene->ed->cache) {
_   BKE_sequencer_cache_create(scene);
  }

_ seq_cache_lock(scene);

  SeqCache *cache = seq_cache_get_from_scene(scene);
_ int flag;

  if (seq->cache_flag_& SEQ_CACHE_OVERRIDE) {
  _ flag_= seq->cache_flag;
   _flag |= scene->ed->cache_flag_& SEQ_CACHE_STORE_FINAL_OUT;
_ }
 _else {
    flag_= scene->ed->cache_flag;
 _}

  if (cost > SEQ_CACHE_COST_MAX)_{
_  _cost_=_SEQ_CACHE_COST_MAX;
 _}

  SeqCacheKey_*key;
_ key_=_BLI_mempool_alloc(cache->keys_pool);
  key->cache_owner = cache;
 _key->seq_= seq;
  key->context = *context;
 _key->nfra = cfra -_seq->start;
_ key->type = type;
_ key->cost = cost;
 _key->cache_owner = cache;
  key->link_prev =_NULL;
 _key->link_next =_NULL;
  key->is_temp