Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Chromium
third_party/libwebp/src/enc/histogram_enc.c
static WEBP_INLINE double GetCombinedEntropy(const uint32_t *const X, const uint32_t *const Y, int length, int is_X_used, int is_Y_used, int trivial_at_end) { VP8LStreaks stats; if (trivial_at_end) { // pixel into 0xff000000 | (pixel << 8) in VP8LBundleColorMap. // BitsEntropyRefine is 0...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/histogram_enc.c
static WEBP_INLINE void HistogramAdd(const VP8LHistogram *const a, const VP8LHistogram *const b, VP8LHistogram *const out) { VP8LHistogramAdd(a, b, out); out->trivial_symbol_ = (a->trivial_symbol_ == b->trivial_symbol_) ...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/histogram_enc.c
static void DominantCostRangeInit(DominantCostRange *const c) { c->literal_max_ = 0.; c->literal_min_ = MAX_COST; c->red_max_ = 0.; c->red_min_ = MAX_COST; c->blue_max_ = 0.; c->blue_min_ = MAX_COST; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/histogram_enc.c
static void HistogramCopyAndAnalyze(VP8LHistogramSet *const orig_histo, VP8LHistogramSet *const image_histo, int *const num_used, uint16_t *const histogram_symbols) { int i, cluster_id; int num_used_orig = *n...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/histogram_enc.c
static void HistogramAnalyzeEntropyBin(VP8LHistogramSet *const image_histo, uint16_t *const bin_map, int low_effort) { int i; VP8LHistogram **const histograms = image_histo->histograms; const int histo_size = image_histo->size; Domina...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/histogram_enc.c
static void HistoQueuePopPair(HistoQueue *const histo_queue, HistogramPair *const pair) { assert(pair >= histo_queue->queue && pair < (histo_queue->queue + histo_queue->size)); assert(histo_queue->size > 0); *pair = histo_queue->queue[histo_queue->size - 1]; --histo_queue-...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/histogram_enc.c
static int PairComparison(const void *idx1, const void *idx2) { return (*(int *)idx1 - *(int *)idx2); }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/histogram_enc.c
static void RemoveEmptyHistograms(VP8LHistogramSet *const image_histo) { uint32_t size; int i; for (i = 0, size = 0; i < image_histo->size; ++i) { if (image_histo->histograms[i] == NULL) continue; image_histo->histograms[size++] = image_histo->histograms[i]; } image_histo->size = size; }
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/iterator_enc.c
void VP8IteratorSetRow(VP8EncIterator *const it, int y) { VP8Encoder *const enc = it->enc_; it->x_ = 0; it->y_ = y; it->bw_ = &enc->parts_[y & (enc->num_parts_ - 1)]; it->preds_ = enc->preds_ + y * 4 * enc->preds_w_; it->nz_ = enc->nz_; it->mb_ = enc->mb_info_ + y * enc->mb_w_; it->y_top_ = enc->y_top_...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/iterator_enc.c
static WEBP_INLINE int MinSize(int a, int b) { return (a < b) ? a : b; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/iterator_enc.c
static void ImportBlock(const uint8_t *src, int src_stride, uint8_t *dst, int w, int h, int size) { int i; for (i = 0; i < h; ++i) { memcpy(dst, src, w); if (w < size) { memset(dst + w, dst[w - 1], size - w); } dst += BPS; src += src_stride; } for (i = h; i < s...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/iterator_enc.c
void VP8IteratorSaveBoundary(VP8EncIterator *const it) { VP8Encoder *const enc = it->enc_; const int x = it->x_, y = it->y_; const uint8_t *const ysrc = it->yuv_out_ + Y_OFF_ENC; const uint8_t *const uvsrc = it->yuv_out_ + U_OFF_ENC; if (x < enc->mb_w_ - 1) { int i; for (i = 0; i < 16; ++i) { it...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/iterator_enc.c
int VP8IteratorNext(VP8EncIterator *const it) { if (++it->x_ == it->enc_->mb_w_) { VP8IteratorSetRow(it, ++it->y_); } else { it->preds_ += 4; it->mb_ += 1; it->nz_ += 1; it->y_top_ += 16; it->uv_top_ += 16; } return (0 < --it->count_down_); }
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/near_lossless_enc.c
void VP8LNearLosslessStub(void) {} #endif
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/picture_csp_enc.c
int WebPPictureHasTransparency(const WebPPicture *picture) { if (picture == NULL) return 0; if (!picture->use_argb) { return CheckNonOpaque(picture->a, picture->width, picture->height, 1, picture->a_stride); } else { const int alpha_offset = ALPHA_OFFSET; return CheckNonO...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/picture_csp_enc.c
static WEBP_INLINE int LinearToGamma(uint32_t base_value, int shift) { return (int)(base_value << shift); } #endif
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/picture_csp_enc.c
static int RGBToU(int r, int g, int b, VP8Random *const rg) { return (rg == NULL) ? VP8RGBToU(r, g, b, YUV_HALF << 2) : VP8RGBToU(r, g, b, VP8RandomBits(rg, YUV_FIX + 2)); }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/picture_csp_enc.c
static WEBP_INLINE uint32_t GammaToLinearS(int v) { return kGammaToLinearTabS[v]; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/picture_csp_enc.c
static WEBP_INLINE uint32_t LinearToGammaS(uint32_t value) { const uint32_t v = value * kGammaTabSize; const uint32_t tab_pos = v >> GAMMA_TO_LINEAR_BITS; // fractional part, in GAMMA_TO_LINEAR_BITS fixed-point precision const uint32_t x = v - (tab_pos << GAMMA_TO_LINEAR_BITS); // fractional part // v0 / v1 ...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/picture_csp_enc.c
static WEBP_INLINE uint32_t LinearToGammaS(uint32_t value) { return (MAX_Y_T * value) >> GAMMA_TO_LINEAR_BITS; } #endif
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/picture_csp_enc.c
static uint8_t clip_8b(fixed_t v) { return (!(v & ~0xff)) ? (uint8_t)v : (v < 0) ? 0u : 255u; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/picture_csp_enc.c
static uint32_t ScaleDown(int a, int b, int c, int d) { const uint32_t A = GammaToLinearS(a); const uint32_t B = GammaToLinearS(b); const uint32_t C = GammaToLinearS(c); const uint32_t D = GammaToLinearS(d); return LinearToGammaS((A + B + C + D + 2) >> 2); }
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/picture_csp_enc.c
static WEBP_INLINE fixed_y_t UpLift(uint8_t a) { return ((fixed_y_t)a << SFIX) | SHALF; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/picture_csp_enc.c
static void ImportOneRow(const uint8_t *const r_ptr, const uint8_t *const g_ptr, const uint8_t *const b_ptr, int step, int pic_width, fixed_y_t *const dst) { int i; const int w = (pic_width + 1) & ~1; for (i = 0; i < pic_width; ++i) { const int off = i * step;...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/picture_csp_enc.c
static WEBP_INLINE uint8_t ConvertRGBToY(int r, int g, int b) { const int luma = 16839 * r + 33059 * g + 6420 * b + SROUNDER; return clip_8b(16 + (luma >> (YUV_FIX + SFIX))); }
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/picture_csp_enc.c
static int ConvertWRGBToYUV(const fixed_y_t *best_y, const fixed_t *best_uv, WebPPicture *const picture) { int i, j; uint8_t *dst_y = picture->y; uint8_t *dst_u = picture->u; uint8_t *dst_v = picture->v; const fixed_t *const best_uv_base = best_uv; const int w = (picture->width +...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/picture_enc.c
static void WebPPictureResetBufferARGB(WebPPicture *const picture) { picture->memory_argb_ = NULL; picture->argb = NULL; picture->argb_stride = 0; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/picture_psnr_enc.c
static double AccumulateLSIM(const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, int w, int h) { int x, y; double total_sse = 0.; for (y = 0; y < h; ++y) { const int y_0 = (y - RADIUS < 0) ? 0 : y - RADIUS; const int y_1 = (y + RADIUS + 1 >= h) ? h : y + R...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/picture_psnr_enc.c
static double GetPSNR(double v, double size) { return (v > 0. && size > 0.) ? -4.3429448 * log(v / (size * 255 * 255.)) : kMinDistortion_dB; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/picture_rescale_enc.c
int WebPPictureCopy(const WebPPicture *src, WebPPicture *dst) { if (src == NULL || dst == NULL) return 0; if (src == dst) return 1; PictureGrabSpecs(src, dst); if (!WebPPictureAlloc(dst)) return 0; if (!src->use_argb) { WebPCopyPlane(src->y, src->y_stride, dst->y, dst->y_stride, dst->width,...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/picture_rescale_enc.c
int WebPPictureIsView(const WebPPicture *picture) { if (picture == NULL) return 0; if (picture->use_argb) { return (picture->memory_argb_ == NULL); } return (picture->memory_ == NULL); }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/picture_rescale_enc.c
static void AlphaMultiplyARGB(WebPPicture *const pic, int inverse) { assert(pic->argb != NULL); WebPMultARGBRows((uint8_t *)pic->argb, pic->argb_stride * sizeof(*pic->argb), pic->width, pic->height, inverse); }
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/picture_tools_enc.c
static void Flatten(uint8_t *ptr, int v, int stride, int size) { int y; for (y = 0; y < size; ++y) { memset(ptr, v, size); ptr += stride; } }
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/picture_tools_enc.c
static int SmoothenBlock(const uint8_t *a_ptr, int a_stride, uint8_t *y_ptr, int y_stride, int width, int height) { int sum = 0, count = 0; int x, y; const uint8_t *alpha_ptr = a_ptr; uint8_t *luma_ptr = y_ptr; for (y = 0; y < height; ++y) { for (x = 0; x < width; ++x) { if ...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/picture_tools_enc.c
void WebPReplaceTransparentPixels(WebPPicture *pic, uint32_t color) { if (pic != NULL && pic->use_argb) { int y = pic->height; uint32_t *argb = pic->argb; color &= 0xffffffu; WebPInitAlphaProcessing(); while (y-- > 0) { WebPAlphaReplace(argb, pic->width, color); argb += pic->argb_strid...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/predictor_enc.c
static WEBP_INLINE void PredictBatch(int mode, int x_start, int y, int num_pixels, const uint32_t *current, const uint32_t *upper, uint32_t *out) { if (x_start == 0) { if (y == 0) { VP8LPredictorsSub[0](current, NULL, 1, out); } ...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/predictor_enc.c
static uint32_t AddGreenToBlueAndRed(uint32_t argb) { const uint32_t green = (argb >> 8) & 0xff; uint32_t red_blue = argb & 0x00ff00ffu; red_blue += (green << 16) | green; red_blue &= 0x00ff00ffu; return (argb & 0xff00ff00u) | red_blue; }
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/predictor_enc.c
static uint8_t NearLosslessComponent(uint8_t value, uint8_t predict, uint8_t boundary, int quantization) { const int residual = (value - predict) & 0xff; const int boundary_residual = (boundary - predict) & 0xff; const int lower = residual & ~(quantization - 1); const int up...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/predictor_enc.c
static WEBP_INLINE uint8_t NearLosslessDiff(uint8_t a, uint8_t b) { return (uint8_t)((((int)(a) - (int)(b))) & 0xff); }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/predictor_enc.c
void VP8LResidualImage(int width, int height, int bits, int low_effort, uint32_t *const argb, uint32_t *const argb_scratch, uint32_t *const image, int near_lossless_quality, int exact, int used_subtract_green) { const int tiles_per_row = VP8LSubSamp...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/predictor_enc.c
static WEBP_INLINE void ColorCodeToMultipliers(uint32_t color_code, VP8LMultipliers *const m) { m->green_to_red_ = (color_code >> 0) & 0xff; m->green_to_blue_ = (color_code >> 8) & 0xff; m->red_to_blue_ = (color_code >> 16) & 0xff; }
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/predictor_enc.c
static void GetBestGreenToRed(const uint32_t *argb, int stride, int tile_width, int tile_height, VP8LMultipliers prev_x, VP8LMultipliers prev_y, int quality, const int accumulated_red_histo[256], VP8L...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/predictor_enc.c
static void CopyTileWithColorTransform(int xsize, int ysize, int tile_x, int tile_y, int max_tile_size, VP8LMultipliers color_transform, uint32_t *argb) { const int xscan = GetMin(max_tile_size, xsize...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/quant_enc.c
static WEBP_INLINE int clip(int v, int m, int M) { return v < m ? m : v > M ? M : v; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/quant_enc.c
static int SegmentsAreEquivalent(const VP8SegmentInfo *const S1, const VP8SegmentInfo *const S2) { return (S1->quant_ == S2->quant_) && (S1->fstrength_ == S2->fstrength_); }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/quant_enc.c
static void SimplifySegments(VP8Encoder *const enc) { int map[NUM_MB_SEGMENTS] = {0, 1, 2, 3}; // explicit check is needed to avoid a spurious warning about 'i' exceeding // array bounds of 'dqm_' with some compilers (noticed with gcc-4.9). const int num_segments = (enc->segment_hdr_.num_segments_ < NUM_MB_SEG...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/quant_enc.c
static WEBP_INLINE score_t RDScoreTrellis(int lambda, score_t rate, score_t distortion) { return rate * lambda + RD_DISTO_MULT * distortion; }
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/quant_enc.c
static void StoreDiffusionErrors(VP8EncIterator *const it, const VP8ModeScore *const rd) { int ch; for (ch = 0; ch <= 1; ++ch) { int8_t *const top = it->top_derr_[it->x_][ch]; int8_t *const left = it->left_derr_[ch]; left[0] = rd->derr[ch][0]; left[1] = 3 * rd->derr[...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/quant_enc.c
int VP8Decimate(VP8EncIterator *const it, VP8ModeScore *const rd, VP8RDLevel rd_opt) { int is_skipped; const int method = it->enc_->method_; InitScore(rd); // Luma4x4 predictions needs to be done as-we-go. VP8MakeLuma16Preds(it); VP8MakeChroma8Preds(it); if (rd_opt > RD_OPT_NONE) { ...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/syntax_enc.c
static WebPEncodingError PutRIFFHeader(const VP8Encoder *const enc, size_t riff_size) { const WebPPicture *const pic = enc->pic_; uint8_t riff[RIFF_HEADER_SIZE] = {'R', 'I', 'F', 'F', 0, 0, 0, 0, 'W', 'E', 'B', 'P'}; assert(riff_size...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/syntax_enc.c
static WebPEncodingError PutVP8XHeader(const VP8Encoder *const enc) { const WebPPicture *const pic = enc->pic_; uint8_t vp8x[CHUNK_HEADER_SIZE + VP8X_CHUNK_SIZE] = {'V', 'P', '8', 'X'}; uint32_t flags = 0; assert(IsVP8XNeeded(enc)); assert(pic->width >= 1 && pic->height >= 1); assert(pic->width <= MAX_CAN...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/syntax_enc.c
static void PutQuant(VP8BitWriter *const bw, const VP8Encoder *const enc) { VP8PutBits(bw, enc->base_quant_, 7); VP8PutSignedBits(bw, enc->dq_y1_dc_, 4); VP8PutSignedBits(bw, enc->dq_y2_dc_, 4); VP8PutSignedBits(bw, enc->dq_y2_ac_, 4); VP8PutSignedBits(bw, enc->dq_uv_dc_, 4); VP8PutSignedBits(bw, enc->dq_uv...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/syntax_enc.c
static int EmitPartitionsSize(const VP8Encoder *const enc, WebPPicture *const pic) { uint8_t buf[3 * (MAX_NUM_PARTITIONS - 1)]; int p; for (p = 0; p < enc->num_parts_ - 1; ++p) { const size_t part_size = VP8BitWriterSize(enc->parts_ + p); if (part_size >= VP8_MAX_PARTITION_SI...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/token_enc.c
static int TBufferNewPage(VP8TBuffer *const b) { VP8Tokens *page = NULL; if (!b->error_) { const size_t size = sizeof(*page) + b->page_size_ * sizeof(token_t); page = (VP8Tokens *)WebPSafeMalloc(1ULL, size); } if (page == NULL) { b->error_ = 1; return 0; } page->next_ = NULL; *b->last_pag...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/token_enc.c
int VP8EmitTokens(VP8TBuffer *const b, VP8BitWriter *const bw, const uint8_t *const probas, int final_pass) { const VP8Tokens *p = b->pages_; assert(!b->error_); while (p != NULL) { const VP8Tokens *const next = p->next_; const int N = (next == NULL) ? b->left_ : 0; int n = b->page_s...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/token_enc.c
size_t VP8EstimateTokenSize(VP8TBuffer *const b, const uint8_t *const probas) { size_t size = 0; const VP8Tokens *p = b->pages_; assert(!b->error_); while (p != NULL) { const VP8Tokens *const next = p->next_; const int N = (next == NULL) ? b->left_ : 0; int n = b->page_size_; const token_t *cons...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/tree_enc.c
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)); // but that's ~11k of static data. Better call VP8CalculateLevel...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/tree_enc.c
static void PutI16Mode(VP8BitWriter *const bw, int mode) { if (VP8PutBit(bw, (mode == TM_PRED || mode == H_PRED), 156)) { VP8PutBit(bw, mode == TM_PRED, 128); } else { VP8PutBit(bw, mode == V_PRED, 163); // VE or DC } }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/vp8l_enc.c
static int PaletteCompareColorsForQsort(const void *p1, const void *p2) { const uint32_t a = WebPMemToUint32((uint8_t *)p1); const uint32_t b = WebPMemToUint32((uint8_t *)p2); assert(a != b); return (a < b) ? -1 : 1; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/vp8l_enc.c
Note that the last & 0xff is a no-operation in the next statement, but removed by most compilers and is here only for regularity of the code. static WEBP_INLINE uint32_t PaletteColorDistance(uint32_t col1, uint32_t col2) { const uint32_t diff = VP8LSubPixels(col1, col2); const int kMoreWeightForRGBThanForAlpha ...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/vp8l_enc.c
static void AddSingleSubGreen(int p, uint32_t *const r, uint32_t *const b) { const int green = p >> 8; ++r[((p >> 16) - green) & 0xff]; ++b[((p >> 0) - green) & 0xff]; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/vp8l_enc.c
static int GetHistoBits(int method, int use_palette, int width, int height) { int histo_bits = (use_palette ? 9 : 7) - method; while (1) { const int huff_image_size = VP8LSubSampleSize(width, histo_bits) * VP8LSubSampleSize(height, histo_bits); if (huff_image_size <= MAX_HUF...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/vp8l_enc.c
static void ClearHuffmanTreeIfOnlyOneSymbol(HuffmanTreeCode *const huffman_code) { int k; int count = 0; for (k = 0; k < huffman_code->num_symbols; ++k) { if (huffman_code->code_lengths[k] != 0) { ++count; if (count > 1) return; } } for (k = 0; k < huffman_code->num_symbols; ++k) ...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/vp8l_enc.c
static void StoreHuffmanCode(VP8LBitWriter *const bw, HuffmanTree *const huff_tree, HuffmanTreeToken *const tokens, const HuffmanTreeCode *const huffman_code) { int i; int count = 0; int symbols[2] = {0, 0}; const int kMaxBit...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/vp8l_enc.c
static WEBP_INLINE void WriteHuffmanCode(VP8LBitWriter *const bw, const HuffmanTreeCode *const code, int code_index) { const int depth = code->code_lengths[code_index]; const int symbol = code->codes[code_index]; VP8LPutBits(bw, sy...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/vp8l_enc.c
static WebPEncodingError WriteImage(const WebPPicture *const pic, VP8LBitWriter *const bw, size_t *const coded_size) { WebPEncodingError err = VP8_ENC_OK; const uint8_t *const webpll_data = VP8LBitWriterFinish(bw); const size_t webpll_size =...
[ 0, 0 ]
Chromium
third_party/libwebp/src/enc/vp8l_enc.c
static WebPEncodingError AllocateTransformBuffer(VP8LEncoder *const enc, int width, int height) { WebPEncodingError err = VP8_ENC_OK; const uint64_t image_size = width * height; // pixel in each, plus 2 regular scanlines of bytes. // TODO(skal): Clean up by usin...
[ 1, 1 ]
Chromium
third_party/libwebp/src/enc/vp8l_enc.c
static WebPEncodingError MakeInputImageCopy(VP8LEncoder *const enc) { WebPEncodingError err = VP8_ENC_OK; const WebPPicture *const picture = enc->pic_; const int width = picture->width; const int height = picture->height; err = AllocateTransformBuffer(enc, width, height); if (err != VP8_ENC_OK) return...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/vp8l_enc.c
static WebPEncodingError MapImageFromPalette(VP8LEncoder *const enc, int in_place) { WebPEncodingError err = VP8_ENC_OK; const WebPPicture *const pic = enc->pic_; const int width = pic->width; const int height = pic->height; const uint32_t *const palette = enc->pal...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/vp8l_enc.c
static WebPEncodingError EncodePalette(VP8LBitWriter *const bw, int low_effort, VP8LEncoder *const enc) { int i; uint32_t tmp_palette[MAX_PALETTE_SIZE]; const int palette_size = enc->palette_size_; const uint32_t *const palette = enc->palette_; VP8LPutBits(bw, TRANSFORM_...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/webp_enc.c
static void FinalizePSNR(const VP8Encoder *const enc) { WebPAuxStats *stats = enc->pic_->stats; const uint64_t size = enc->sse_count_; const uint64_t *const sse = enc->sse_; stats->PSNR[0] = (float)GetPSNR(sse[0], size); stats->PSNR[1] = (float)GetPSNR(sse[1], size / 4); stats->PSNR[2] = (float)GetPSNR(sse[...
[ 1, 0 ]
Chromium
third_party/libwebp/src/enc/webp_enc.c
int WebPEncodingSetError(const WebPPicture *const pic, WebPEncodingError error) { assert((int)error < VP8_ENC_ERROR_LAST); assert((int)error >= VP8_ENC_OK); ((WebPPicture *)pic)->error_code = error; return 0; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static void SanitizeEncoderOptions(WebPAnimEncoderOptions *const enc_options) { int print_warning = enc_options->verbose; if (enc_options->minimize_size) { DisableKeyframes(enc_options); } if (enc_options->kmax == 1) { enc_options->kmin = 0; enc_options->kmax = 0; return; } else if (enc_opti...
[ 1, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
int WebPAnimEncoderOptionsInitInternal(WebPAnimEncoderOptions *enc_options, int abi_version) { if (enc_options == NULL || WEBP_ABI_IS_INCOMPATIBLE(abi_version, WEBP_MUX_ABI_VERSION)) { return 0; } DefaultEncoderOptions(enc_options); return 1; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static void WebPUtilClearPic(WebPPicture *const picture, const FrameRectangle *const rect) { if (rect != NULL) { ClearRectangle(picture, rect->x_offset_, rect->y_offset_, rect->width_, rect->height_); } else { ClearRectangle(picture, 0, 0, picture->width, pic...
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static void FrameRelease(EncodedFrame *const encoded_frame) { if (encoded_frame != NULL) { WebPDataClear(&encoded_frame->sub_frame_.bitstream); WebPDataClear(&encoded_frame->key_frame_.bitstream); memset(encoded_frame, 0, sizeof(*encoded_frame)); } }
[ 1, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static int IsEmptyRect(const FrameRectangle *const rect) { return (rect->width_ == 0) || (rect->height_ == 0); }
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static int QualityToMaxDiff(float quality) { const double val = pow(quality / 100., 0.5); const double max_diff = 31 * (1 - val) + 1 * val; return (int)(max_diff + 0.5); }
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static int SubFrameParamsInit(SubFrameParams *const params, int should_try, int empty_rect_allowed) { params->should_try_ = should_try; params->empty_rect_allowed_ = empty_rect_allowed; if (!WebPPictureInit(&params->sub_frame_ll_) || !WebPPictureInit(&params->sub_frame_lossy_)...
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static WEBP_INLINE int clip(int v, int min_v, int max_v) { return (v < min_v) ? min_v : (v > max_v) ? max_v : v; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static uint32_t RectArea(const FrameRectangle *const rect) { return (uint32_t)rect->width_ * rect->height_; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static int IsLossyBlendingPossible(const WebPPicture *const src, const WebPPicture *const dst, const FrameRectangle *const rect, float quality) { const int max_allowed_diff_lossy = QualityToMaxDiff(quality); int...
[ 1, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static int IncreaseTransparency(const WebPPicture *const src, const FrameRectangle *const rect, WebPPicture *const dst) { int i, j; int modified = 0; assert(src != NULL && dst != NULL && rect != NULL); assert(src->width == dst->width && src->height...
[ 1, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static int EncodeFrame(const WebPConfig *const config, WebPPicture *const pic, WebPMemoryWriter *const memory) { pic->use_argb = 1; pic->writer = WebPMemoryWrite; pic->custom_ptr = memory; if (!WebPEncode(config, pic)) { return 0; } return 1; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static void CopyCurrentCanvas(WebPAnimEncoder *const enc) { if (enc->curr_canvas_copy_modified_) { WebPCopyPixels(enc->curr_canvas_, &enc->curr_canvas_copy_); enc->curr_canvas_copy_.progress_hook = enc->curr_canvas_->progress_hook; enc->curr_canvas_copy_.user_data = enc->curr_canvas_->user_data; enc-...
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static void PickBestCandidate(WebPAnimEncoder *const enc, Candidate *const candidates, int is_key_frame, EncodedFrame *const encoded_frame) { int i; int best_idx = -1; size_t best_size = ~0; for (i = 0; i < CANDIDATE_COUNT; ++i) { if (candidates[i]...
[ 1, 1 ]
Chromium
third_party/libwebp/src/mux/anim_encode.c
static int DecodeFrameOntoCanvas(const WebPMuxFrameInfo *const frame, WebPPicture *const canvas) { const WebPData *const image = &frame->bitstream; WebPPicture sub_image; WebPDecoderConfig config; WebPInitDecoderConfig(&config); WebPUtilClearPic(canvas, NULL); if (WebPGetFea...
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/muxedit.c
static void DeleteAllImages(WebPMuxImage **const wpi_list) { while (*wpi_list != NULL) { *wpi_list = MuxImageDelete(*wpi_list); } }
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/muxedit.c
WebPMuxError WebPMuxSetChunk(WebPMux *mux, const char fourcc[4], const WebPData *chunk_data, int copy_data) { uint32_t tag; WebPMuxError err; if (mux == NULL || fourcc == NULL || chunk_data == NULL || chunk_data->bytes == NULL || chunk_data->size > MAX_CHUNK_PAYLOAD) { retur...
[ 1, 0 ]
Chromium
third_party/libwebp/src/mux/muxedit.c
static WebPMuxError GetFrameInfo(const WebPChunk *const frame_chunk, int *const x_offset, int *const y_offset, int *const duration) { const WebPData *const data = &frame_chunk->data_; const size_t expected_data_size = ANMF_CHUNK_SIZE; assert(frame_...
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/muxedit.c
static WebPMuxError GetImageInfo(const WebPMuxImage *const wpi, int *const x_offset, int *const y_offset, int *const duration, int *const width, int *const height) { const WebPChunk *const frame_chunk = wpi->header_; ...
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/muxedit.c
static WebPMuxError GetAdjustedCanvasSize(const WebPMux *const mux, int *const width, int *const height) { WebPMuxImage *wpi = NULL; assert(mux != NULL); assert(width != NULL && height != NULL); wpi = mux->images_; assert(wpi != NULL); assert(wpi->img_ != NULL); ...
[ 1, 0 ]
Chromium
third_party/libwebp/src/mux/muxinternal.c
WebPChunk *ChunkRelease(WebPChunk *const chunk) { WebPChunk *next; if (chunk == NULL) return NULL; if (chunk->owner_) { WebPDataClear(&chunk->data_); } next = chunk->next_; ChunkInit(chunk); return next; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/muxinternal.c
WebPChunk *ChunkSearchList(WebPChunk *first, uint32_t nth, uint32_t tag) { uint32_t iter = nth; first = ChunkSearchNextInList(first, tag); if (first == NULL) return NULL; while (--iter != 0) { WebPChunk *next_chunk = ChunkSearchNextInList(first->next_, tag); if (next_chunk == NULL) break; ...
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/muxinternal.c
WebPMuxError ChunkAssignData(WebPChunk *chunk, const WebPData *const data, int copy_data, uint32_t tag) { if (tag == kChunks[IDX_VP8X].tag || tag == kChunks[IDX_ANIM].tag) { copy_data = 1; } ChunkRelease(chunk); if (data != NULL) { if (copy_data) { // Copy data. if ...
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/muxinternal.c
WebPMuxError ChunkAppend(WebPChunk *const chunk, WebPChunk ***const chunk_list) { assert(chunk_list != NULL && *chunk_list != NULL); if (**chunk_list == NULL) { ChunkSetHead(chunk, *chunk_list); } else { WebPChunk *last_chunk = **chunk_list; while (last_chunk->next_ != NULL)...
[ 1, 0 ]
Chromium
third_party/libwebp/src/mux/muxinternal.c
WebPChunk *ChunkDelete(WebPChunk *const chunk) { WebPChunk *const next = ChunkRelease(chunk); WebPSafeFree(chunk); return next; }
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/muxinternal.c
void ChunkListDelete(WebPChunk **const chunk_list) { while (*chunk_list != NULL) { *chunk_list = ChunkDelete(*chunk_list); } }
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/muxinternal.c
int MuxImageCount(const WebPMuxImage *wpi_list, WebPChunkId id) { int count = 0; const WebPMuxImage *current; for (current = wpi_list; current != NULL; current = current->next_) { if (id == WEBP_CHUNK_NIL) { ++count; } else { const WebPChunk *const wpi_chunk = *GetChunkListFromId(current, id);...
[ 0, 0 ]
Chromium
third_party/libwebp/src/mux/muxinternal.c
size_t MuxImageDiskSize(const WebPMuxImage *const wpi) { size_t size = 0; if (wpi->header_ != NULL) size += ChunkDiskSize(wpi->header_); if (wpi->alpha_ != NULL) size += ChunkDiskSize(wpi->alpha_); if (wpi->img_ != NULL) size += ChunkDiskSize(wpi->img_); if (wpi->unknown_ != NULL) size += Chun...
[ 1, 0 ]