Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/media/libwebp/src/enc/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 21 kB image not shown  

Quelle  tree_enc.c

  Sprache: C
 

// 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.
// -----------------------------------------------------------------------------
//
// Coding of token probabilities, intra modes and segments.
//
// Author: Skal (pascal.massimino@gmail.com)

#include <string.h>

#include "src/dec/common_dec.h"
#include "src/webp/types.h"
#include "src/enc/vp8i_enc.h"
#include "src/utils/bit_writer_utils.h"

//------------------------------------------------------------------------------
// Default probabilities

// Paragraph 13.5
const uint8_t
  VP8CoeffsProba0[NUM_TYPES][NUM_BANDS][NUM_CTX][NUM_PROBAS] = {
  { { { 128128128128128128128128128128128 },
      { 128128128128128128128128128128128 },
      { 128128128128128128128128128128128 }
    },
    { { 253136254255228219128128128128128 },
      { 189129242255227213255219128128128 },
      { 106126227252214209255255128128128 }
    },
    { { 198248255236226255255128128128 },
      { 181133238254221234255154128128128 },
      { 78134202247198180255219128128128 },
    },
    { { 1185249255243255128128128128128 },
      { 184150247255236224128128128128128 },
      { 77110216255236230128128128128128 },
    },
    { { 1101251255241255128128128128128 },
      { 170139241252236209255255128128128 },
      { 37116196243228255255255128128128 }
    },
    { { 1204254255245255128128128128128 },
      { 207160250255238128128128128128128 },
      { 102103231255211171128128128128128 }
    },
    { { 1152252255240255128128128128128 },
      { 177135243255234225128128128128128 },
      { 80129211255194224128128128128128 }
    },
    { { 11255128128128128128128128128 },
      { 2461255128128128128128128128128 },
      { 255128128128128128128128128128128 }
    }
  },
  { { { 1983523722319318716216014515562 },
      { 131451982211721762201572522211 },
      { 6847146208149167221162255223128 }
    },
    { { 1149241255221224255255128128128 },
      { 184141234253222220255199128128128 },
      { 8199181242176190249202255255128 }
    },
    { { 1129232253214197242196255255128 },
      { 99121210250201198255202128128128 },
      { 2391163242170187247210255255128 }
    },
    { { 1200246255234255128128128128128 },
      { 109178241255231245255255128128128 },
      { 44130201253205192255255128128128 }
    },
    { { 1132239251219209255165128128128 },
      { 94136225251218190255255128128128 },
      { 22100174245186161255199128128128 }
    },
    { { 1182249255232235128128128128128 },
      { 124143241255227234128128128128128 },
      { 3577181251193211255205128128128 }
    },
    { { 1157247255236231255255128128128 },
      { 121141235255225227255255128128128 },
      { 4599188251195217255224128128128 }
    },
    { { 11251255213255128128128128128 },
      { 2031248255255128128128128128128 },
      { 1371177255224255128128128128128 }
    }
  },
  { { { 2539248251207208255192128128128 },
      { 17513224243193185249198255255128 },
      { 7317171221161179236167255234128 }
    },
    { { 195247253212183255255128128128 },
      { 23990244250211209255255128128128 },
      { 15577195248188195255255128128128 }
    },
    { { 124239251218219255205128128128 },
      { 20151219255196186128128128128128 },
      { 6946190239201218255228128128128 }
    },
    { { 1191251255255128128128128128128 },
      { 223165249255213255128128128128128 },
      { 141124248255255128128128128128128 }
    },
    { { 116248255255128128128128128128 },
      { 19036230255236255128128128128128 },
      { 1491255128128128128128128128128 }
    },
    { { 1226255128128128128128128128128 },
      { 247192255128128128128128128128128 },
      { 240128255128128128128128128128128 }
    },
    { { 1134252255255128128128128128128 },
      { 21362250255255128128128128128128 },
      { 5593255128128128128128128128128 }
    },
    { { 128128128128128128128128128128128 },
      { 128128128128128128128128128128128 },
      { 128128128128128128128128128128128 }
    }
  },
  { { { 20224213235186191220160240175255 },
      { 12638182232169184228174255187128 },
      { 6146138219151178240170255216128 }
    },
    { { 1112230250199191247159255255128 },
      { 166109228252211215255174128128128 },
      { 3977162232172180245178255255128 }
    },
    { { 152220246198199249220255255128 },
      { 12474191243183193250221255255128 },
      { 2471130219154170243182255255128 }
    },
    { { 1182225249219240255224128128128 },
      { 149150226252216205255171128128128 },
      { 28108170242183194254223255255128 }
    },
    { { 181230252204203255192128128128 },
      { 123102209247188196255233128128128 },
      { 2095153243164173255203128128128 }
    },
    { { 1222248255216213128128128128128 },
      { 168175246252235205255255128128128 },
      { 47116215255211212255255128128128 }
    },
    { { 1121236253212214255255128128128 },
      { 14184213252201202255219128128128 },
      { 4280160240162185255205128128128 }
    },
    { { 11255128128128128128128128128 },
      { 2441255128128128128128128128128 },
      { 2381255128128128128128128128128 }
    }
  }
};

