Esempio n. 1
0
        private int MbAnalyze(Vp8EncIterator it, int[] alphas, out int bestUvAlpha)
        {
            it.SetIntra16Mode(0);    // default: Intra16, DC_PRED
            it.SetSkip(false);       // not skipped.
            it.SetSegment(0);        // default segment, spec-wise.

            int bestAlpha;

            if (this.method <= WebpEncodingMethod.Level1)
            {
                bestAlpha = it.FastMbAnalyze(this.quality);
            }
            else
            {
                bestAlpha = it.MbAnalyzeBestIntra16Mode();
                if (this.method >= WebpEncodingMethod.Level5)
                {
                    // We go and make a fast decision for intra4/intra16.
                    // It's usually not a good and definitive pick, but helps seeding the stats about level bit-cost.
                    bestAlpha = it.MbAnalyzeBestIntra4Mode(bestAlpha);
                }
            }

            bestUvAlpha = it.MbAnalyzeBestUvMode();

            // Final susceptibility mix.
            bestAlpha = ((3 * bestAlpha) + bestUvAlpha + 2) >> 2;
            bestAlpha = FinalAlphaValue(bestAlpha);
            alphas[bestAlpha]++;
            it.CurrentMacroBlockInfo.Alpha = bestAlpha; // For later remapping.

            return(bestAlpha);                          // Mixed susceptibility (not just luma).
        }