Exemple #1
0
        private bool Decimate(Vp8EncIterator it, ref Vp8ModeScore rd, Vp8RdLevel rdOpt)
        {
            rd.InitScore();

            // We can perform predictions for Luma16x16 and Chroma8x8 already.
            // Luma4x4 predictions needs to be done as-we-go.
            it.MakeLuma16Preds();
            it.MakeChroma8Preds();

            if (rdOpt > Vp8RdLevel.RdOptNone)
            {
                QuantEnc.PickBestIntra16(it, ref rd, this.SegmentInfos, this.Proba);
                if (this.method >= WebpEncodingMethod.Level2)
                {
                    QuantEnc.PickBestIntra4(it, ref rd, this.SegmentInfos, this.Proba, this.maxI4HeaderBits);
                }

                QuantEnc.PickBestUv(it, ref rd, this.SegmentInfos, this.Proba);
            }
            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.
                QuantEnc.RefineUsingDistortion(it, this.SegmentInfos, rd, this.method >= WebpEncodingMethod.Level2, this.method >= WebpEncodingMethod.Level1, this.MbHeaderLimit);
            }

            bool isSkipped = rd.Nz == 0;

            it.SetSkip(isSkipped);

            return(isSkipped);
        }