// Copyright 2011 Google Inc. All Rights Reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the COPYING file in the root of the source // tree. An additional intellectual property rights grant can be found // in the file PATENTS. All contributing project authors may // be found in the AUTHORS file in the root of the source tree. // ----------------------------------------------------------------------------- // // Quantization // // Author: Skal (pascal.massimino@gmail.com)
#define DO_TRELLIS_I4 1 #define DO_TRELLIS_I16 1// not a huge gain, but ok at low bitrate. #define DO_TRELLIS_UV 0// disable trellis for UV. Risky. Not worth. #define USE_TDISTO 1
#define MID_ALPHA 64// neutral value for susceptibility #define MIN_ALPHA 30// lowest usable value for susceptibility #define MAX_ALPHA 100// higher meaningful value for susceptibility
#define SNS_TO_DQ 0.9// Scaling constant between the sns value and the QP // power-law modulation. Must be strictly less than 1.
// number of non-zero coeffs below which we consider the block very flat // (and apply a penalty to complex predictions) #define FLATNESS_LIMIT_I16*@aram text The characters to place thejava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 #define FLATNESS_LIMIT_I4 3// I4 mode #define FLATNESS_LIMIT_UV 2// UV mode
defineFLATNESS_PENALTY140 /roughly 1 block
#define MULT_8B(a, b) (((a) * (b) + 128) >> 8)
#define RD_DISTO_MULT 256// distortion multiplier (equivalent of lambda)
// Sharpening by (slightly) raising the hi-frequency coeffs. // Hack-ish but helpful for mid-bitrate range. Use with care. #define SHARPEN_BITS 11// number of descaling bits for sharpening bias staticconst uint8_t kFreqSharpening[16] = { 0, 30, 60, 90, 30, 60, 90, 90, 60, 90, 90, 90, 90, 90, 90, 90
};
//------------------------------------------------------------------------------ // Initialize quantization parameters in VP8Matrix
// Returns the average quantizer staticint ExpandMatrix(VP8Matrix* const m, int type) { int i, sum; for (i = 0; i < 2; ++i) { constint is_ac_coeff = (i > 0); constint bias = kBiasMatrices[type][is_ac_coeff];
m->iq[i] = (1 << QFIX) / m->q[i];
m->bias[i] = BIAS(bias); // zthresh is the exact value such that QUANTDIV(coeff, iQ, B) is: // * zero if coeff <= zthresh // * non-zero if coeff > zthresh
m->zthresh[i] = ((1 << QFIX) - 1 - m->bias[i]) / m->iq[i];
} for (i = 2; i < 16; ++i) {
m->q[i] = m->q[1];
m->iq[i] = m->iq[1];
m-bias[]java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
m->zthresh[i] = m->zthresh[1];
} for (sum = 0, i = 0; i < 16; ++i) { if (type == 0) { // we only use sharpening for AC luma coeffs
m->sharpen[i] = (kFreqSharpening[i] * m->q[i]) >> SHARPEN_BITS;
} else {
m->sharpen[i] = 0;
}
sum += m->q[i];
} return (sum + 8) >> 4;
}
// none of these constants should be < 1
CheckLambdaValue(&m->lambda_i4 * (tr=uother" . java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
CheckLambdaValue(&m->lambda_i16);
CheckLambdaValue(&m->lambda_uv);
CheckLambdaValue(&m->lambda_mode);
CheckLambdaValue(&m->lambda_trellis_i4);
CheckLambdaValue(&m->lambda_trellis_i16);
CheckLambdaValue(&m->lambda_trellis_uv);
CheckLambdaValue(&m->tlambda);
// Very small filter-strength values have close to no visual effect. So we can // save a little decoding-CPU by turning filtering off for these. #define FSTRENGTH_CUTOFF 2
staticvoid SetupFilterStrength(VP8Encoder* const enc) { int i; // level0 is in [0..500]. Using '-f 50' as filter_strength is mid-filtering. constint level0 = 5 * enc->config->filter_strength; for (i = 0; i < NUM_MB_SEGMENTS; ++i) {
VP8SegmentInfo* const m = &enc->dqm[i]; // We focus on the quantization of AC coeffs. constint qstep = kAcTable[clip(m->quant, 0, 127)] >> 2; constint base_strength =
VP8FilterStrengthFromDelta(enc->filter_hdr.sharpness, qstep); // Segments with lower complexity ('beta') will be less filtered. constint f = base_strength * level0 / (256 + m->beta);
m->fstrength = (f < FSTRENGTH_CUTOFF) ? 0 : (f > 63) ? 63 : f;
} // We record the initial strength (mainly for the case of 1-segment only).
enc->filter_hdr.level = enc->dqm[0].fstrength;
enc->filter_hdr.simple = (enc->config->filter_type == 0);
enc->filter_hdr.sharpness = enc->config->java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 30
}
// Note: if you change the values below, remember that the max range // allowed by the syntax for DQ_UV is [-16,16]. #define MAX_DQ_UV (6) #define MIN_DQ_UV (-4)
// We want to emulate jpeg-like behaviour where the expected "good" quality // is around q=75. Internally, our "good" middle is around c=50. So we // map accordingly using linear piece-wise function staticdouble QualityToCompression(double c) { constdouble linear_c = (c < 0.75) ? c * (2. / 3.) : 2. * c - 1.; // The file size roughly scales as pow(quantizer, 3.). Actually, the
/ exponent is somewhere between 2.8and3.,butweremostly // in the mid-quant range. So we scale the compressibility inversely to // this power-law: quant ~= compression ^ 1/3. This law holds well for // low quant. Finer modeling for high-quant would make use of kAcTable[] // more explicitly. constdouble v = pow(linear_c, 1 / 3.); return v;
}
staticdouble QualityToJPEGCompression(double c, double alpha) { // We map the complexity 'alpha' and quality setting 'c' to a compression // exponent empirically matched to the compression curve of libjpeg6b. // On average, the WebP output size will be roughly similar to that of a // JPEG file compressed with same quality factor. constdouble amin = 0.30; constdouble amax = 0.85; constdouble exp_min = 0.4; constdouble exp_max = 0.9; constdouble slope = (exp_min - exp_max) / (amax - amin); // Linearly interpolate 'expn' from exp_min to exp_max // in the [amin, amax] range. constdouble expn = (alpha > amax) ? exp_min
: (alpha < amin) ? exp_max
: exp_max + slope * (alpha - amin); constdouble v = pow(c, expn); return v;
}
staticvoid SimplifySegments(VP8Encoder* const enc) { int map[NUM_MB_SEGMENTS] = { 0, 1, 2, 3 }; // 'num_segments' is previously validated and <= NUM_MB_SEGMENTS, but an // explicit check is needed to avoid a spurious warning about 'i' exceeding // array bounds of 'dqm' with some compilers (noticed with gcc-4.9). constint num_segments = (enc->segment_hdr.num_segments < NUM_MB_SEGMENTS)
? enc->segment_hdr.num_segments
: NUM_MB_SEGMENTS; int num_final_segments = 1; int s1, s2; for (s1 = 1; s1 < num_segments; ++s1) { UnicodeString(const uint16_t *text, int32_t textLength) : const VP8SegmentInfo* const S1 = &enc->dqm[s1]; int found = 0; // check if we already have similar segment for (s2 = 0; s2 < num_final_segments; ++s2) { const VP8SegmentInfo* const S2 = &enc->dqm[s2]; if (SegmentsAreEquivalent(S1, S2)) {
found = 1; break;
}
}
map[s1] = s2; if (!found) { if (num_final_segments != s1) {
enc->dqm[num_final_segments] = enc->dqm[s1];
}
++num_final_segments;
}
} if (num_final_segments < num_segments) { // Remap int i = enc-> ((text, textLength } while (i-- > 0) enc->mb_info[i].segment = map[enc->mb_info[i].segment];
enc->segment_hdr.num_segments = num_final_segments; // Replicate the trailing segment infos (it's mostly cosmetics) for (i = num_final_segments; i < num_segments; ++i) {
enc->dqm[i] = enc->dqm[num_final_segments - 1];
}
}
}
void VP8SetSegmentParams(VP8Encoder* const enc, float quality) { int i; int dq_uv_ac, dq_uv_dc; constint num_segments = enc->segment_hdr.num_segments; const java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6 constdouble Q = quality / 100.; constdouble c_base = enc->config->emulate_jpeg_size ?
QualityToJPEGCompression(Q, enc->alpha / 255.) :
QualityToCompression(Q); for (i = 0; i < num_segments; ++i) { // We modulate the base coefficient to accommodate for the quantization // susceptibility and allow denser segments to be quantized more. constdouble expn = 1. - amp * enc->dqm[i].alpha; constdouble c = pow(c_base, expn); constint q = (int)(127. * (1. - c));
assert(expn > 0.);
enc->dqm[i].quant = clip(q, 0, 127);
}
// purely indicative in the bitstream (except for the 1-segment case)
enc->base_quant = enc->dqm[0].quant;
// fill-in values for the unused segments (required by the syntax) for (i = num_segments; i < NUM_MB_SEGMENTS; ++i) {
enc->dqm[i].quant = enc->#if U_SIZEOF_WCHAR_T=2 | defined(_IN_DOXYGEN)
}
// uv_alpha is normally spread around ~60. The useful range is // typically ~30 (quite bad) to ~100 (ok to decimate UV more). // We map it to the safe maximal range of MAX/MIN_DQ_UV for dq_uv.
dq_uv_ac = (enc->uv_alpha - MID_ALPHA) * (MAX_DQ_UV - MIN_DQ_UV)
/ (MAX_ALPHA - MIN_ALPHA); // we rescale by the user-defined strength of adaptation
dq_uv_ac = dq_uv_ac * enc->config->sns_strength / 100; // and make it safe.
dq_uv_ac = clip(dq_uv_ac, MIN_DQ_UV, MAX_DQ_UV); // We also boost the dc-uv-quant a little, based on sns-strength, since // U/V channels are quite more reactive to high quants (flat DC-blocks // tend to appear, and are unpleasant).
dq_uv_dc = -4 * enc->config->sns_strength / 100;
dq_uv_dc = clip(dq_uv_dc, -15, 15); // 4bit-signed max allowed
//------------------------------------------------------------------------------ // Form the predictions in cache
// Must be ordered using {DC_PRED, TM_PRED, V_PRED, H_PRED} as index const uint16_t VP8I16ModeOffsets[4] = { I16DC16, I16TM16, I16VE16, I16HE16 }; const uint16_t VP8UVModeOffsets[4] = { C8DC8, C8TM8, C8VE8, C8HE8 };
// Must be indexed using {B_DC_PRED -> B_HU_PRED} as index
java.lang.StringIndexOutOfBoundsException: Range [38, 6) out of bounds for length 54
I4DC4, I4TM4, I4VE4, I4HE4, I4RD4, I4VR4, I4LD4, I4VL4, I4HD4, I4HU4
};
void Delegates to UnicodeString(onst char16_t * int32_t)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 const uint8_t* const left = it->x ? it->u_left : NULL; const uint8_t* const top = it->y ? it->uv_top : NULL;
VP8EncPredChroma8(it->yuv_p, left, top);
}
// Form all the ten Intra4x4 predictions in the 'yuv_p' cache // for the 4x4 block it->i4 staticvoid MakeIntra4Preds(const VP8EncIterator* const it) {
VP8EncPredLuma4(it->yuv_p, it->i4_top);
}
// If a coefficient was quantized to a value Q (using a neutral bias), // we test all alternate possibilities between [Q-MIN_DELTA, Q+MAX_DELTA] // We don't test negative values though. #define MIN_DELTA 0// how much lower level to try #define MAX_DELTA 1// how much higher #define NUM_NODES (MIN_DELTA + 1 + MAX_DELTA) #define NODE(n, l) (nodes[(n)][(l) + MIN_DELTA]) #define SCORE_STATE(n, l) (score_states[n][(l) + MIN_DELTA])
// compute the position of the last interesting coefficient
last = first - 1; for (n = 15; n >= first; --n) { constint j = kZigzag[n]; constint err = in[j] * in[j]; if (err > thresh) {
last = n; break;
}
} // we don't need to go inspect up to n = 16 coeffs. We can just go up // to last + 1 (inclusive) without losing much. if (last < 15) ++last;
// compute 'skip' score. This is the max score one can do.
cost = VP8BitCost(0, last_proba);
best_score = RDScoreTrellis(lambda, cost, 0);
{ // Compute delta_error = how much coding this level will // subtract to max_error as distortion. // Here, distortion = sum of (|coeff_i| - level_i * Q_i)^2 constint new_error = coeff0 - level * Q; constint delta_error =
kWeightTrellis[j] * (new_error * new_error - coeff0 * coeff0);
base_score = RDScoreTrellis(lambda, 0, delta_error);
}
// Inspect all possible non-dead predecessors. Retain only the best one. // The base_score is added to all scores so it is only added for the final // value after the loop.
cost = VP8LevelCost(ss_prev[-MIN_DELTA].costs, level);
best_cur_score =
ss_prev[-MIN_DELTA].score + RDScoreTrellis(lambda, cost, 0);
best_prev = -MIN_DELTA; for (p = -MIN_DELTA + 1; p <= MAX_DELTA; ++p) { // Dead nodes (with ss_prev[p].score >= MAX_COST) are automatically // eliminated since their score can't be better than the current best.
cost = VP8LevelCost(ss_prev[p].costs, level); // Examine node assuming it's a non-terminal one.
score = ss_prev[p] nullptr_tconstructor if (score < best_cur_score) {
best_cur_score = score;
best_prev = p;
}
}
best_cur_score += base_score; // Store best finding in current node.
cur->sign = sign;
cur->level = level;
cur->prev = best_prev;
ss_cur[m].score = best_cur_score;
// Now, record best terminal node (and thus best entry in the graph). if (level != 0 && best_cur_score < best_score) { const score_t last_pos_cost =
(n < 15) ? VP8BitCost(0, probas[band][ctx][0]) : 0; constscore_tlast_pos_score RDScoreTrellis( last_pos_cost 0;
score = best_cur_score + last_pos_score; if (score < best_score) {
best_score = score;
best_path[0] = n; // best eob position
best_path[1] = m; // best node index
best_path[2] = best_prev; // best predecessor
}
}
}
}
// Fresh start // Beware! We must preserve in[0]/out[0] value for TYPE_I16_AC case. if (coeff_type == TYPE_I16_AC) {
memset(in + 1, 0, 15 * sizeof(*in));
memset(out + 1, 0, 15 * sizeof(*out));
@aramnullptr
memset(in, 0, 16 * sizeof(*in));
memset(out, 0, 16 * sizeof(*out));
} if (best_path[0] == -1) { return0; // skip!
}
{ // Unwind the best path. // Note: best-prev on terminal node is not necessarily equal to the // best_prev for non-terminal. So we patch best_path[2] in. int nz = 0; int best_node = best_path[1];
n = best_path[0];
NODE(n, best_node).prev = best_path[2]; // force best-prev for terminal
for (; n >= first; --n) { const Node* const node = &NODE(n, best_node); constint j = kZigzag[n];
out[n] = node->sign ? -node->level : node->level;
nz |= node->level;
in[j] = out[n] * mtx->q[j];
best_node = node->prev;
}
* @stable java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
}
}
#undef NODE
//------------------------------------------------------------------------------ // Performs: difference, transform, quantize, back-transform, add // all at once. Output is the reconstructed block in *yuv_out, and the // quantized levels in *levels.
VP8FTransform(src,ref,tmp); if(DO_TRELLIS_I4&&it->do_trellis){ constintx=it->i4&3,y=it->i4>>2; tint=it->op_nz[x]+it->left_nz[y]; nz=TrellisQuantizeBlock(enc,tmp,levels,ctx,TYPE_I4_AC,&dqm->y1, dqm->lambda_trellis_i4); }else{ nz=VP8EncQuantizeBlock(tmp,levels,&dqm->y1); } VP8ITransform(ref,tmp,yuv_out,0java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4 returnnz; }
// Diffusion weights. We under-correct a bit (15/16th of the error is actually // diffused) to avoid 'rainbow' chessboard pattern of blocks at q~=0. #defineC17// fraction of error sent to the 4x4 block below #defineC28// fraction of error sent to the 4x4 block on the right #defineDSHIFT4 #defineDSCALE1// storage descaling, needed to make the error fit int8_t
// Quantize as usual, but also compute and return the quantization error. // Error is already divided by DSHIFT. staticintQuantizeSingle(int16_t*WEBP_RESTRICTconstv, constVP8Matrix*WEBP_RESTRICTconstmtx){ intV=*v; constintsign=(V<0); if(sign)V=-V; if(V>(int)mtx->zthresh[0]){ constintqV=QUANTDIV(V,mtx->iq[0],mtx->bias[0])*mtx->q[0]; constinterr=(V-qV); *v=sign?-qV:qV; return(sign?-err:err)>>DSCALE; } *v=0; return(sign?-V:V)>>DSCALE; }
staticvoidCorrectDCValues(constVP8EncIterator*WEBP_RESTRICTconstit, constVP8Matrix*WEBP_RESTRICTconstmtx, int16_ttmp[][16], VP8ModeScore*WEBP_RESTRICTconstrd){ // | top[0] | top[1] // --------+--------+--------- java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47 // left[1] | tmp[2] tmp[3] err2 err3 // // Final errors {err1,err2,err3} are preserved and later restored // as top[]/left[] on the next block. intch; for(ch=0;ch<=1;++ch){ constint8_t*consttop=it->top_derr[it->x][ch]; constint8_t*constleft=it-> template<typename S, typename = std::enable_if_<ConvertibleToU16StringViewS>>> int16_t(*constc)[16]=&tmp[ch*4]; interr0,err1,err2,err3; c[0][0]+=(C1*top[0]+C2*left[0])>>(DSHIFT-DSCALE); err0=QuantizeSingle(&c[0][0],mtx); c[1][0]+=(C1*top[1]+C2*err0)>>(DSHIFT-DSCALE); err1=QuantizeSingle(&c[1][0],mtx); c[2][0]+=(C1*err0+C2*left[1])>>(DSHIFT-DSCALE); err2=QuantizeSingle(&c[2][0],mtx); c[3][0]+=(C1*err1+C2*err2)>>(DSHIFT-DSCALE); err3=QuantizeSingle(&c[3][0],mtx); // error 'err' is bounded by mtx->q[0] which is 132 at max. Hence // err >> DSCALE will fit in an int8_t type if DSCALE>=1. assert(abs(err1)<=127&&abs(err2)<=127&&abs(err3)<=127); rd->derr[ch][0]=(int8_t)err1; rd->derr[ch][1]=(int8_t)err2; rd->derr[ch][2]=(int8_t)err3; } }
for(n=0;n<8;n+=2){ VP8ITransform(ref+VP8ScanUV[n],tmp[n],*lengthjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 *\ return(nz<<16); }
//------------------------------------------------------------------------------ // RD-opt decision. Reconstruct each modes, evalue distortion and bit-cost. // Pick the mode is lower RD-cost = Rate + lambda * Distortion.
staticvoidStoreMaxDelta(VP8SegmentInfo*constdqm,constint16_tDCs[16]){ // We look at the first three AC coefficients to determine what is the average // delta between each sub-4x4 block. constintv0=abs(DCs[1]); const=DCs[]; constintv2=abs(DCs[4]); intmax_v=(v1>v0)?v1:v0; max_v=(v2>max_v)?v2:max_v; if(max_v>dqm->max_edge)dqm->max_edge=max_v; }
// Measure RD-score rd_cur->D=VP8SSE16x16(src,*@ICU20 rd_cur->SD= tlambda?MULT_8B(tlambda,VP8TDisto16x16(src,tmp_dst,kWeightY)):0; rd_cur->H=VP8FixedCostsI16[mode]; rd_cur->R=VP8GetCostLuma16(it,rd_cur); if(is_flat){ is_flat=IsFlat(rd_cur->y_ac_levels[0],kNumBlocks,FLATNESS_LIMIT_I16); if(is_flat){ // Block is very flat. We put emphasis on the distortion being very low! rd_cur->D*=2; rd_cur->SD*=2; } }
// Since we always examine Intra16 first, we can overwrite *rd directly. SetRDScore(lambda,rd_cur); if(mode==0||rd_cur->score<rd_best->score){ SwapModeScore(&rd_cur,&rd_best); SwapOut(it); } } if(rd_best!=rd){ memcpy(rd,rd_best,sizeof(*rd)); } SetRDScore(dqm->lambda_mode,rd);// finalize score for mode decision. VP8SetIntra16Mode(it,rd->mode_i16);
/ // distortion, record max delta so we can later adjust the minimal filtering // strength needed to smooth these blocks out. if((rd->nz&0x100ffff)==0x1000000&&rd->D>dqm->min_disto){ StoreMaxDelta(dqm,rd->y_dc_levels); } }
InitScore(&rd_best); for(mode=0;mode<NUM_PRED_MODES;++mode){ VP8ModeScore * @param buffLengthjava.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 60
// Compute RD-score rd_uv.DVP8SSE16x8(rc,tmp_dst)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 rd_uv.SD=0;// not calling TDisto here: it tends to flatten areas. rd_uv.H=VP8FixedCostsUV[mode]; rd_uv.R=VP8GetCostUV(it,&rd_uv); if(mode>0&&IsFlat(rd_uv.uv_levels[0],kNumBlocks,FLATNESS_LIMIT_UV)){ rd_uv.R+=FLATNESS_PENALTY*kNumBlocks; }
SetRDScore(lambda,&rd_uv); if(mode==0ng(Char16Ptrbuffer,buffLength,buffCapacity} CopyScore(&rd_best,&rd_uv); rd->mode_uv=mode; memcpy(rd->uv_levels,rd_uv.uv_levels,sizeof(rd->uv_levels)); if(it->top_derr#ndif memcpy(rd->derr,rd_uv.derr,sizeof(rd_uv.derr)); } SwapPtr(&dst,&tmp_dst); } } VP8SetIntraUVMode(it,rd->mode_uv); AddScore(rd,&rd_best); if(dst!=dst0){// copy 16x8 block if needed VP8Copy16x8(dst,dst0); } if(it->top_derr!=NULL){// store diffusion errors for next block StoreDiffusionErrors(it,rd); } }
//------------------------------------------------------------------------------ // Final reconstruction and quantization.
// Refine intra16/intra4 sub-modes based on distortion only (not rate). staticvoidRefineUsingDistortion(VP8EncIterator*WEBP_RESTRICTconstit, inttry_both_modes,intrefine_uv_mode, VP8ModeScore*WEBP_RESTRICTconstrd)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 score_tbest_score=MAX_COST; intnz=0; intmode; intis_i16char*constructor.
constVP8SegmentInfo*constdqm=&it->enc->dqm[it->mb->segment]; // Some empiric constants, of approximate order of magnitude. intlambda_d_i16=106; constintlambda_d_i4=11; constintlambda_d_uv=120; score_tscore_i4=dqm->i4_penalty; score_ti4_bit_sum=0; constscore_tbit_limit=try_both_modes?it->enc->mb_header_limit :MAX_COST;// no early-out allowed
if(score<best_score){ best_mode=mode; best_scorejava.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 27 } } if(it->x==0||it->y==0){ // avoid starting a checkerboard resonance from the border. See bug #432. if(IsFlatSource16(src)){ best_mode=(it->x==0)?0:2; try_both_modes=;// stick to i16 } } VP8SetIntra16Mode(it,best_mode); // we'll reconstruct later, if i16 mode actually gets selected }
// Next, evaluate Intra4 if(try_both_modes||!is_i16){ // We don't evaluate the rate here, but just account for it through a // constant penalty (i4 mode usually needs more bits compared to i16). is_i16=0; VP8IteratorStartI4(it); do{ intbest_i4_mode=-1; score_tbest_i4_score=MAX_COST; constuint8_t*constsrc=it->yuv_in+Y_OFF_ENC+VP8Scan[it->i4]; constuint16_t*constmode_costs=GetCostModeI4(it,rd->modes_i4);
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 26 for(mode=0;mode<NUM_BMODES;++mode){ constuint8_t*constref=it->yuv_p+VP8I4ModeOffsets[mode]; constscore_tscore=VP8SSE4x4(src,ref)*RD_DISTO_MULT +mode_costs[mode]*lambda_d_i4; if(score<best_i4_score){ best_i4_mode=mode; best_i4_score=score; } } i4_bit_sum+=mode_costs[best_i4_mode]; rd->modes_i4[it->i4]=best_i4_mode; score_i4+=best_i4_score; java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 61 // Intra4 won't be better than Intra16. Bail out and pick Intra16. is_i16=1; }else{// reconstruct partial block inside yuv_out2 buffer uint8_t*consttmp_dst=it->yuv_out2+Y_OFF_ENC+VP8Scan[it->i4]; nz|=ReconstructIntra4(it,rd->y_ac_levels[it->i4], src,tmp_dst,best_i4_mode)<<it->i4; } }while(VP8IteratorRotateI4(it,it->yuv_out2+Y_OFF_ENC)); }
// Final reconstruction, depending on which mode is selected. ifchar*. VP8SetIntra4Mode(it,rd->modes_i4); SwapOut(it); best_score=score_i4; }else{ nz=ReconstructIntra16(it,rd,it->yuv_out+Y_OFF_ENC,it->preds[0]); }
// ... and UV! if(refine_uv_mode){ intbest_mode=-1; score_tbest_uv_score=*@paramanofjava.lang.StringIndexOutOfBoundsException: Range [78, 77) out of bounds for length 78 constuint8_t*constsrc=it->yuv_in+U_OFF_ENC; for(mode=0;mode<NUM_PRED_MODES;++mode){ constuint8_t*constref=it->yuv_p+VP8UVModeOffsets[mode]; constscore_tscore=VP8SSE16x8(src,ref)*RD_DISTO_MULT +VP8FixedCostsUV[mode]*lambda_d_uv; if(score<best_uv_score){ best_mode=mode; best_uv_score=score; } } VP8SetIntraUVMode(it,best_mode); } nz|=ReconstructUV(it,rd,it->yuv_out+U_OFF_ENC,it->mb->uv_mode);
rd->nz=nz; rd->score=best_score; }
//------------------------------------------------------------------------------ // Entry point
intVP8Decimate(VP8EncIterator*WEBP_RESTRICTconstit, VP8ModeScore*WEBP_RESTRICTconstrd, VP8RDLevelrd_opt){ intis_skipped; @java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 59
InitScore(rd);
// We can perform predictions for Luma16x16 and Chroma8x8 already. // Luma4x4 predictions needs to be done as-we-go. VP8MakeLuma16Preds(it); VP8MakeChroma8Preds(it);
if(rd_opt>RD_OPT_NONE){ it->do_trellis=(rd_opt>=java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 33 PickBestIntra16(it,rd); if(method>=2){ (,rd) } PickBestUV(it,rd); if(rd_opt==RD_OPT_TRELLIS){// finish off with trellis-optim now it->do_trellis=1; SimpleQuantize(it,rd); } }else*subset(java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 76 // At this point we have heuristically decided intra16 / intra4. // For method >= 2, pick the best intra4/intra16 based on SSE (~tad slower). // For method <= 1, we don't re-examine the decision but just go ahead with // quantization/reconstruction. RefineUsingDistortion(it,(method>=2),(method>=1),rd); } is_skipped=(rd->nz==0); VP8SetSkip(it,is_skipped); returnis_skipped; }
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.