void VP8DefaultProbas(VP8Encoder* const enc) {
  VP8EncProba* const probas = &enc->proba;
  probas->use_skip_proba = 0;
  memset(probas->segments, 255u, sizeof(probas->segments));
  memcpy(probas->coeffs, VP8CoeffsProba0, sizeof(VP8CoeffsProba0));
  // Note: we could hard-code the level_costs corresponding to VP8CoeffsProba0,
  // but that's ~11k of static data. Better call VP8CalculateLevelCosts() later.
  probas->dirty = 1;
}

// Paragraph 11.5.  900bytes.
static const uint8_t kBModesProba[NUM_BMODES][NUM_BMODES][NUM_BMODES - 1] = {
  { { 2311204889115113120152112 },
    { 15217964126170118467095 },
    { 1756914380858272155103 },
    { 5658101712181891713152 },
    { 1142617163441952110173 },
    { 12124801952662446485 },
    { 1447110381712131443426 },
    { 1704655191361603320671 },
    { 63208114114208129226 },
    { 8140119618284291636 } },
  { { 1341838913798101106165148 },
    { 72187100130157111327580 },
    { 6610216799746240234128 },
    { 41539178241141268107 },
    { 744326146731664923157 },
    { 6538105160515231115128 },
    { 10479122721725587177 },
    { 87687144114511518623 },
    { 4741141101821832117194 },
    { 664525102197189231822 } },
  { { 8888147150424645196205 },
    { 439718311785383517961 },
    { 395320087262143232171 },
    { 563451104114102299377 },
    { 39288517158165909864 },
    { 342211620623344316673 },
    { 107543226511814331 },
    { 6825106226417136225114 },
    { 3419211021321881676124 },
    { 621878958557504851 } },
  { { 193101351592151118946111 },
    { 60148311722192282118111 },
    { 112113778517925538120114 },
    { 404211962452091025109 },
    { 8843291401662133743154 },
    { 6163301556745681209 },
    { 100808431541512671 },
    { 14278781625512834197171 },
    { 4140510221118341221 },
    { 515017168209192232582 } },
  { { 1383136171271663844229 },
    { 678758169821152659179 },
    { 635990180591669373154 },
    { 4040211161432093439175 },
    { 471516183342234945183 },
    { 4617331836981532183 },
    { 574622241281541737 },
    { 6532731152812823128205 },
    { 403911551192186223 },
    { 873791155977642147 } },
  { { 104554421895453130226 },
    { 6490702054041232657 },
    { 545711218454138166213 },
    { 3034261331521161032134 },
    { 391953221261143273255 },
    { 31965234215111873 },
    { 753212511922551604351 },
    { 88313567102855518685 },
    { 562123111592054537192 },
    { 5538701247310213498 } },
  { { 1259842881048511717582 },
    { 9584538912810011310145 },
    { 75791234751128811711 },
    { 571757110257534149 },
    { 383313121577326185 },
    { 411067138771109047114 },
    { 11521210102255166236 },
    { 1012916108512810119626 },
    { 571810102102213342043 },
    { 11720153616312868126 } },
  { { 102617137345331243192 },
    { 69607138731192822237 },
    { 68451283414711245171 },
    { 6217197014685556270 },
    { 374337154100163851601 },
    { 6399213628643220185 },
    { 7515996425518411916 },
    { 86628564255252481 },
    { 5681713213725555116128 },
    { 58152082135572612140 } },
  { { 16450311371541332535218 },
    { 5110344131131123316158 },
    { 86406413514822445183128 },
    { 222617131240154141209 },
    { 451621916422271197 },
    { 5621391556013823102213 },
    { 83121354192255684728 },
    { 8526858512812832146171 },
    { 181176314417144246 },
    { 3527101461741711226128 } },
  { { 190803599180801265445 },
    { 85126478717651412032 },
    { 1017512813911814611612885 },
    { 5641151762368537962 },
    { 7130171191182551718138 },
    { 101386013855704326142 },
    { 146361930171255972720 },
    { 13845616221918118864 },
    { 3241201171511422021163 },
    { 11219126119512848424 } }
};

