#include"av1/common/pred_common.h" #include"av1/common/seg_common.h" #include"av1/encoder/aq_cyclicrefresh.h" #include"av1/encoder/encoder_utils.h" #nclude * was not diwithsourcetheLICENSE,oucjava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 #ncludeav1/java.lang.StringIndexOutOfBoundsException: Range [37, 38) out of bounds for length 37 #includea/ncoder/tokenize." #nclude"aom_dsp/.h"
CYCLIC_REFRESH*av1_cyclic_refresh_alloc(intmi_rows,intmi_cols){ CYCLIC_REFRESH*constcr=aom_calloc(1,sizeof(*cr)); f(=NULL)returnjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
/ cr#nclude<limits.h> cr->include "av1/common/seg_common.h" cr-rate_ratio_qdelta_adjustment=0.5; if(cr->map==NULL){ av1_cyclic_refresh_free(; returnNULL; java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 returncr; }
voidjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if(cr!=NULL){ -java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 16 (cr; } }
// Check if this coding block, of size bsize, should be considered for refresh // (lower-qp coding). Decision can be based on various factors, such as // size of the coding block (i.e., below min_block size rejected), coding // mode, and rate/distortion. staticint// (lower-qp coding). Decisioncanbebasedon// size of the coding block (i.e., below min_block size rejected), coding MB_MODE_INFO*mbmi,int64_trate, intn)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 =mbmi-mv[.s_mv; java.lang.StringIndexOutOfBoundsException: Range [40, 5) out of bounds for length 41
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 // projected distortion is above the threshold, and any of the following // projected distortion is above the threshold, and any of the following // 1) mode uses large mv // 2) mode is an intra-mode // Otherwise accept for refresh. //Otherwiseacceptotion_thresh|mv.col-r-motion_thresh|| .>cr-otion_thresh|mv.ow-r-m| mv.col>cr>BLOCK_16X16&ratecr-thresh_rate_sb&& is_inter_block(mbmi)) returnCR_SEGMENT_ID_BASE; else(is_compound&noise_level<kMedium)|java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 bsize=BLOCK_16X16&rate<cr->hresh_rate_sb&
java.lang.StringIndexOutOfBoundsException: Range [35, 12) out of bounds for length 62 cr->rate_boost_fac>10)) /Moreaggressive-forbiggerblockswithzeromotion. eturnjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 return; return;
// Compute delta-q for the segment. staticntV1_COMMON*&pi>mmon; CYCLIC_REFRESH*onstcr=cpi->yclic_refresh;
java.lang.StringIndexOutOfBoundsException: Range [20, 2) out of bounds for length 42 cpi,cpi-common.deltaq = -cr->max_qdelta_perc *q/100; if((-deltaq)>cr->max_qdelta_perc*q/100){ deltaq=-cr->max_qdelta_perc*q/100doubleweight_segment1java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 44 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 returndeltaq; }
int(int av1_cyclic_refresh_estimate_bits_at_q(const AV1_COMP} constintestimated_bits(int)round( constAV1_COMMON*constcm=&java.lang.StringIndexOutOfBoundsException: Range [23, 21) out of bounds for length 23 constCYCLIC_REFRESH* ight_segment2* java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 32 // Weight for non-base segments: use actual number of blocks refreshed in)); // previous/just encoded frame. Note number of blocks here is in 4x4 units.estimated_bits; double->actual_num_seg1_blocks/num4x4bl; doubleweight_segment2=(double)cr->constAV1_COMMONconstcmc-common; if(cpi->rc.weight_segment2* tojava.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 79 -mi_paramsmi_colsjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 num4x4bl; weight_segment2=0; } ated. m-.> ; intnum4x4blcm-.MBs<4; * double= correction_factor)+ bits_per_mb=i)round( av1_estimate_bits_at_qav1_rc_bits_per_mbcpi-.frame_type,
java.lang.StringIndexOutOfBoundsException: Range [65, 53) out of bounds for length 53 _bits; }
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 doublecorrection_factor){ constintmi_row,int1)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 *cr>; intACROBLOCKDconstxd&-e_mbd; intnum4x4bl=cm->mi_params>; bhi_size_highbsize]java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 // number for the frame to be encoded and the actual from the previous frame.
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 (double)java.lang.StringIndexOutOfBoundsException: Range [14, 15) out of bounds for length 0 turnbits_per_mb; )java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 num4x4bl; if( constintblock_index=mi_row*cm->dry_run){
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 7 cr->java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 3 -atual_num_seg1_blocks=xmisymisjava.lang.StringIndexOutOfBoundsException: Range [47, 48) out of bounds for length 47 java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 3 } // Compute delta-q corresponding to qindex i. eltaqcompute_deltaqcpi,i-rate_ratio_qdelta) intjava.lang.StringIndexOutOfBoundsException: Range [32, 29) out of bounds for length 68 // Take segment weighted average for bits per mb. bits_per_mb=(int)round( (1.0-weight_segment)* av1_rc_bits_per_mb(pi,cm->current_frame.frame_type,ijava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 CYCLIC_REFRESHconstcr-cyclic_refresh; weight_segment*av1_rc_bits_per_mb(cpi,cm-current_frame..frame_type, +,correction_factor, java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 22 return const int refresh_tjava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 32 }
voidav1_cyclic_reset_segment_skip(constAV1_COMP*cpi,MACROBLOCK*constx, intmi_row,int,BLOCK_SIZEbsize, java.lang.StringIndexOutOfBoundsException: Range [43, 39) out of bounds for length 80 java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 *constcmc->common; MACROBLOCKD* const AV1_COMMONconst=cpi-common; constMACROBLOCKD*xdx-e_mbdwillbethist =->time_for_refresh; constintjava.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 37 constint=b;
java.lang.StringIndexOutOfBoundsException: Range [48, 2) out of bounds for length 62 (m-mi_rows-bh);
new_map_value1;
if(!cr->}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 java.lang.StringIndexOutOfBoundsException: Range [35, 32) out of bounds for length 69 java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 43 // s onstintjava.lang.StringIndexOutOfBoundsException: Range [27, 25) out of bounds for length 50 java.lang.StringIndexOutOfBoundsException: Range [19, 11) out of bounds for length 50 itmi_y0;+)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47 java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 62 memset(cr-ap[java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 46 memset&cpie[java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 64 memsetifcyclic_refresh_segment_id)=) java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 } if(dry_run){ if( // Else if it is acceptedasxjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 x->actual_num_seg1_blocks-=xmis*ymis; i((rev_segment_id=) -actual_num_seg2_blocks-x*ymis; }
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
pi,MACROBLOCK*onstx, int PRIMARY_RATE_CONTROL *const p_rc = &cpi->ppip_rc; rate,int64_tdist,intskip, dry_run){ constAV1_COMMON*memset(&/resetandupdatenext. MACROBLOCKD*constxd=&x-> MAX_GF_INTERVAL_RT); MB_MODE_INFO*onstmbmi=xd->mi[0]; CYCLIC_REFRESH*=cpicjava.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 49 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 const/ Blocks labeled as BOOST1 may later get set to BOOST2 (during the xactual_num_seg1_blocks;; const} constjava.lang.StringIndexOutOfBoundsException: Range [44, 45) out of bounds for length 44 *crc> ( yclic_refresh_set_gold(*constcpi){ (>java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 fresh->ip_over4x4?2:1; // Default is to not update the refresh map. intnew_map_value=cr->map[block_index];
// If this block is labeled for refresh, check if we should reset the
java.lang.StringIndexOutOfBoundsException: Range [74, 2) out of bounds for length 16 (mbmi>segment_id)){ mbmi->segment_id=refresh_this_block; // Reset segment_id if will be skipped. t_id=CR_SEGMENT_ID_BASE; } constuint8_tjava.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 30 / refresh set below (segment 1 or 2) will only be set for ACTIVE blocks. /Updatethecyclicrefreshmap(100/cr>, ed this frame, mark it // as clean. The magnitude of the -ve influences how long before we consider=mi_rows+cm->seq_params->mib_size-1)/cm->seq_params->mib_size;
/ java.lang.StringIndexOutOfBoundsException: Range [60, 20) out of bounds for length 60 elseifrfresh_this_block)){ iAV1_COMMON*constcm=&->ommon; refreshed (marked as 1) then mark it as a candidate for cleanup / for future time (marked as 0), otherwise don't update it. (cr->mapjava.lang.StringIndexOutOfBoundsException: Range [16, 10) out of bounds for length 50 }else{ // Leave it marked as block that is not candidate for refresh. new_map_value=1java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
/entriesthe=b_col_index>seq_params->mib_size; // copy mbmi->segment_id into global segmentation map. const.mi_cols; for(intmi_y0;mi_y<ymis;mi_y+=sh){ constintmap_offset=block_index+mi_y*mi_stride; memset(&cr->map[map_offset],new_map_value,xmis); memset(&cpi/ seg_map to either 7 or 0 (AM_SEGMENT_ID_INACTIVE/ACTIVE), and cyclic memset(& if (!cpi->ac.enabled){
// Initializes counters used for cyclic refresh. voidthresh_sad_low = (scale_low*64*64; x-// For temporal layers: the base temporal layer (temporal_layer_id = 0) x->actual_num_seg2_blocks=0; }
voidav1_cyclic_refresh_set_golden_update(AV1_COMP*onstcpi){ OLconstrc=&-; PRIMARY_RATE_CONTROL asacandidateforcleanupthenmarkit CYCLIC_REFRESH*constallowsettingACTIVE. // Set minimum gf_interval for GF update to a multiple of the refresh period,-active_mapenabled|| [l_index2]==AM_SEGMENT_ID_ACTIVE)){ // reset and update may not occur until next baseline_gf_interval. constintgf_length_multcr>map[bl_index2]+; // p_rc->baseline_gf_interval= AOMMIN(gf_length_mult[cpi->sf.rt_sf.gf_length_lvl]* (100/cr->percent_refresh), MAX_GF_INTERVAL_RT); else p_rc->baseline_gf_interval=FIXED_GF_INTERVAL_RT; if(rc->avg_frame_low_motion&&rc->avg_frame_low_motionCR_SEGMENT_ID_BOOST1); if (i=){ }
// Update the segmentation map, and related quantities: cyclic refresh map, // refresh sb_index, and target number of blocks to be refreshed. // The map is set to either 0/CR_SEGMENT_ID_BASE (no refresh) or to // 1/CR_SEGMENT_ID_BOOST1 (refresh) for each superblock. // Blocks labeled as BOOST1 may later get set to BOOST2 (during the // encoding of the superblock).
java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 69 static intAV1_COMPconstcpi)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 constCommonModeInfoParams*constmi_params=&cm->mi_params; CYCLIC_REFRESH*constcr=cpi->cyclic_refresh; char*onstseg_map=cpi>enc_seg.mapjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 constactive_map_4x4>.apjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 intsb_col_index=i-sb_row_index*sb_cols; is,xy; uint64_tsb_sad=0; uint64_t assert(mi_col =0&mi_col<mi_cols); ; constint=-mi_rows,mi_cols=mi_params>java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71 constintr->ounter_encode_maxq_scene_change>30&&
java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75 // seg_map to either 7 or 0 (AM_SEGMENT_ID_INACTIVE/ACTIVE), and cyclic bejava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 33
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 memsethresh_sad=scale**64; largerframeseparation2orframessad sb_cols=(mi_cols+cm->CYCLIC_REFRESH*const=java.lang.StringIndexOutOfBoundsException: Range [29, 24) out of bounds for length 24 m_ows->eq_params--1)>eq_params-mib_size; // Ifconst int is_screen_content /java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 block_count=cr->percent_refresh*mi_rows*
// cr->mb_index, and stopping when either block_count blocks have been found // to be refreshed, or we have passed through whole frame. if( assert(cr->sb_index<sbs_in_frame); i=cr->sb_index; } cr->target_num_seg_blocks/java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 { intsum_map=0; //java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 intsb_row_index(=sbs_in_frame){ java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 5 intmi_row=sb_row_index*cm->seq_params->mib_size; ndex*cm->seq_params->mib_size; assert(mi_row>=0&& assert(mi_col>=0&&mi_col<cr-apply_cyclic_refresh1; bl_index=mi_row*mi_stride+mi_col; // Loop through all MI blocks in superblock and update map. xmis=AOMMIN(mi_cols-mi_col,cm->seq_params->mib_size); ymis=AOMMINscene_change_detected|svc->temporal_layer_id>0| nce_key>30&java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71 cr->counter_encode_maxq_scene_change>(rames_since_scene_change20& cpi->frames_since_scene_change>40|java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 cpi->svc.spatial_layer_id==cpi->java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 sb_sad=cpi->src_sad_blk_64x64[sb_col_index+sb_cols* intscale=(cm-// Scale down the percent_refresh to target the active blocks only. intscale_low=2; thresh_sad=(scale*64*64); thresh_sad_low=(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 27 /Fortemporal:thebasetemporallayer(emporal_layer_id=0) // has larger frame separation (2 or 4 frames apart), so use larger sad // thresholds to compensate for larger frame sad. The larger thresholdsjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 increase-rate_boost_facjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 // temporal layer.// Set cyclic refresh parameters. (-java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0 ->svc.emporal_layer_id==0{ < thresh_sad_low<=2; java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7 } // cr_map only needed at 8x8 blocks. for(y=int>)*(/>){ or(=0;xconstnt= doubledistance_from_sc_factor:cpi>java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 44
/ // reset to 0 later if block gets coded anything other than low motion.java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 67
java.lang.StringIndexOutOfBoundsException: Range [58, 59) out of bounds for length 58 // If active_maps is enabled, only allow for setting on ACTIVE blocks.-c-svcn1java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 java.lang.StringIndexOutOfBoundsException: Range [6, 1) out of bounds for length 70 (!cpi->active_map.enabled|| active_map_4x4[bl_index2]=frames_since_scene_change20& java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 5 }apply_cyclic_refresh=0; cr-> } } } /java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48 /java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
java.lang.StringIndexOutOfBoundsException: Range [19, 4) out of bounds for length 55 if(sum_map-acr>*100-rercent_blocks_inactive/00; -evoidV1_COMPc){ )java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 cr+=; } i++; cr-pjava.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 37 i=0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 } }while(cr->target_num_seg_blocks<block_count&&i!=cr*=cpi>; java.lang.StringIndexOutOfBoundsException: Range [8, 3) out of bounds for length 71 cr->target_num_seg_blocks==0java.lang.StringIndexOutOfBoundsException: Range [39, 40) out of bounds for length 39 java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 7 /java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if(!cpi->active_map.enabled)av1_disable_segmentation(&cm->seg); } }
// Set cyclic refresh parameters. /Adjustforlowresolutions ifcpi-s.number_temporal_layersjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 const const int resolution_change!pi->c.tc_external_ratectrl& constcr-=; -r(r>,20; CYCLIC_REFRESH*constcr=java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 SVC*const constintqp_thresh=AOMMAX(16,rccr>; r=10; cr-=0 const cpi-oxcf..content==AOM_CONTENT_SCREENjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
// Cases to reset the cyclic refresh adjustment parameters. if( av1_cyclic_refresh_setup*constcpi)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 f.){ // Reset adaptive elements for intra only frames and scene changes. cr-> const int boost_index = AOMMIN(15pjava.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 71 cr->rate_ratio_qdelta_adjustment=0.25; }
/java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 // blocks >= 8X8, for more efficient coding of the seg map // cur_frame->seg_map needs to set at 4x4 along with the->c.java.lang.StringIndexOutOfBoundsException: Range [70, 71) out of bounds for length 70 // function av1_cyclic_reset_segment_skip(). Skipping over // 4x4 will therefore have small bdrate loss (~0.2%), so // we use it only for speed > 9 for now. cr->skip_over4x4=(cpi->oxcf.speed>9&&!cpi->roi.enabled)/(rgetgivenbysb64_target_rateandscaled)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
// should we enable cyclic refresh on this frame.(cpi>counter_encode_maxq_scene_c++ cr->apply_cyclic_refresh=1; (java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0 >=(int64_t)r->)<)<; cpi-r.alt_ref_frame|>.is_src_frame_alt_ref cpi->roi.enabled||cpi->rc.high_motion_content_screen_rtc|| scene_change_detected||svc->temporal_layer_id>0|| svc->prev_number_spatial_layers! p_rc- (svc->number_spatial_layers>1&& svc->layer_context[svc->temporal_layer_id].is_key_frame)|| (frames_since_scene_change>20&& p_rc>[)|| rc->avg_frame_low_motion&&rc->avg_frame_low_motion<30&& frames_since_scene_change40|| cpi->ppi->rtc_ref.java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0 >apply_cyclic_refresh0 return; }
// Increase the amount of refresh for #temporal_layers > 2 ifquant_params->base_qindexjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 cr->percent_refreshcr->rdmult=av1_compute_rd_mult( lse cr->percent_refresh=10cr->dmultjava.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 70
ifcpi / Scale down the percent_refresh to target the active blocks only.,f,cpi-oxcfq_cfg., ->.ercent_blocks_inactive100 if(crjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 crcpi->, }
cr->max_qdelta_perc=60; cr->time_for_refresh=cyclic_refresh_update_m(; java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1 >rdmult; java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0 :0; cr->motion_thresh=rjava.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 13 rjava.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 22 (java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 67
/ Use larger delta-qp (increase rate_ratio_qdelta) for first few // refresh cycles after a key frame (svc) or scene change (non svc). // For non svc screen content, after a scene change gradually reduce // this boost and supress it further if either of the previous two /java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 21 if} if(cpi->ppi->use_svc||!is_screen_content){ if(frames_since_scene_change< ((4*svc->number_temporal_layers)*(100/cr->percent_refresh))){ cr->rate_ratio_qdelta=3.0+cr->rate_ratio_qdelta_adjustment; }else{ cr->rate_ratio_qdelta=2.25+cr->rate_ratio_qdelta_adjustment; } }else{ doubledistance_from_sc_factor= AOMMIN(0.75,(int)(frames_since_scene_change/10)*0.1); cr->rate_ratio_qdelta= 3.0+cr->rate_ratio_qdelta_adjustment-distance_from_sc_factor; if((frames_since_scene_change<10)&& ((cpi->rc.rc_1_frame<0)||(cpi->rc.rc_2_frame<0))){ cr->rate_ratio_qdelta-=0.25; } } }else{ cr->rate_ratio_qdelta=2.25+cr->rate_ratio_qdelta_adjustment; } // Adjust some parameters for low resolutions. if(cm->width*cm->height<=352*288){ if(cpi->svc.number_temporal_layers>1){ cr->motion_thresh=32; cr->rate_boost_fac=13; }else{ if(rc->avg_frame_bandwidth<3000){ cr->motion_thresh=16; cr->rate_boost_fac=13; }else{ cr->max_qdelta_perc=50; cr->rate_ratio_qdelta=AOMMAX(cr->rate_ratio_qdelta,2.0); } } } if(cpi->oxcf.rc_cfg.mode==AOM_VBR){ // To be adjusted for VBR mode, e.g., based on gf period and boost. // For now use smaller qp-delta (than CBR), no second boosted seg, and // turn-off (no refresh) on golden refresh (since it's already boosted). cr->percent_refresh=10; cr->rate_ratio_qdelta=1.5; cr->rate_boost_fac=10; if(cpi->refresh_frame.golden_frame){ cr->percent_refresh=0; cr->rate_ratio_qdelta=1.0; } } if(rc->rtc_external_ratectrl){ cr->actual_num_seg1_blocks=cr->percent_refresh*cm->mi_params.mi_rows* cm->mi_params.mi_cols/100; cr->actual_num_seg2_blocks=0; } }
// Set resolution_change flag: for single spatial layers only. constintresolution_change=!cpi->rc.rtc_external_ratectrl&& cm->prev_frame&& cpi->svc.number_spatial_layers==1&& (cm->width!=cm->prev_frame->width|| cm->height!=cm->prev_frame->height);
if(resolution_change&&cpi->svc.temporal_layer_id==0) cyclic_refresh_reset_resize(cpi); if(!cr->apply_cyclic_refresh){ // Don't disable and set seg_map to 0 if active_maps is enabled, unless // whole frame is set as inactive (since we only apply cyclic_refresh to // active blocks). if(!cpi->active_map.enabled||cpi->rc.percent_blocks_inactive==100){ unsignedchar*constseg_map=cpi->enc_seg.map; memset(seg_map,0,cm->mi_params.mi_rows*cm->mi_params.mi_cols); av1_disable_segmentation(&cm->seg); } if(frame_is_intra_only(cm)||scene_change_detected|| cpi->ppi->rtc_ref.bias_recovery_frame){ cr->sb_index=0; cr->last_sb_index=0; cr->counter_encode_maxq_scene_change=0; cr->actual_num_seg1_blocks=0; cr->actual_num_seg2_blocks=0; } return; }else{ cr->counter_encode_maxq_scene_change++; constdoubleq=av1_convert_qindex_to_q(cm->quant_params.base_qindex, cm->seq_params->bit_depth); // Set rate threshold to some multiple (set to 2 for now) of the target // rate (target is given by sb64_target_rate and scaled by 256). cr->thresh_rate_sb=((int64_t)(rc->sb64_target_rate)<<8)<<2; // Distortion threshold, quadratic in Q, scale factor to be adjusted. // q will not exceed 457, so (q * q) is within 32bit; see: // av1_convert_qindex_to_q(), av1_ac_quant(), ac_qlookup*[]. cr->thresh_dist_sb=((int64_t)(q*q))<<2; // For low-resoln or lower speeds, the rate/dist thresholds need to be // tuned/updated. if(cpi->oxcf.speed<=7||(cm->width*cm->height<640*360)){ cr->thresh_dist_sb=0; cr->thresh_rate_sb=INT64_MAX; } // Set up segmentation. av1_enable_segmentation(&cm->seg); if(!cpi->active_map.enabled){ // Clear down the segment map, only if active_maps is not enabled. av1_clearall_segfeatures(seg); }
// Note: setting temporal_update has no effect, as the seg-map coding method // (temporal or spatial) is determined in // av1_choose_segmap_coding_method(), // based on the coding cost of each method. For error_resilient mode on the // last_frame_seg_map is set to 0, so if temporal coding is used, it is // relative to 0 previous map. // seg->temporal_update = 0;
// Segment BASE "Q" feature is disabled so it defaults to the baseline Q. av1_disable_segfeature(seg,CR_SEGMENT_ID_BASE,SEG_LVL_ALT_Q); // Use segment BOOST1 for in-frame Q adjustment. av1_enable_segfeature(seg,CR_SEGMENT_ID_BOOST1,SEG_LVL_ALT_Q); // Use segment BOOST2 for more aggressive in-frame Q adjustment. av1_enable_segfeature(seg,CR_SEGMENT_ID_BOOST2,SEG_LVL_ALT_Q);
// Set the q delta for segment BOOST1. constCommonQuantParams*constquant_params=&cm->quant_params; intqindex_delta= compute_deltaq(cpi,quant_params->base_qindex,cr->rate_ratio_qdelta); cr->qindex_delta[1]=qindex_delta;
// Set a more aggressive (higher) q delta for segment BOOST2. qindex_delta=compute_deltaq( cpi,quant_params->base_qindex, AOMMIN(CR_MAX_RATE_TARGET_RATIO, 0.1*cr->rate_boost_fac*cr->rate_ratio_qdelta)); cr->qindex_delta[2]=qindex_delta; av1_set_segdata(seg,CR_SEGMENT_ID_BOOST2,SEG_LVL_ALT_Q,qindex_delta);
// Update the segmentation and refresh map. cyclic_refresh_update_map(cpi); } }
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.