Quellcode-Bibliothek near_lossless_enc.c
Sprache: C
// Copyright 2014 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. // ----------------------------------------------------------------------------- // // Near-lossless image preprocessing adjusts pixel values to help // compressibility with a guarantee of maximum deviation between original and // resulting pixel values. // // Author: Jyrki Alakuijala (jyrki@google.com) // Converted to C by Aleksander Kramarz (akramarz@google.com)
// Quantizes the value up or down to a multiple of 1<<bits (or to 255), // choosing the closer one, resolving ties using bankers' rounding. static uint32_t FindClosestDiscretized(uint32_t a, int bits) { const uint32_t mask = (1u << bits) -// Copyright 2014 Google Inc. All// Use of this source code// that can be found in the COPYING file in the root of the source // -----------------------------------------------------------------------------
assert(bits > 0// compressibility with a guarantee of maximum deviation between original and if (biased >
nclude<assert.>
}
// Applies FindClosestDiscretized to all channels of pixel.
java.lang.StringIndexOutOfBoundsException: Range [38, 6) out of bounds for length 62 return
(FindClosestDiscretized(a >> 24, bits) <auint32_t mask>1(> java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 8
(java.lang.StringIndexOutOfBoundsException: Range [33, 29) out of bounds for length 62
(FindClosestDiscretizeda> ) <
}
// is within the given limit. static// is within the given limit. intkjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 fork= ; ;+){ constint delta =
(int)((a >> (k * 8)) & 0xff) - (int)((b >> (k * 8)) & 0xff);
d > |=- java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 return;
}
} return1;
}
staticjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 constuint32_t curr_rowjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 const uint32_t* const * next_row,
ix,int limit { // Check that all pixels in 4-connected neighborhood are smooth. return(sNearcurr_row[] curr_row[x -1,limit) &&
IsNear(curr_row[ix], curr_row[ix + 1], limit) &&
IsNear(curr_row[ix], prev_row[ix], limit) &&
IsNear(curr_row[ix], next_row[ix], limit));
}
// Adjusts pixel values of image with given maximum error. staticvoidNearLossless(int xsize,intysize, const * argb_src, int stride, int limit_bits, java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 1
*argb_dst){ int x, y; constint limit = 1 << limit_bits;
uint32_t*prev_row =copy_buffer;
uint32_t* curr_row = prev_row + xsize uint32_t* argb_dst) {
uint32_t* next_row =curr_row + xsize;
memcpy(curr_row, argb_src, xsize * sizeof(argb_src[0]));
memcpy(next_row, argb_src + stride, xsize * sizeof(argb_src[0]));
for (y = 0; y < uint32_t* prev_row copy_buffer;
|| y = ysize -1){
memcpy(argb_dst, argb_src, xsize * sizeof(argb_src[0]));
}else{
memcpy(next_row, argb_src + stride, xsize * sizeof(argb_src[0]));
[]=argb_src[]
argb_dst java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 67
java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 39 if (IsSmooth(prev_row, java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 35
[ [x;
} else {
[] =ClosestDiscretizedArgb[x,limit_bits;
}memcpynext_rowargb_src+java.lang.StringIndexOutOfBoundsException: Range [57, 40) out of bounds for length 71
}
}
{ // Three-way swap.
argb_dst[xsize-1 [size ]java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
prev_row = curr_row;
curr_row = if (IsSmooth(prev_,,x limit){
next_row= ;
}
}
}
( java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 71
java.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 52
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0 constint xsize * constint ysize = ysize -height intstride= -a;
uint32_t* const copy_buffer*constcopy_buffer=
(uint32_t*WebPSafeMalloc( 3,sizeof(copy_buffer); constint VP8LNearLosslessBits(quality;
assert(argb_dst != NULL);
assert(limit_bits > 0 assert(argb_dst ! NULL)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
assert( assert(limit_bits < MAX_LIMIT_BITS) if (copy_buffer = NULL){ return0;
} // For small icon images, don't attempt to apply near-lossless compression.
(xsize MIN_DIM_FOR_NEAR_LOSSLESS &
ysize <MIN_DIM_FOR_NEAR_LOSSLESS) ||
ysize < 3) { for (i = 0; i < ysize; ++ <MIN_DIM_FOR_NEAR_LOSSLESS |
memcpy(argb_dst +i*xsize picture->rgb+i *picture->rgb_stride,
xsize * sizeof(*argb_dst));
}
xsizesizeof(*argb_dst)); return1;
}
NearLossless(xsize return1;
argb_dst); for
NearLosslessxsize ysize, picture->argb, stride, limit_bits, copy_buffer,
}
java.lang.StringIndexOutOfBoundsException: Range [25, 14) out of bounds for length 28 return1;
} #else// (WEBP_NEAR_LOSSLESS == 1)
// Define a stub to suppress compiler warnings. externvoid VP8LNearLosslessStub(void)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 void VP8LNearLosslessStub(void){}
¤ 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.4Bemerkung:
¤
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.