static int PutI4Mode(VP8BitWriter* const bw, int mode,
                     const uint8_t* const prob) {
  if (VP8PutBit(bw, mode != B_DC_PRED, prob[0])) {
    if (VP8PutBit(bw, mode != B_TM_PRED, prob[1])) {
      if (VP8PutBit(bw, mode != B_VE_PRED, prob[2])) {
        if (!VP8PutBit(bw, mode >= B_LD_PRED, prob[3])) {
          if (VP8PutBit(bw, mode != B_HE_PRED, prob[4])) {
            VP8PutBit(bw, mode != B_RD_PRED, prob[5]);
          }
        } else {
          if (VP8PutBit(bw, mode != B_LD_PRED, prob[6])) {
            if (VP8PutBit(bw, mode != B_VL_PRED, prob[7])) {
              VP8PutBit(bw, mode != B_HD_PRED, prob[8]);
            }
          }
        }
      }
    }
  }
  return mode;
}

static void PutI16Mode(VP8BitWriter* const bw, int mode) {
  if (VP8PutBit(bw, (mode == TM_PRED || mode == H_PRED), 156)) {
    VP8PutBit(bw, mode == TM_PRED, 128);    // TM or HE
  } else {
    VP8PutBit(bw, mode == V_PRED, 163);     // VE or DC
  }
}

static void PutUVMode(VP8BitWriter* const bw, int uv_mode) {
  if (VP8PutBit(bw, uv_mode != DC_PRED, 142)) {
    if (VP8PutBit(bw, uv_mode != V_PRED, 114)) {
      VP8PutBit(bw, uv_mode != H_PRED, 183);    // else: TM_PRED
    }
  }
}

static void PutSegment(VP8BitWriter* const bw, int s, const uint8_t* p) {
  if (VP8PutBit(bw, s >= 2, p[0])) p += 1;
  VP8PutBit(bw, s & 1, p[1]);
}

void VP8CodeIntraModes(VP8Encoder* const enc) {
  VP8BitWriter* const bw = &enc->bw;
  VP8EncIterator it;
  VP8IteratorInit(enc, &it);
  do {
    const VP8MBInfo* const mb = it.mb;
    const uint8_t* preds = it.preds;
    if (enc->segment_hdr.update_map) {
      PutSegment(bw, mb->segment, enc->proba.segments);
    }
    if (enc->proba.use_skip_proba) {
      VP8PutBit(bw, mb->skip, enc->proba.skip_proba);
    }
    if (VP8PutBit(bw, (mb->type != 0), 145)) {  // i16x16
      PutI16Mode(bw, preds[0]);
    } else {
      const int preds_w = enc->preds_w;
      const uint8_t* top_pred = preds - preds_w;
      int x, y;
      for (y = 0; y < 4; ++y) {
        int left = preds[-1];
        for (x = 0; x < 4; ++x) {
          const uint8_t* const probas = kBModesProba[top_pred[x]][left];
          left = PutI4Mode(bw, preds[x], probas);
        }
        top_pred = preds;
        preds += preds_w;
      }
    }
    PutUVMode(bw, mb->uv_mode);
  } while (VP8IteratorNext(&it));
}

//------------------------------------------------------------------------------
// Paragraph 13

