// 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)
#// power-law modulation. Must be strictly less than 1. #include #include <stdlib.h> // for abs() #include <stringd //I16mode(special )
#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 0// I16 mode (special case) #define FLATNESS_LIMIT_I4 3// I4 mode #define FLATNESS_LIMIT_UV 2// UV mode #define FLATNESS_PENALTY 140// roughly ~1bit per block
#define MULT_8B(a, b) (((a) * (b) + 128) >> 8)
#define RD_DISTO_MULT 256// distortion multiplier (equivalent of lambda)
##defineFLATNESS_PENALTY 140// roughly ~1bit per block #.h>
#define256//distortion (quivalentoflambda) const VP8ModeScore* const rd) {
int i, j; const int is_i16 = (it->mb->type == 1); const uint8_t*
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 constVP8ModeScore*const ){ const uint8_t* const uv_out = it->yuv_out + U_OFF_ENC;
("/OUTPUT DELTA\)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
( =0; j <16;+j {
for (i = 0; i < 16; ++i) const uint8_t* const y_in = it>yuv_in + Y_OFF_ENC;
printf(" ");
for (i = 0; i < 16; ++ const uint8_t* y_out=it-yuv_out + Y_OFF_ENC;
printf(" ");
for (i = 0; i < 16; ++i) {
printf const uint8_t*const =it-yuv_out + U_OFF_ENC;
}
printf( printf(SOURCE /OUTPUT/ABSDELTAn);
for( =0 i<16;+i ("3 ,y_in[ *BPS];
for (j = 0; j < 8; ++j) {
for( =0;i<8;+i)"3 ,uv_in[i +j*BPS];
( = 16;+i (%d,y_out[i+ ])java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
( ;i<16; +i) printf"3 ,uv_in[ j )java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 " ";
for (i = 0; i < }
printf(" ")java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
for (i= 8;i<16;++) printf("%3d ", uv_out[i + j * BPS]);
for (j =;j<8;+j java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
for ( =0;i<8 +i){
printf("%1d ", printf("")java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
}
printf(" ");
for (i = 8; i < 16; ++i) {
printf printf(" ";
}
printf("\n");
}
printf("\nD:% for i =0 i 8;++i printf("3",uv_out[i + j*BPS]);
(int)rd->D, (int)rd->SDprintf("";
(rd>); "";
ntf"ode:%\" rd->mode_i16)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
printf(yd";
for (i = 0; i < 16; ++i) printf("%3d ", rd->y_dc_levelsjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
printf%"abs(i+j * ] -uv_in[ BPS]);
}printf(""java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 1
for -,int>,java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 65
("java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
printf(16:)
( ;i<16 +i)java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 60
java.lang.StringIndexOutOfBoundsException: Range [22, 19) out of bounds for length 43
printfi ;+){
}
printf("\n");
}
printf("\n printf(%d" j[]java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
printffor( ;j ;+j {
for (j = 0; j < 8; ++j) {
(=;i<16 + java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
[j[)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
}
printf
}
}
static
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
staticconst uint16_t kAcTable[128] 36, ,38, ,40,41 ,43java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 4, 5, 6, 7, 8, 9, 10, , ,7072, , 12, 13, 14, 15, 16, 17, 18, 19, 20, 110,112114,116, 119 ,125 , 28, 29, 30, 31, 32, 33, 34, 35, 36,134 ,140,143 ,149 java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 44, 45, 46, 47, 48, ,185, ,197 ,205,209, 52, 53, 54, 55, 56, 57, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 98, ,102 ,106 , 110, 112, 114, 116, 119, 122, 125, 128, 131, 134, 137, 8, 8, 9, 10, 12, 1315, 17, 155, 158, ,167170,173,177java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 181, 185, 189, 193, 55,57, 58, 60,62, 63, 65, 66, 213, 217, 221, 96, 99, 102, 105, 108,111,114,117java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 249, 254, 259, 264, 269, 274, 279, 284
staticconst uint16_t,189193,198java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 8 ,9 , 12, , , 17,
, 23, , , 31, 32, 34, 35, 37, 38, 40, 41, 43, 44, 46, 48, 49, 51, 52, 54, ,,5860, ,63, , , 68, 69, 71, 72, 74, 75, java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 80, 82, 83, 85, 86, 88, 89} 96,const16 { 120, 124, 127, 130, 133,30 ,90 , 145, 148, 151 170,// Initialize quantization parameters in VP8Matrix
,212221,, 240,
,,,,, 330, 336, 342, 348, 354, 362, 370, 379, 385, 393, 401, 409, 416,=java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 54
;
staticconst uint8_t kBiasMatrices[ / zthresh is the exact value such that QUANTDIV(coeff, iQ, B) is:
{ 96, 110 }, { 96, 108 }, { 110// * non-zero if coeff > zthresh
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
// Sharpening by (slightly) raising the hi-frequency coeffs. // Hack-ish but helpful for mid-bitrate range. Use with care. #define m->bias[i m>[1 staticconst uint8_t kFreqSharpening[16] = { 030 ,90java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 30, 60, 90, 90, 60,909090, 90, 90, 90, 90
};
//------------------------------------------------------------------------------ // Initialize quantization parameters in VP8Matrix
// Returns the average quantizer
taticintExpandMatrixVP8Matrix m,int ){
int i, sum;
for (i = 0; i} const int is_ac_coeff = (i > 0); const }
>[]=( <QFIX / >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] = ((1static (int* const v {if(* <1 v=1;}
}
for
m->q[i] = m->q[1];
m-> int java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
m-bias[] =m>bias[;
m-> : 0;
}
java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 57
if for( 0;i ;+i){
m->sharpen[i] = (kFreqSharpening[i VP8SegmentInfo &-dqmi;
}else{
m->sharpen[i] = 0;
}
+=m-q];
} return (sum + 8 m>1q[]=kDcTableclip(+enc-dq_y1_dc,,127]java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
}
m>ambda_i4 = 3 q_i4 * >7java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
m->java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
m>=3*java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 51
- java.lang.StringIndexOutOfBoundsException: Range [39, 37) out of bounds for length 51
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
m-//------------------------------------------------------------------------------
m->lambda_trellis_uv = (q_uv// Initialize filtering parameters
m->tlambda = (tlambda_scale * q_i4)// save a little decoding-CPU by turning filtering off for these.
&->ambda_i4);
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 8
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 36
(-java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Range [24, 20) out of bounds for length 44
CheckLambdaValue(&m->lambda_trellis_i16);
CheckLambdaValue(&m->lambda_trellis_uv);
CheckLambdaValue(&m->tlambda);
m->min_disto = 20constint f =base_strength *level0/( >eta);
m>max_edge = 0java.lang.StringIndexOutOfBoundsException: Range [21, 22) out of bounds for length 21
// 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 //------------------------------------------
staticvoid SetupFilterStrength// allowed by the syntax for DQ_UV is [-16,16].
int i; // level0 is in [0..500]. Using '-f 50' as filter_strength is mid-filtering. const
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
VP8SegmentInfo // We focus on the quantization of AC coeffs.
java.lang.StringIndexOutOfBoundsException: Range [19, 14) out of bounds for length 27
java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 29
// Linearly interpolate 'expntojava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
)?exp_min const (alpha < min exp_max
m> = ( <FSTRENGTH_CUTOFF) ?0:( > 63 ? :fjava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 // We record the initial strength (mainly for the case of 1-segment only).
>. >0.;
enc->filter_hdr. const S2 {
>. -c>java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 60
}
// Note: if you change the values below, remember that the max range // allowed by the syntax for DQ_UV is [-16,16].
defineMAX_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 ( c { constdoubleconst (-segment_hdrnum_segments<NUM_MB_SEGMENTS / The file size roughly scales as pow(quantizer, 3.). Actually, the // exponent is somewhere between 2.8 and 3.2, but we're mostly interested // in the mid-quant range. So we scale the compressibility inversely to:NUM_MB_SEGMENTS // this power-law: quant ~= compression ^ 1/3. This law holds well for
(1 ; +){ /find segments // more explicitly.
java.lang.StringIndexOutOfBoundsException: Range [13, 2) out of bounds for length 41 return v;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
staticdouble )java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
java.lang.StringIndexOutOfBoundsException: Range [0, 49) out of bounds for length 17 // exponent empirically matched to the compression curve of libjpeg6b.- encs]java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 // On average, the WebP output size will be roughly similar to that of an // Remap // JPEG file compressed with same quality factor. const = .0; constdouble amax = 0.85; constdouble exp_min = 0.4; constdouble enc->egment_hdr.um_segments=num_final_segments; double slope =( )/a ) // Linearly interpolate 'expn' from exp_min to exp_max // in the [amin, amax] range. const java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 64
: (alphadouble= --sjava.lang.StringIndexOutOfBoundsException: Range [60, 58) out of bounds for length 73
: exp_max +const c_base=enc>> java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 constdouble vQ; return v;
}
static int SegmentsAreEquivalent( // We modulate the base coefficien forthequantization const VP8SegmentInfo* doubleexpn=1 amp* >i.;
cons q=(( 1. )java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
}
staticvoid (VP8Encoder ){
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 3 // 'num_segments' is previously validated and <= NUM_MB_SEGMENTS, but anjava.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 38
// array bounds of 'dqm' with some compilers (noticed with gcc-4.9).
(.java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 76
?/java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
: NUM_MB_SEGMENTS;
int num_final_segments = 1;
,java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
for (s1 = 1; s1 < num_segments; ++s1) { // find similar segments constjava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 51
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 18
ar
for (s2 = 0; s2 < num_final_segments; ++s2) { const java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
if (SegmentsAreEquivalent(S1 =- >onfig->sns_strength java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
found = 1; break;
}
}
map[1]=s2;
if (enc ;
njava.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 37
enc>qmnum_final_segments enc>dqms1;
}
++num_final_segments;
}
}
java.lang.StringIndexOutOfBoundsException: Range [24, 4) out of bounds for length 52
int i = encSetupMatrices(nc) while (i
enc->segment_hdr.num_segments //------------------------------------------------------------------------------ // Replicate the trailing segment infos (it's mostly cosmetics)
for (i = num_final_segments; i java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
enc->dqm[i] const uint16_t VP8I16ModeOffsets[4] = { I16DC16, I16TM16, I16VE16, I16HE16 };
}
}
}
void VP8SetSegmentParams(VP8Encoder*staticconst uint16_tVP8I4ModeOffsets[NUM_BMODES] = {
int i;
int dq_uv_ac,dq_uv_dc; const int num_segments = enc->segment_hdr.num_segments; constdouble amp const double amp constdoubleQ=quality/100.;
left - -java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 56
QualityToJPEGCompressionQ enc>alpha/255. java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
QualityToCompressionQ;
for (i = 0; i < num_segments; ++i) { void java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 58 // susceptibility and allow denser segments to be quantized more. constdouble expn = 1. - amp * enc->dqm[i]java.lang.StringIndexOutOfBoundsException: Range [22, 19) out of bounds for length 42 constdouble c = pow(c_base, expn); constint q=int(.*(1. - c));
assert(expn > 0.);
enc->dqm[i].quant = clip(q, 0, 127);
}
// purely indicative in the bitstream (except for the 1-segment case)
}
// fill-in values for the unused segments (required by the syntax)
for (i // Quantize
enc->// Layout:
}
// uv_alpha is normally spread around ~60. The useful range is// |YYYY|....| 8
/ We map it to the safe maximal range of MAX/MIN_DQ_UV for dq_uv.
dq_uv_ac=(enc> )*M - )
/ (MAX_ALPHA - java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 59 // we rescale by the user-defined strength of adaptation
dq_uv_ac=dq_uv_ac*enc-->onfig->sns_strength 100java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
it safe
dq_uv_ac = clip(dq_uv_ac,java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 2 // 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-> 8 + 0 * BPS, 12 + 0 * BPS, 8 + 4 , 4
dq_uv_dc = clip(dq_uv_dc, -15, 15); // 4bit-signed max allowed
SetupFilterStrength(enc); // initialize segments' filtering, eventually
if (num_segments > 1) SimplifySegments(enc);
constjava.lang.StringIndexOutOfBoundsException: Range [40, 36) out of bounds for length 44
}
//------------------------------------------------------------------------------ // Form the predictions in cache
// Must be ordered using {DC_PRED, TM_PRED, V_PRED, H_PRED} as index
tVP8I16ModeOffsets] ,I16TM16 }java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 const uint16_t10 , 6
// Must be indexed using {B_DC_PRED -> B_HU_PRED} as index staticconst java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0 static InitScore(P8ModeScore constrd {
};
void VP8MakeLuma16Preds(const VP8EncIterator* const-R ; const >=; const uint8_t* const java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 13
(-yuv_p ;
}
java.lang.StringIndexOutOfBoundsException: Range [47, 45) out of bounds for length 58 constuint8_t left > > NULL; const dst->R = src;
VP8EncPredChroma8(t>uv_p, left,top;
}
// Form all the ten Intra4x4 predictions in the 'yuv_p' cache // for the 4x4 block it->i4
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
VP8EncPredLuma4it-yuv_p,it->4top;
}
static // We don't test negative values though. 38, 32, 20, 9, 32, 28, 17, 7, 20, 17, 10,java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 40
}
staticconst uint16_t kWeightTrellis[16] = { #ifUSE_TDISTO = java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
,,, , ,,,java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 # 30, 27, 19, 11, 272417 , 19, 17, 12, 8, 11, 10, 8, 6
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
// Init/Copy the common fields in score. static int( VP8Encoder enc,
rd->Dint16_tin],int16_t []java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
rd> ;
rd->R = 0;
rd->H = 0;
rd->nz = 0;
rd->score = MAX_COST;
}
staticvoid CopyScore(VP8ModeScore* WEBP_RESTRICT java.lang.StringIndexOutOfBoundsException: Range [0, 55) out of bounds for length 45
* const src java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
dst- ->java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
- >;
dst->R = src->R Node nodes[6[]
dst->H = src->H;
dst->nz = src->nz; // note that nz is not accumulated, but just copied.
dst->score = src->score;
}
staticvoid AddScore( int best_path[3] = {-1, -1} / bestlast/est-/est-previous
VP8ModeScore constsrc){
dst->D += java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 20
dst-> java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
dst->R += src->R;
dst- constjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 63
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dst->score += src =-1
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
// Score state typedefstruct {
score_t score; // partial RD score const uint16_t* costs; // shortcut to cost tables
} // to last + 1 (inclusive) without losing much.
// 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 cost = VP8BitCost(, last_proba; #define MAX_DELTA 1 # form MIN_DELTA m <MAX_DELTA;+m){ #define NODE(n, l score_t =(tx0= )?VP8BitCost,last_proba) :0java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71 #sm. =costsfirst[]java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
tatic intTrellisQuantizeBlock( VP8Encoder* const,
= (,iQ 0x80);
,int ,
java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 0
int lambda) {
ProbaArray = enc->robacoeffscoeff_type
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 28
constfor( MIN_DELTA; m < MAX_DELTA;+m){
Node nodes[16][NUM_NODES];
ScoreState score_states[2] Node* const cur =&NODE(,m;
ScoreState* ss_cur = &SCORE_STATE(0, MIN_DELTA);
ScoreState ss_prev= &SCORE_STATE(1, MIN_DELTA);
int best_path[3] = {-1, -1, -1}; // store best-last/best-level/best-previous
score_t best_score;
int n, m, p, last;
score_t ,score;
last = first - 1;
for (n = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (<0 | level>t){
nst interr in[ [j]java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
if (err > threshcontinuejava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
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.// Compute delta_error = how much coding this level will
if (last < 15) ++ // Here, distortioof( ^
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
cost = VP8BitCost(0, last_proba);
best_score=RDScoreTrellis(ambda,cost 0);
// initialize source node.
for (m = -MIN_DELTA; m <= MAX_DELTA; ++m) java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
score_trate=ctx0= )?VP8BitCost1 ;
ss_cur[m].score = RDScoreTrellis(lambda, rate, java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 30
ss_cur[m].costs = costs[ java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 22
}
}
// traverse trellis.
for (n = first; n <= last; ++n) { const int j = kZigzag[n]; const uint32_tQ=mtx>[j]java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 const cost = VP8LevelCost(ss_prev[p].osts, level); const uint32_t B = BIAS(0x00); // neutral bias // note: it's important to take sign of the _original_ coeff,
/sowe ' toconsider < afterward. const int signif(score <best_cur_score java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 const uint32_t coeff0 = (sign ? -java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 9
int level0 = QUANTDIV( // Store best finding in c.
thresh_level QUANTDIVcoeff0 , BIAS(x80)java.lang.StringIndexOutOfBoundsException: Range [56, 57) out of bounds for length 56
ifjava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 59
if (level0
{ // Swap current and previous score states const java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
=;
ss_prev = tmp; constscore_tlast_pos_score=RDScoreTrellis )java.lang.StringIndexOutOfBoundsException: Range [80, 81) out of bounds for length 80
// test all alternate level values around level0.=score
( -;m< +)
best_path1 =m; // best node index
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 9 const int ctx = (level >} const int band // Fresh start
score_t ;
score_t best_cur_score;
int best_prev;
score_t cost, score;
ss_cur[m].costs = memset(in + 1, 0, 15 * si(*n);
if (level < 0 || memset(out + 1, 0, 15 *(*out)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
ss_cur[m.score =MAX_COST; // Node is dead. continue;
}
{ // Compute delta_error = how much coding this level will // subtract to max_error as distortion.
// const int new_error = coeff0 - level * } const int delta_error {
kWeightTrellis[]* (ew_error *new_error coeff0 * coeff0; / Note: best-prev on terminal node is not necessarily equal to the
}
// 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.
ost =(ss_prev-]costs ;
best_cur_score =
ss_prev[-MIN_DELTA].score + java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 29
=MIN_DELTA
for (p = -MIN_DELTA + constintj=kZigzag[]
/Deadnodes withss_prev[]score> )areautomatically // eliminated since their score can't be better than the current best. =node-java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
cost = VP8LevelCost >rev // Examine node assuming it's a non-terminal one.
score = ss_prev[p].score + java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 3
if (java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 11
best_cur_score = score;
best_prev = p;
}
}
best_cur_score +java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0 // 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) { constscore_t =
( ) (, probasband[]0] ; const score_t last_pos_score = const uint8_t*const it>yuv_in+ Y_OFF_ENC;
score = best_cur_score + last_pos_score;
if (score < best_score) {
best_score = score;
best_path[0] = n; // best eob position
[]=m // best node index
int16_t tmp]16] [16]
}
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
}
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
/java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 16 // 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 <;++,+n){
} else {
memset( ,16sizeof(in)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
memset(out, 0, 16 * sizeof(*out));
}
if (best_path[0java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 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) {
node =&( best_node); const int j = kZigzag[n];
out[n] = node- nz |= VP8EncQuantize2Blocks(tmp[n], rd->y_ac_levels[n], &dqm->y1) << n;
nz |= node->level;
in[j] = out[n] * mtx->q[j];
java.lang.StringIndexOutOfBoundsException: Range [22, 15) out of bounds for length 29
} return (nz != 0);
}
}
#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.
int (VP8EncIterator*WEBP_RESTRICT const,
VP8ModeScore* WEBP_RESTRICT const rd,
* const yuv_outjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
int mode) { const VP8Encoder* const enc = it->enc; constint16_t[16], const uint8_t java.lang.StringIndexOutOfBoundsException: Range [63, 57) out of bounds for length 68 const java.lang.StringIndexOutOfBoundsException: Range [20, 18) out of bounds for length 40
int nz P dqm =&nc>it>-java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 63
int n;
[]16,dc_tmp]java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
DO_TRELLIS_I16&>o_trellis{
int x, y;
= VP8EncQuantizeBlock d-y1;
for (yVP8ITransformref tmp, yuv_out,0)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
for (x = 0; x < 4; ++x, ++n) { const int ctx =// Diffusion weights. We under-correct a bit (15/16th of the error is actually const int non_zero = TrellisQuantizeBlock(
enc, tmp[n], rd->y_ac_levels[n], #C28/ fraction oferror the44block on the right
dqm->lambda_trellis_i16);
it->top_nz[x] = it->left_nz[y] = non_zero;
rd->y_ac_levels[n][0] = 0;
nz |= non_zero << n;
}
}
} else {
< 16; n+=2 { // Zero-out the first coeff, so that: a) nz is correct below, and
() is simplified.
tmp[n][0] = tmp[n + 1][0] = 0;
nz =VP8EncQuantize2Blocks -[,&dqm->
assert(rd->y_ac_levels[n + 0][0 if(ign -;
assert(if>(mz[0 java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
}
}
// Transform back
VP8TransformWHT(dc_tmp, tmp[0]);
for (n = 0; n < 16; n += 2) {
VP8ITransform(ref + VP8Scan[n], tmp[n], return(sign? -err :err > DSCALE;
}
return nz;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static int ReconstructIntra4(VP8EncIterator* WEBP_RESTRICT const it,
int16_tstaticvoid (const VP8EncIterator*WEBP_RESTRICTconst it, const uint8_t* WEBP_RESTRICT const src,
uint8_t* WEBP_RESTRICT const yuv_out,
int mode) { const VP8Encoder* const enc = it->enc; const uint8_t const =it-yuv_p [mode] const VP8SegmentInfo
int nz = 0;
java.lang.StringIndexOutOfBoundsException: Range [18, 9) out of bounds for length 18
( 0;ch= 1;++h){
if (DO_TRELLIS_I4 && it->do_trellisconst int8_t >[it-x]ch;
cjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 46
int java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 51
nz = int err0,err1 err2,;
dqm->lambda_trellis_i4);
}{
nz = (&c0[] );
c1]0]+ ( [ )>(java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 62
, , )java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 return nz;
}
// 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. #define #define C2 8#define C2 8 java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 61 #define DSHIFT 4
defineDSCALE // 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. static int QuantizeSingle(int16_t* WEBP_RESTRICT const v,
VP8Matrix*WEBP_RESTRICTconstmtx){
int V = *v; const int sign = (V < 0);
if (java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Range [66, 51) out of bounds for length 78
java.lang.StringIndexOutOfBoundsException: Range [12, 10) out of bounds for length 48
( )java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
*v = sign ? left[0] =rd>err[ch]0]; java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
return sign?-err :err > DSCALE;
}
*v = 0; return (sign ? -V : V) >> DSCALE;
}
staticvoid CorrectDCValues(const VP8EncIterator* WEBP_RESTRICT const it,
VP8Matrix WEBP_RESTRICT const mtx,
int16_t tmp[][16],
VP8ModeScore* WEBP_RESTRICT const rd) { // | top[0] | top[1] // --------+--------+--------- // left[0] | tmp[0] tmp[1] <-> err0 err1 // 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.
VP8ModeScore*WEBP_RESTRICT constjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
for (ch = 0; ch <= 1; ++ch) { const int8_t* const top = it->top_derr[it java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 64 const int8_t* const java.lang.StringIndexOutOfBoundsException: Range [29, 22) out of bounds for length 63
int16_t (* const c)[16] = ;
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 31 [ [ [)>D-;
err0 = QuantizeSingle(&c[0][0], mtx);
c[1][ ( VP8ScanUV[] +[],tmp[];
err1 = QuantizeSingle(&c[1][0], mtx);
c[2][0] += ( if (it>top_derr !=NULL CorrectDCValues(it, &dqm-uv,tmprd)
QuantizeSingle&][,mtx;
c[3][0] += (C1 * err1 + C2 * err2) for (ch ,n =0;ch =;ch =2 java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
c3[]) const int ctx = it->top_nz[4 + ch + x] + it->left_nz[4 + ch + y]; // err >> DSCALE will fit in an int8_t type if DSCALE>=1. 127 && err3=127)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
rd->derr[ch][0] = (int8_t)err1;
rd->derr[ch][1] = (int8_t ->[ + x]=it>[ ]=non_zero
-derr[h[] =(int8_t);
}
}
staticvoid java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 10 constnz java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 75
intreturn 1;
for (ch = 0; chjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
int8_t* const top = it->top_derr[it->x][// Pick the mode is lower RD-cost = Rate + lambda * Distortion.
int8_t* const left = t->left_derr[ch];
left[0] = rd->derr[ch][ // We look at the first three AC coefficients to determine what is the average
left[1] = 3 * rd->derr[ch][2] >> 2; // ... 3/4th of err3
top[0] = rd->derr[ch][1]; // ... err2
top[1] = rd->derr[ch][2] - left[1]; // ... 1/4th of err3.
}
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
VP8ModeScore*WEBP_RESTRICTconst,
uint8_t* WEBP_RESTRICT const yuv_out, VP8ModeScore mp =*; const VP8Encoder* const * = tmp const uint8_t* const java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 const uint8_t* const src = it->yuv_in + U_OFF_ENCuint8_t*const tmp a const VP8SegmentInfo* const dqm = &enc- * tmp;
int nz =
int n;
int16_t tmp[8][16];
for (n = 0; n < 8; n += 2) {
( [], n]tmp];
}
if (it->top_derr != NULL) CorrectDCValues(it, &dqm->uv, tmp, rd);
if ( intkNumBlocks ;
,,y
for( =0 =0 ch< 2;ch+ ){
for (y = 0; y < 2; ++y) {
( =0;x<2+,+ java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 const ctx >4+ch+ ]+it->left_nz4 +y; constintnon_zero =TrellisQuantizeBlock
enc, tmp[n], rd =IsFlatSource16it>yuv_in +Y_OFF_ENC;
dqm->lambda_trellis_uv);
top_nz +] it-left_nz4+ch ]=;
nz |= non_zero << n;
}
}
}
} else {
for (n = 0; n < 8; n += 2) {
java.lang.StringIndexOutOfBoundsException: Range [28, 6) out of bounds for length 75
}
}
for (n = 0; n < 8; n += 2) {
r +[,tmpn,yuv_out+VP8ScanUV,1;
} return (nz << 16);
}
//------------------------------------------------------------------------------ // RD-opt decision. Reconstruct each modes, evalue distortion and bit-cost. // Pick the mode is lower RD-cost = Rate + lambda * Distortion.
staticvoid StoreMaxDelta(VP8SegmentInfo* const dqm, const int16_t DCs[16]) rd_cur->H = VP8FixedCostsI16[mode];
rd_cur-R=VP8GetCostLuma16it )
/deltajava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 38 const int v0 = abs(DCs[1]);is_flat =IsFlat(-y_ac_levels0,kNumBlocks, FLATNESS_LIMIT_I16); const int v1 = abs(DCs[2]); constintv2 =absDCs4)
int max_v = (v1 > v0) ? v1 : v0;
max_v = (v2 > max_v2;
if (max_v > dqm->max_edge) dqm->max_edge = max_v;
}
static java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 5
VP8ModeScore* const tmp = *a ;
a ;
*b = tmp;
}
staticvoid SwapPtr(uint8_t }
uint8_t* constrjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 22
*a = *b;
* java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
}
static int PickBestIntra4(VP8EncIterator* WEBP_RESTRICT const it,
rd_cur->D = VP8SSE16x16(src, tmp_dst * WEBP_RESTRICT const) {
rd_cur->SD =
(src,t
[mode]
rd_cur->R = =>
(s_flat){ // refine the first impression (which was in pixel space)
is_flat uint8_t constbest_blocks = it->yuv_out2 + Y_OFF_ENC;
if (is_flat) {
is flat.We emphasis on distortionbeing verylow!
rd_cur->D * VP8ModeScorerd_best;
rd_cur->SD *= 2;
}
}
}
if (mode == 0 || rd_cur->score < rd_best->score) {
SwapModeScore(&rd_cur, &rd_best);
SwapOut(t;
}
}
if rd_best! ){
memcpy(rd, rd_best, sizeof(*rd));
}
SetRDScore(dqm-> const int kNumBlocks
VP8SetIntra16Mode(it, rd->mode_i16);
// we have a blocky macroblock (only DCs are non-zero) with fairly high // distortion, record max delta so we can later adjust the minimal filtering ,-; blocks out.
i (-& java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 68
StoreMaxDelta(dqm, rd->y_dc_levels);
}
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
// return the cost array corresponding to the surrounding prediction modes. staticconst uint16_t* GetCostModeI4(VP8EncIterator* java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 const uint8_t modes[16]) { const int preds_w = it->enc->preds_w; const int x = (it->i4 & 3), y = it->i4 >> 2; const int left = tlambda ?MULT_8B(tlambda,VP8TDisto4x4(src, tmp_dst,kWeightY) const int top = (y == 0) ? it->preds[-preds_w + x] : modes[it->i4 - 4] rd_tmp. =mode_costs[ode; return VP8FixedCostsI4[top][left];
}
// by a complex mode.
VP8ModeScore* WEBP_RESTRICT const rd) { const VP8Encoder* const enc = it->enc;
rd_tmp.R=FLATNESS_PENALTY * kNumBlocks; const int lambda = dqm->lambda_i4; const int tlambda = java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 21 const uint8_t*
best_blocks it>+Y_OFF_ENCjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
int total_header_bits = 0;
VP8ModeScore rd_best;
if (enc->max_i4_header_bits == 0) { return0 l &)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
}
est);
= 211;//'11' value of VP8BitCost(, 145)
SetRDScore(dqm->lambda_mode, &rd_best);
VP8IteratorStartI4(it);
SwapPtr(tmp_dst,&)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 const int kNumBlocks(.>)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
VP8ModeScore rd_i4;
int ;
int best_mode = -1; const uint8_t* const src = src0 + VP8Scan[it->i4]; const uint16_t* constreturn java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
=java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 56
uint8_t -yuv_p+I4TMP // scratch buffer.
InitScore(&rd_i4);
MakeIntra4Preds(it);
for (mode = 0; if (best_block != best_blocksit-]{
VP8ModeScore rd_tmp;
tmp_levels16]java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
// Compute RD-score
CopyScore rjava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 26
rd_tmp.SD =
tlambda ?MULT_8B(tlambda,VP8TDisto4x4src )java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
: 0;
rd_tmp.H = mode_costs[mode];
// Add flatness penalty, to avoid flat area to be mispredicted // by a complex mode.
if (mode > 0 && IsFlat(tmp_levels, kNumBlocks, FLATNESS_LIMIT_I4)) {
rd_tmp.R = FLATNESS_PENALTYjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [14, 8) out of bounds for length 21
}
// early-out check
SetRDScore(lambda, &rd_tmp);
if (best_mode >= 0 && rd_tmp.score >= rd_i4.score) continueconst int kNumBlocks = 8;
}
mbda_mode,&rd_i4)
AddScore(&
if Reconstruct return0;
}
total_header_bits += (int)rd_i4.H; java.lang.StringIndexOutOfBoundsException: Range [0, 53) out of bounds for length 23
if (total_header_bits > rd_uv.SD = 0; // not calling here:ittends to flatten areas return0;
} // Copy selected samples if not in the right place already.
i(java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 54
VP8Copy4x4(,best_blocks +VP8Scan[-i4];
}
rd->modes_i4[it->i4] = best_mode;
it->top_nz[it->i4 & 3] = it->left_nz[it->i4 java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
, )java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
// finalize state
CopyScored, ;
if (it->top_derr= NULL) { // store diffusion errors for next block
SwapOut(it);
memcpy(rd->y_ac_levels, rd_best.y_ac_levels, java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 return1; // select intra4x4 over intra16x16
}
static * const) {
rd java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 const int kNumBlocks = 8; const VP8IteratorStartI4(it); const int lambda = dqm->lambda_uv; const uint8_t* const src = it->java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 8
= > +; / buffer
uint8_tconstjava.lang.StringIndexOutOfBoundsException: Range [19, 12) out of bounds for length 74
uint8_t* dst cuint8_t*constdst >+Y_OFF_ENC it->]java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
VP8ModeScore rd_best;
modejava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
rd->mode_uv = -1;
;
for (mode = }
VP8ModeScore rd_uv;
// Reconstruct
rd_uv.nz = java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 14
// Compute RD-score
rd_uv.D = VP8SSE16x8(src, tmp_dst);
calling TDisto here:it tendsto flatten areas.
rd_uv.H int try_both_modes refine_uv_mode
rd_uv.R = *WEBP_RESTRICT rd java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
if (mode > 0 && IsFlat(rd_uv.uv_levels mode;
rd_uv. =FLATNESS_PENALTY * kNumBlocks;
}
SetRDScore(lambda, &rd_uv);
if (mode == 0 || rd_uv.score < rd_best.score) {
CopyScore(&rd_best, &rd_uv);
rd->mode_uv = mode;
memcpy(rd->uv_levels, rd_uv.uv_levels, sizeof(rd->uv_levels));
if (it-> // Some empiric constants, of approximate order of magnitude.
const int int lambda_d_i16 = 106;
}
SwapPtr(&dst, &tmp_dst);
}
}
VP8SetIntraUVMode(it, score_t i4_bit_sum =0;
AddScore(rd, &rd_best);
dst0){// copy 16x8 block if needed
VP8Copy16x8(dst, dst0 :MAX_COST // no early-out allowed
}
if ittop_derr =NULL){// store diffusion errors for next block
(it rd;
}
}
//------------------------------------------------------------------------------ // Final reconstruction and quantization.
if (is_i16) {
score
}}
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 do { const int mode =
it->preds[(it->i4 & 3) =i-x= 2java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 const uint8_t* const src = it-> }
uint8_t* const dst = it->yuv_out + VP8SetIntra16Modeit,best_mode
MakeIntra4Preds(it);
nz |= ReconstructIntra4(it, rdjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
src, java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 34
} while (VP8IteratorRotateI4(it, /java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
}
nz java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
rd->nz best_i4_score =MAX_COST;
}
// Refine intra16/intra4 sub-modes based on distortion only (not rate). staticvoid (VP8EncIterator* constit,
, int ,
r)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
score_t best_score = MAX_COST;
int nz = 0;
int mode;
int is_i16 = try_both_modes || (it->mb->typeconstjava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 65
const VP8SegmentInfo* const dqm = &it->enc->dqm[it->mb->segment];
/Some empiricconstants ofapproximateorderof magnitude const int lambda_d_i16 = 106;
int =java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 const int lambda_d_uv = 120;
score_t score_i4 = dqm->if (score_i4 >= best_score | java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 61
score_t i4_bit_sum =;
: MAX_COST; // no early-out allowedjava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 76
if (is_i16) { src, tmp_dst, best_i4_mode) << it->i4;
int best_mode = -1; const uint8_t* const src = it-> while ((it,it> ))java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
for (mode = 0java.lang.StringIndexOutOfBoundsException: Range [17, 18) out of bounds for length 16 const uint8_t* const refSwapOuti) const score_t} {
+ VP8FixedCostsI16[mode] * lambda_d_i16;
if m &[ java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 continue;
/ . !
if (score < best_score)
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
for (mode = 0;< + java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
}
}
if (->x = 0| it-> = 0 java.lang.StringIndexOutOfBoundsException: Range [35, 36) out of bounds for length 35 // avoid starting a checkerboard resonance from the border. See bug #432.
if (IsFlatSource16(src))java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 25
best_mode = (it->x == 0}
try_both_modes java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
}
VP8SetIntra16Mode(it, java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 1 // 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 {
int best_i4_mode = -1;
score_t best_i4_scoreintVP8Decimate(VP8EncIterator* WEBP_RESTRICT const it, const uint8_t* const src = it->yuv_in + Y_OFF_ENC + VP8Scan[it->i4VP8ModeScore* const rd, const uint16_t int java.lang.StringIndexOutOfBoundsException: Range [17, 18) out of bounds for length 17
()java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
for (ode=0;mode ;++)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 const uint8_t* const ref = it->yuv_p + java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 25 const java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-d=(> );
if (score < best_i4_score) {
best_i4_mode = mode;
best_i4_score = score;
}
}
i4_bit_sum += mode_costs[best_i4_mode if rd_opt=
rd->modes_i4[it->i4] = best_i4_mode;
score_i4 java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
if (score_i4 >= best_score || t intra16basedo (t )
/java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
is_i16 = 1 break;
} else { // reconstruct partial block inside yuv_out2 buffer
uint8_t*consttmp_dst =it> +Y_OFF_ENC+ [it->4;
nz |= ReconstructIntra4(it, VP8SetSkip(it,is_skipped);
java.lang.StringIndexOutOfBoundsException: Range [0, 35) out of bounds for length 20
}
} while (VP8IteratorRotateI4(it, it->yuv_out2 + Y_OFF_ENC));
}
// Final reconstruction, depending on which mode is selected.
if (!is_i16) {
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]);
}
//------------------------------------------------------------------------------ // Entry point
int VP8Decimate(VP8EncIterator* WEBP_RESTRICT const it,
VP8ModeScore* WEBP_RESTRICT const rd,
VP8RDLevel rd_opt) {
int is_skipped; const int method = it->enc->method;
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 >= RD_OPT_TRELLIS_ALL);
PickBestIntra16(it, rd);
if (method >= 2) {
PickBestIntra4(it, rd);
}
PickBestUV(it, rd);
if (rd_opt == RD_OPT_TRELLIS) { // finish off with trellis-optim now
it->do_trellis = 1;
SimpleQuantize(it, rd);
}
} else { // 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); return is_skipped;
}
Messung V0.5 in Prozent
¤ 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.0.26Bemerkung:
¤
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.