const uint8_t
    VP8CoeffsUpdateProba[NUM_TYPES][NUM_BANDS][NUM_CTX][NUM_PROBAS] = {
  { { { 255255255255255255255255255255255 },
      { 255255255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    },
    { { 176246255255255255255255255255255 },
      { 223241252255255255255255255255255 },
      { 249253253255255255255255255255255 }
    },
    { { 255244252255255255255255255255255 },
      { 234254254255255255255255255255255 },
      { 253255255255255255255255255255255 }
    },
    { { 255246254255255255255255255255255 },
      { 239253254255255255255255255255255 },
      { 254255254255255255255255255255255 }
    },
    { { 255248254255255255255255255255255 },
      { 251255254255255255255255255255255 },
      { 255255255255255255255255255255255 }
    },
    { { 255253254255255255255255255255255 },
      { 251254254255255255255255255255255 },
      { 254255254255255255255255255255255 }
    },
    { { 255254253255254255255255255255255 },
      { 250255254255254255255255255255255 },
      { 254255255255255255255255255255255 }
    },
    { { 255255255255255255255255255255255 },
      { 255255255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    }
  },
  { { { 217255255255255255255255255255255 },
      { 225252241253255255254255255255255 },
      { 234250241250253255253254255255255 }
    },
    { { 255254255255255255255255255255255 },
      { 223254254255255255255255255255255 },
      { 238253254254255255255255255255255 }
    },
    { { 255248254255255255255255255255255 },
      { 249254255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    },
    { { 255253255255255255255255255255255 },
      { 247254255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    },
    { { 255253254255255255255255255255255 },
      { 252255255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    },
    { { 255254254255255255255255255255255 },
      { 253255255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    },
    { { 255254253255255255255255255255255 },
      { 250255255255255255255255255255255 },
      { 254255255255255255255255255255255 }
    },
    { { 255255255255255255255255255255255 },
      { 255255255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    }
  },
  { { { 186251250255255255255255255255255 },
      { 234251244254255255255255255255255 },
      { 251251243253254255254255255255255 }
    },
    { { 255253254255255255255255255255255 },
      { 236253254255255255255255255255255 },
      { 251253253254254255255255255255255 }
    },
    { { 255254254255255255255255255255255 },
      { 254254254255255255255255255255255 },
      { 255255255255255255255255255255255 }
    },
    { { 255254255255255255255255255255255 },
      { 254254255255255255255255255255255 },
      { 254255255255255255255255255255255 }
    },
    { { 255255255255255255255255255255255 },
      { 254255255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    },
    { { 255255255255255255255255255255255 },
      { 255255255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    },
    { { 255255255255255255255255255255255 },
      { 255255255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    },
    { { 255255255255255255255255255255255 },
      { 255255255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    }
  },
  { { { 248255255255255255255255255255255 },
      { 250254252254255255255255255255255 },
      { 248254249253255255255255255255255 }
    },
    { { 255253253255255255255255255255255 },
      { 246253253255255255255255255255255 },
      { 252254251254254255255255255255255 }
    },
    { { 255254252255255255255255255255255 },
      { 248254253255255255255255255255255 },
      { 253255254254255255255255255255255 }
    },
    { { 255251254255255255255255255255255 },
      { 245251254255255255255255255255255 },
      { 253253254255255255255255255255255 }
    },
    { { 255251253255255255255255255255255 },
      { 252253254255255255255255255255255 },
      { 255254255255255255255255255255255 }
    },
    { { 255252255255255255255255255255255 },
      { 249255254255255255255255255255255 },
      { 255255254255255255255255255255255 }
    },
    { { 255255253255255255255255255255255 },
      { 250255255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    },
    { { 255255255255255255255255255255255 },
      { 254255255255255255255255255255255 },
      { 255255255255255255255255255255255 }
    }
  }
};

void VP8WriteProbas(VP8BitWriter* const bw, const VP8EncProba* const probas) {
  int t, b, c, p;
  for (t = 0; t < NUM_TYPES; ++t) {
    for (b = 0; b < NUM_BANDS; ++b) {
      for (c = 0; c < NUM_CTX; ++c) {
        for (p = 0; p < NUM_PROBAS; ++p) {
          const uint8_t p0 = probas->coeffs[t][b][c][p];
          const int update = (p0 != VP8CoeffsProba0[t][b][c][p]);
          if (VP8PutBit(bw, update, VP8CoeffsUpdateProba[t][b][c][p])) {
            VP8PutBits(bw, p0, 8);
          }
        }
      }
    }
  }
  if (VP8PutBitUniform(bw, probas->use_skip_proba)) {
    VP8PutBits(bw, probas->skip_proba, 8);
  }
}

Messung V0.5 in Prozent
C=90 H=94 G=91

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.23Angebot  (Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-08-26) ¤

*Eine klare Vorstellung vom Zielzustand






Wurzel

Ziele

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Ergonomie der
Schnittstellen

Diese beiden folgenden Angebotsgruppen bietet das Unternehmen

Angebot

Hier finden Sie eine Liste der Produkte des Unternehmens