mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 05:38:22 +01:00
cosmetics: fix comment line lengths
add additional '-' to //----... style comments globally instead of polluting further commits Change-Id: I951acc68b7b5384b4d6e235349b0067d1aa6fa8b
This commit is contained in:
parent
c9e037ab3e
commit
c7e86abab6
@ -57,7 +57,7 @@ DEFINE_GUID(GUID_WICPixelFormat32bppRGBA,
|
||||
extern void* VP8EncGetCPUInfo; // opaque forward declaration.
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static int verbose = 0;
|
||||
|
||||
@ -599,7 +599,7 @@ static void PrintExtraInfo(const WebPPicture* const pic, int short_output) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static int MyWriter(const uint8_t* data, size_t data_size,
|
||||
const WebPPicture* const pic) {
|
||||
@ -638,7 +638,7 @@ static int DumpPicture(const WebPPicture* const picture, const char* PGM_name) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static void HelpShort(void) {
|
||||
printf("Usage:\n\n");
|
||||
@ -706,7 +706,7 @@ static void HelpLong(void) {
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Error messages
|
||||
|
||||
static const char* const kErrorMessages[] = {
|
||||
@ -726,7 +726,7 @@ static const char* const kErrorMessages[] = {
|
||||
"BAD_WRITE: Picture writer returned an I/O error"
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
const char *in_file = NULL, *out_file = NULL, *dump_file = NULL;
|
||||
@ -953,4 +953,4 @@ int main(int argc, const char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -49,7 +49,7 @@ static int verbose = 0;
|
||||
extern void* VP8DecGetCPUInfo; // opaque forward declaration.
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Output types
|
||||
typedef enum {
|
||||
@ -492,7 +492,7 @@ int main(int argc, const char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -20,7 +20,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec,
|
||||
int row, int num_rows) {
|
||||
|
@ -15,7 +15,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// VP8BitReader
|
||||
|
||||
void VP8InitBitReader(VP8BitReader* const br,
|
||||
@ -56,7 +56,7 @@ const uint8_t kVP8NewRange[128] = {
|
||||
241, 243, 245, 247, 249, 251, 253, 127
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Higher-level calls
|
||||
|
||||
uint32_t VP8GetValue(VP8BitReader* const br, int bits) {
|
||||
@ -72,7 +72,7 @@ int32_t VP8GetSignedValue(VP8BitReader* const br, int bits) {
|
||||
return VP8Get(br) ? -value : value;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -19,7 +19,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Bitreader and code-tree reader
|
||||
|
||||
typedef struct {
|
||||
|
@ -17,7 +17,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// WebPDecBuffer
|
||||
|
||||
// Number of bytes per pixel for the different color-spaces.
|
||||
@ -151,7 +151,7 @@ VP8StatusCode WebPAllocateDecBuffer(int w, int h,
|
||||
return AllocateBuffer(out);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// constructors / destructors
|
||||
|
||||
int WebPInitDecBufferInternal(WebPDecBuffer* const buffer, int version) {
|
||||
@ -191,7 +191,7 @@ void WebPGrabDecBuffer(WebPDecBuffer* const src, WebPDecBuffer* const dst) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -15,7 +15,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// run-time tables (~4k)
|
||||
|
||||
static uint8_t abs0[255 + 255 + 1]; // abs(i)
|
||||
@ -52,7 +52,7 @@ static inline uint8_t clip_8b(int v) {
|
||||
return (!(v & ~0xff)) ? v : (v < 0) ? 0 : 255;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Transforms (Paragraph 14.4)
|
||||
|
||||
#define STORE(x, y, v) \
|
||||
@ -133,7 +133,7 @@ static void TransformDCUV(const int16_t* in, uint8_t* dst) {
|
||||
|
||||
#undef STORE
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Paragraph 14.3
|
||||
|
||||
static void TransformWHT(const int16_t* in, int16_t* out) {
|
||||
@ -165,7 +165,7 @@ static void TransformWHT(const int16_t* in, int16_t* out) {
|
||||
|
||||
void (*VP8TransformWHT)(const int16_t* in, int16_t* out) = TransformWHT;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Intra predictions
|
||||
|
||||
#define OUT(x, y) dst[(x) + (y) * BPS]
|
||||
@ -187,7 +187,7 @@ static void TM4(uint8_t *dst) { TrueMotion(dst, 4); }
|
||||
static void TM8uv(uint8_t *dst) { TrueMotion(dst, 8); }
|
||||
static void TM16(uint8_t *dst) { TrueMotion(dst, 16); }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// 16x16
|
||||
|
||||
static void VE16(uint8_t *dst) { // vertical
|
||||
@ -243,7 +243,7 @@ static void DC16NoTopLeft(uint8_t *dst) { // DC with no top and left samples
|
||||
Put16(0x80, dst);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// 4x4
|
||||
|
||||
#define AVG3(a, b, c) (((a) + 2 * (b) + (c) + 2) >> 2)
|
||||
@ -405,7 +405,7 @@ static void HD4(uint8_t *dst) { // Horizontal-Down
|
||||
#undef AVG3
|
||||
#undef AVG2
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Chroma
|
||||
|
||||
static void VE8uv(uint8_t *dst) { // vertical
|
||||
@ -462,7 +462,7 @@ static void DC8uvNoTopLeft(uint8_t *dst) { // DC with nothing
|
||||
Put8x8uv(0x8080808080808080ULL, dst);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// default C implementations
|
||||
|
||||
VP8PredFunc VP8PredLuma4[NUM_BMODES] = {
|
||||
@ -479,7 +479,7 @@ VP8PredFunc VP8PredChroma8[NUM_B_DC_MODES] = {
|
||||
DC8uvNoTop, DC8uvNoLeft, DC8uvNoTopLeft
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Edge filtering functions
|
||||
|
||||
// 4 pixels in, 2 pixels out
|
||||
@ -541,7 +541,7 @@ static inline int needs_filter2(const uint8_t* p, int step, int t, int it) {
|
||||
abs0[255 + q2 - q1] <= it && abs0[255 + q1 - q0] <= it;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Simple In-loop filtering (Paragraph 15.2)
|
||||
|
||||
static void SimpleVFilter16(uint8_t* p, int stride, int thresh) {
|
||||
@ -578,7 +578,7 @@ static void SimpleHFilter16i(uint8_t* p, int stride, int thresh) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Complex In-loop filtering (Paragraph 15.3)
|
||||
|
||||
static inline void FilterLoop26(uint8_t* p, int hstride, int vstride, int size,
|
||||
@ -664,7 +664,7 @@ static void HFilter8i(uint8_t* u, uint8_t* v, int stride,
|
||||
FilterLoop24(v + 4, 1, stride, 8, thresh, ithresh, hev_thresh);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// SSE2 detection.
|
||||
//
|
||||
|
||||
@ -705,7 +705,7 @@ VP8CPUInfo VP8DecGetCPUInfo = x86CPUInfo;
|
||||
VP8CPUInfo VP8DecGetCPUInfo = NULL;
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
VP8Idct2 VP8Transform;
|
||||
VP8Idct VP8TransformUV;
|
||||
|
@ -19,7 +19,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Transforms (Paragraph 14.4)
|
||||
|
||||
static void TransformSSE2(const int16_t* in, uint8_t* dst, int do_two) {
|
||||
@ -240,7 +240,7 @@ static void TransformSSE2(const int16_t* in, uint8_t* dst, int do_two) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Loop Filter (Paragraph 15)
|
||||
|
||||
// Compute abs(p - q) = subs(p - q) OR subs(q - p)
|
||||
@ -337,7 +337,7 @@ static void NeedsFilter(const __m128i* p1, const __m128i* p0, const __m128i* q0,
|
||||
*mask = _mm_cmpeq_epi8(*mask, _mm_setzero_si128());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Edge filtering functions
|
||||
|
||||
// Applies filter on 2 pixels (p0 and q0)
|
||||
@ -586,7 +586,7 @@ static inline void Store16x4(uint8_t* r0, uint8_t* r8, int stride, __m128i* p1,
|
||||
Store4x4(q1, r8, stride);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Simple In-loop filtering (Paragraph 15.2)
|
||||
|
||||
static void SimpleVFilter16SSE2(uint8_t* p, int stride, int thresh) {
|
||||
@ -629,7 +629,7 @@ static void SimpleHFilter16iSSE2(uint8_t* p, int stride, int thresh) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Complex In-loop filtering (Paragraph 15.3)
|
||||
|
||||
#define MAX_DIFF1(p3, p2, p1, p0, m) { \
|
||||
|
@ -184,7 +184,7 @@ SSE2_UPSAMPLE_FUNC(UpsampleBgrKeepAlphaLinePairSSE2, VP8YuvToBgr, 4)
|
||||
#undef CONVERT2RGB
|
||||
#undef SSE2_UPSAMPLE_FUNC
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void WebPInitUpsamplersSSE2(void) {
|
||||
WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePairSSE2;
|
||||
|
@ -17,7 +17,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
int VP8DecodeLayer(VP8Decoder* const dec) {
|
||||
assert(dec);
|
||||
|
@ -58,7 +58,7 @@ static const uint16_t kAcTable[128] = {
|
||||
249, 254, 259, 264, 269, 274, 279, 284
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Paragraph 9.6
|
||||
|
||||
void VP8ParseQuant(VP8Decoder* const dec) {
|
||||
@ -104,7 +104,7 @@ void VP8ParseQuant(VP8Decoder* const dec) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -65,7 +65,7 @@ static const int8_t kMVRef4[6] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Default probabilities
|
||||
|
||||
// Inter
|
||||
@ -385,7 +385,7 @@ void VP8ParseIntraMode(VP8BitReader* const br, VP8Decoder* const dec) {
|
||||
: VP8GetBit(br, 183) ? TM_PRED : H_PRED;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Paragraph 13
|
||||
|
||||
static const uint8_t
|
||||
|
@ -20,13 +20,13 @@ extern "C" {
|
||||
#define RIFF_HEADER_SIZE 12
|
||||
#define VP8X_HEADER_SIZE 20
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
int WebPGetDecoderVersion(void) {
|
||||
return (DEC_MAJ_VERSION << 16) | (DEC_MIN_VERSION << 8) | DEC_REV_VERSION;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// VP8Decoder
|
||||
|
||||
static void SetOk(VP8Decoder* const dec) {
|
||||
@ -79,7 +79,7 @@ int VP8SetError(VP8Decoder* const dec,
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static inline uint32_t get_le32(const uint8_t* const data) {
|
||||
return data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
|
||||
@ -195,7 +195,7 @@ int VP8XGetInfo(const uint8_t** data_ptr, uint32_t* data_size_ptr,
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Header parsing
|
||||
|
||||
static void ResetSegmentHeader(VP8SegmentHeader* const hdr) {
|
||||
@ -534,7 +534,7 @@ int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Residual decoding (Paragraph 13.2 / 13.3)
|
||||
|
||||
static const uint8_t kBands[16 + 1] = {
|
||||
@ -713,7 +713,7 @@ static void ParseResiduals(VP8Decoder* const dec,
|
||||
}
|
||||
#undef PACK
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Main loop
|
||||
|
||||
int VP8DecodeMB(VP8Decoder* const dec, VP8BitReader* const token_br) {
|
||||
@ -857,7 +857,7 @@ void VP8Clear(VP8Decoder* const dec) {
|
||||
dec->ready_ = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -20,7 +20,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Various defines and enums
|
||||
|
||||
// version numbers
|
||||
@ -96,7 +96,7 @@ enum { MB_FEATURE_TREE_PROBS = 3,
|
||||
#define U_OFF (Y_OFF + BPS * 16 + BPS)
|
||||
#define V_OFF (U_OFF + 16)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Headers
|
||||
|
||||
typedef struct {
|
||||
@ -145,7 +145,7 @@ typedef struct {
|
||||
int mode_lf_delta_[NUM_MODE_LF_DELTAS];
|
||||
} VP8FilterHeader;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Informations about the macroblocks.
|
||||
|
||||
typedef struct { // filter specs
|
||||
@ -174,7 +174,7 @@ typedef struct {
|
||||
VP8Io io_; // copy of the VP8Io to pass to put()
|
||||
} VP8ThreadContext;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// VP8Decoder: the main opaque structure handed over to user
|
||||
|
||||
struct VP8Decoder {
|
||||
@ -280,7 +280,7 @@ struct VP8Decoder {
|
||||
size_t layer_data_size_;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// internal functions. Not public.
|
||||
|
||||
// in vp8.c
|
||||
@ -411,7 +411,7 @@ typedef enum {
|
||||
typedef int (*VP8CPUInfo)(CPUFeature feature);
|
||||
extern VP8CPUInfo VP8DecGetCPUInfo;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -19,7 +19,7 @@ extern "C" {
|
||||
|
||||
#define RIFF_HEADER_SIZE 12
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// RIFF layout is:
|
||||
// 0ffset tag
|
||||
// 0...3 "RIFF" 4-byte tag
|
||||
@ -65,7 +65,7 @@ uint32_t WebPCheckAndSkipRIFFHeader(const uint8_t** data_ptr,
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// WebPDecParams
|
||||
|
||||
void WebPResetDecParams(WebPDecParams* const params) {
|
||||
@ -74,7 +74,7 @@ void WebPResetDecParams(WebPDecParams* const params) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// "Into" decoding variants
|
||||
|
||||
// Main flow
|
||||
@ -196,7 +196,7 @@ uint8_t* WebPDecodeYUVInto(const uint8_t* data, uint32_t data_size,
|
||||
return luma;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static uint8_t* Decode(WEBP_CSP_MODE mode, const uint8_t* data,
|
||||
uint32_t data_size, int* width, int* height,
|
||||
@ -328,7 +328,7 @@ static VP8StatusCode GetFeatures(const uint8_t** data, uint32_t* data_size,
|
||||
return VP8_STATUS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// WebPGetInfo()
|
||||
|
||||
int WebPGetInfo(const uint8_t* data, uint32_t data_size,
|
||||
@ -349,7 +349,7 @@ int WebPGetInfo(const uint8_t* data, uint32_t data_size,
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Advance decoding API
|
||||
|
||||
int WebPInitDecoderConfigInternal(WebPDecoderConfig* const config,
|
||||
|
@ -25,7 +25,7 @@ extern "C" {
|
||||
|
||||
#define CHUNK_SIZE 8192
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static int CompressAlpha(const uint8_t* data, size_t data_size,
|
||||
uint8_t** output, size_t* output_size,
|
||||
|
@ -26,7 +26,7 @@ static int ClipAlpha(int alpha) {
|
||||
return alpha < 0 ? 0 : alpha > 255 ? 255 : alpha;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Smooth the segment map by replacing isolated block by the majority of its
|
||||
// neighbours.
|
||||
|
||||
@ -69,7 +69,7 @@ static void SmoothSegmentMap(VP8Encoder* const enc) {
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Finalize Segment probability based on the coding tree
|
||||
|
||||
static int GetProba(int a, int b) {
|
||||
@ -139,7 +139,7 @@ static void SetSegmentAlphas(VP8Encoder* const enc,
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Simplified k-Means, to assign Nb segments based on alpha-histogram
|
||||
|
||||
static void AssignSegments(VP8Encoder* const enc, const int alphas[256]) {
|
||||
@ -220,7 +220,7 @@ static void AssignSegments(VP8Encoder* const enc, const int alphas[256]) {
|
||||
SetSegmentAlphas(enc, centers, weighted_average); // pick some alphas.
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Macroblock analysis: collect histogram for each mode, deduce the maximal
|
||||
// susceptibility and set best modes for this macroblock.
|
||||
// Segment assignment is done later.
|
||||
@ -328,7 +328,7 @@ static void MBAnalyze(VP8EncIterator* const it,
|
||||
it->mb_->alpha_ = best_alpha; // Informative only.
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Main analysis loop:
|
||||
// Collect all susceptibilities for each macroblock and record their
|
||||
// distribution in alphas[]. Segments is assigned a-posteriori, based on
|
||||
|
@ -17,7 +17,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// VP8BitWriter
|
||||
|
||||
static int BitWriterResize(VP8BitWriter* const bw, size_t extra_size) {
|
||||
@ -68,7 +68,7 @@ static void kFlush(VP8BitWriter* const bw) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// renormalization
|
||||
|
||||
static const uint8_t kNorm[128] = { // renorm_sizes[i] = 8 - log2(i)
|
||||
@ -147,7 +147,7 @@ void VP8PutSignedValue(VP8BitWriter* const bw, int value, int nb_bits) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
int VP8BitWriterInit(VP8BitWriter* const bw, size_t expected_size) {
|
||||
bw->range_ = 255 - 1;
|
||||
@ -178,7 +178,7 @@ int VP8BitWriterAppend(VP8BitWriter* const bw,
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -18,7 +18,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Bit-writing
|
||||
|
||||
typedef struct VP8BitWriter VP8BitWriter;
|
||||
@ -54,7 +54,7 @@ static inline size_t VP8BitWriterSize(const VP8BitWriter* const bw) {
|
||||
return bw->pos_;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -16,9 +16,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// WebPConfig
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
int WebPConfigInitInternal(WebPConfig* const config,
|
||||
WebPPreset preset, float quality, int version) {
|
||||
@ -114,7 +114,7 @@ int WebPValidateConfig(const WebPConfig* const config) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -45,7 +45,7 @@ extern const uint16_t VP8FixedCostsUV[4];
|
||||
extern const uint16_t VP8FixedCostsI16[4];
|
||||
extern const uint16_t VP8FixedCostsI4[NUM_BMODES][NUM_BMODES][NUM_BMODES];
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -16,7 +16,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Compute susceptibility based on DCT-coeff histograms:
|
||||
// the higher, the "easier" the macroblock is to compress.
|
||||
|
||||
@ -64,7 +64,7 @@ static int CollectHistogram(const uint8_t* ref, const uint8_t* pred,
|
||||
return VP8GetAlpha(histo);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// run-time tables (~4k)
|
||||
|
||||
static uint8_t clip1[255 + 510 + 1]; // clips [-255,510] to [0,255]
|
||||
@ -87,7 +87,7 @@ static inline uint8_t clip_8b(int v) {
|
||||
return (!(v & ~0xff)) ? v : v < 0 ? 0 : 255;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Transforms (Paragraph 14.4)
|
||||
|
||||
#define STORE(x, y, v) \
|
||||
@ -226,7 +226,7 @@ static void FTransformWHT(const int16_t* in, int16_t* out) {
|
||||
#undef MUL
|
||||
#undef STORE
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Intra predictions
|
||||
|
||||
#define OUT(x, y) dst[(x) + (y) * BPS]
|
||||
@ -311,7 +311,7 @@ static inline void DCMode(uint8_t* dst, const uint8_t* left,
|
||||
Fill(dst, DC, size);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Chroma 8x8 prediction (paragraph 12.2)
|
||||
|
||||
static void IntraChromaPreds(uint8_t* dst, const uint8_t* left,
|
||||
@ -331,7 +331,7 @@ static void IntraChromaPreds(uint8_t* dst, const uint8_t* left,
|
||||
TrueMotion(C8TM8 + dst, left, top, 8);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// luma 16x16 prediction (paragraph 12.3)
|
||||
|
||||
static void Intra16Preds(uint8_t* dst,
|
||||
@ -342,7 +342,7 @@ static void Intra16Preds(uint8_t* dst,
|
||||
TrueMotion(I16TM16 + dst, left, top, 16);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// luma 4x4 prediction
|
||||
|
||||
#define AVG3(a, b, c) (((a) + 2 * (b) + (c) + 2) >> 2)
|
||||
@ -529,7 +529,7 @@ static void Intra4Preds(uint8_t* dst, const uint8_t* top) {
|
||||
HU4(I4HU4 + dst, top);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Metric
|
||||
|
||||
static inline int GetSSE(const uint8_t* a, const uint8_t* b, int w, int h) {
|
||||
@ -559,7 +559,7 @@ static int SSE4x4(const uint8_t* a, const uint8_t* b) {
|
||||
return GetSSE(a, b, 4, 4);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Texture distortion
|
||||
//
|
||||
// We try to match the spectral content (weighted) between source and
|
||||
@ -620,7 +620,7 @@ static int Disto16x16(const uint8_t* const a, const uint8_t* const b,
|
||||
return D;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Quantization
|
||||
//
|
||||
|
||||
@ -649,7 +649,7 @@ static int QuantizeBlock(int16_t in[16], int16_t out[16],
|
||||
return (last >= 0);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Block copy
|
||||
|
||||
static inline void Copy(const uint8_t* src, uint8_t* dst, int size) {
|
||||
@ -665,7 +665,7 @@ static void Copy4x4(const uint8_t* src, uint8_t* dst) { Copy(src, dst, 4); }
|
||||
static void Copy8x8(const uint8_t* src, uint8_t* dst) { Copy(src, dst, 8); }
|
||||
static void Copy16x16(const uint8_t* src, uint8_t* dst) { Copy(src, dst, 16); }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// SSE2 detection.
|
||||
//
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Compute susceptibility based on DCT-coeff histograms:
|
||||
// the higher, the "easier" the macroblock is to compress.
|
||||
|
||||
@ -64,7 +64,7 @@ static int CollectHistogramSSE2(const uint8_t* ref, const uint8_t* pred,
|
||||
return VP8GetAlpha(histo);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Transforms (Paragraph 14.4)
|
||||
|
||||
// Does one or two inverse transforms.
|
||||
@ -436,7 +436,7 @@ static void FTransformSSE2(const uint8_t* src, const uint8_t* ref,
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Metric
|
||||
|
||||
static int SSE4x4SSE2(const uint8_t* a, const uint8_t* b) {
|
||||
@ -485,7 +485,7 @@ static int SSE4x4SSE2(const uint8_t* a, const uint8_t* b) {
|
||||
return (tmp[3] + tmp[2] + tmp[1] + tmp[0]);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Texture distortion
|
||||
//
|
||||
// We try to match the spectral content (weighted) between source and
|
||||
@ -679,7 +679,7 @@ static int Disto16x16SSE2(const uint8_t* const a, const uint8_t* const b,
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Quantization
|
||||
//
|
||||
|
||||
|
@ -45,7 +45,7 @@ static void InitTables(void) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Edge filtering functions
|
||||
|
||||
// 4 pixels in, 2 pixels out
|
||||
@ -92,7 +92,7 @@ static inline int needs_filter2(const uint8_t* p, int step, int t, int it) {
|
||||
abs0[255 + q2 - q1] <= it && abs0[255 + q1 - q0] <= it;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Simple In-loop filtering (Paragraph 15.2)
|
||||
|
||||
static void SimpleVFilter16(uint8_t* p, int stride, int thresh) {
|
||||
@ -129,7 +129,7 @@ static void SimpleHFilter16i(uint8_t* p, int stride, int thresh) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Complex In-loop filtering (Paragraph 15.3)
|
||||
|
||||
static inline void FilterLoop24(uint8_t* p, int hstride, int vstride, int size,
|
||||
@ -177,7 +177,7 @@ static void HFilter8i(uint8_t* u, uint8_t* v, int stride,
|
||||
FilterLoop24(v + 4, 1, stride, 8, thresh, ithresh, hev_thresh);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void (*VP8EncVFilter16i)(uint8_t*, int, int, int, int) = VFilter16i;
|
||||
void (*VP8EncHFilter16i)(uint8_t*, int, int, int, int) = HFilter16i;
|
||||
@ -187,7 +187,7 @@ void (*VP8EncHFilter8i)(uint8_t*, uint8_t*, int, int, int, int) = HFilter8i;
|
||||
void (*VP8EncSimpleVFilter16i)(uint8_t*, int, int) = SimpleVFilter16i;
|
||||
void (*VP8EncSimpleHFilter16i)(uint8_t*, int, int) = SimpleHFilter16i;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Paragraph 15.4: compute the inner-edge filtering strength
|
||||
|
||||
static int GetILevel(int sharpness, int level) {
|
||||
@ -229,7 +229,7 @@ static void DoFilter(const VP8EncIterator* const it, int level) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// SSIM metric
|
||||
|
||||
enum { KERNEL = 3 };
|
||||
@ -302,7 +302,7 @@ static double GetMBSSIM(const uint8_t* yuv1, const uint8_t* yuv2) {
|
||||
return GetSSIM(&s);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Exposed APIs: Encoder should call the following 3 functions to adjust
|
||||
// loop filter strength
|
||||
|
||||
|
@ -37,7 +37,7 @@ typedef struct {
|
||||
CostArray* cost;
|
||||
} VP8Residual;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Tables for level coding
|
||||
|
||||
const uint8_t VP8EncBands[16 + 1] = {
|
||||
@ -51,7 +51,7 @@ static const uint8_t kCat5[] = { 180, 157, 141, 134, 130 };
|
||||
static const uint8_t kCat6[] =
|
||||
{ 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129 };
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Reset the statistics about: number of skips, token proba, level cost,...
|
||||
|
||||
static void ResetStats(VP8Encoder* const enc, int precalc_cost) {
|
||||
@ -60,7 +60,7 @@ static void ResetStats(VP8Encoder* const enc, int precalc_cost) {
|
||||
proba->nb_skip_ = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Skip decision probability
|
||||
|
||||
static int CalcSkipProba(uint64_t nb, uint64_t total) {
|
||||
@ -84,7 +84,7 @@ static int FinalizeSkipProba(VP8Encoder* const enc) {
|
||||
return size;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Recording of token probabilities.
|
||||
|
||||
static void ResetTokenStats(VP8Encoder* const enc) {
|
||||
@ -191,7 +191,7 @@ static int FinalizeTokenProbas(VP8Encoder* const enc) {
|
||||
return size;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// helper functions for residuals struct VP8Residual.
|
||||
|
||||
static void InitResidual(int first, int coeff_type,
|
||||
@ -216,7 +216,7 @@ static void SetResidualCoeffs(const int16_t* const coeffs,
|
||||
res->coeffs = coeffs;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Mode costs
|
||||
|
||||
static int GetResidualCost(int ctx, const VP8Residual* const res) {
|
||||
@ -311,7 +311,7 @@ int VP8GetCostUV(VP8EncIterator* const it, const VP8ModeScore* const rd) {
|
||||
return R;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Coefficient coding
|
||||
|
||||
static int PutCoeffs(VP8BitWriter* const bw, int ctx, const VP8Residual* res) {
|
||||
@ -481,7 +481,7 @@ static void RecordResiduals(VP8EncIterator* const it,
|
||||
VP8IteratorBytesToNz(it);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// ExtraInfo map / Debug function
|
||||
|
||||
#if SEGMENT_VISU
|
||||
@ -544,7 +544,7 @@ static void StoreSideInfo(const VP8EncIterator* const it) {
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Main loops
|
||||
//
|
||||
// VP8EncLoop(): does the final bitstream coding.
|
||||
@ -616,7 +616,7 @@ int VP8EncLoop(VP8Encoder* const enc) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// VP8StatLoop(): only collect statistics (number of skips, token usage, ...)
|
||||
// This is used for deciding optimal probabilities. It also
|
||||
// modifies the quantizer value if some target (size, PNSR)
|
||||
@ -715,7 +715,7 @@ int VP8StatLoop(VP8Encoder* const enc) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -17,9 +17,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// VP8Iterator
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static void InitLeft(VP8EncIterator* const it) {
|
||||
const VP8Encoder* const enc = it->enc_;
|
||||
@ -68,7 +68,7 @@ void VP8IteratorInit(VP8Encoder* const enc, VP8EncIterator* const it) {
|
||||
VP8IteratorReset(it);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Import the source samples into the cache. Takes care of replicating
|
||||
// boundary pixels if necessary.
|
||||
|
||||
@ -122,7 +122,7 @@ void VP8IteratorImport(const VP8EncIterator* const it) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Copy back the compressed samples into user space if requested.
|
||||
|
||||
void VP8IteratorExport(const VP8EncIterator* const it) {
|
||||
@ -159,7 +159,7 @@ void VP8IteratorExport(const VP8EncIterator* const it) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Non-zero contexts setup/teardown
|
||||
|
||||
// Nz bits:
|
||||
@ -225,7 +225,7 @@ void VP8IteratorBytesToNz(VP8EncIterator* const it) {
|
||||
|
||||
#undef BIT
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Advance to the next position, doing the bookeeping.
|
||||
|
||||
int VP8IteratorNext(VP8EncIterator* const it,
|
||||
@ -270,7 +270,7 @@ int VP8IteratorNext(VP8EncIterator* const it,
|
||||
return (0 < --it->done_);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Helper function to set mode properties
|
||||
|
||||
void VP8SetIntra16Mode(const VP8EncIterator* const it, int mode) {
|
||||
@ -307,7 +307,7 @@ void VP8SetSegment(const VP8EncIterator* const it, int segment) {
|
||||
it->mb_->segment_ = segment;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Intra4x4 sub-blocks iteration
|
||||
//
|
||||
// We store and update the boundary samples into an array of 37 pixels. They
|
||||
@ -402,7 +402,7 @@ int VP8IteratorRotateI4(VP8EncIterator* const it,
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -21,7 +21,7 @@ extern "C" {
|
||||
|
||||
#endif /* WEBP_EXPERIMENTAL_FEATURES */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void VP8EncInitLayer(VP8Encoder* const enc) {
|
||||
enc->use_layer_ = (enc->pic_->u0 != NULL);
|
||||
|
@ -17,9 +17,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// WebPPicture
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
int WebPPictureAlloc(WebPPicture* const picture) {
|
||||
if (picture) {
|
||||
@ -119,7 +119,7 @@ void WebPPictureFree(WebPPicture* const picture) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Picture copying
|
||||
|
||||
int WebPPictureCopy(const WebPPicture* const src, WebPPicture* const dst) {
|
||||
@ -163,7 +163,7 @@ int WebPPictureCopy(const WebPPicture* const src, WebPPicture* const dst) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Picture cropping
|
||||
|
||||
int WebPPictureCrop(WebPPicture* const pic,
|
||||
@ -219,7 +219,7 @@ int WebPPictureCrop(WebPPicture* const pic,
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Simple picture rescaler
|
||||
|
||||
#define RFIX 30
|
||||
@ -372,7 +372,7 @@ int WebPPictureRescale(WebPPicture* const pic, int width, int height) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Write-to-memory
|
||||
|
||||
typedef struct {
|
||||
@ -418,7 +418,7 @@ static int WebPMemoryWrite(const uint8_t* data, size_t data_size,
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// RGB -> YUV conversion
|
||||
// The exact naming is Y'CbCr, following the ITU-R BT.601 standard.
|
||||
// More information at: http://en.wikipedia.org/wiki/YCbCr
|
||||
@ -593,7 +593,7 @@ int WebPPictureImportBGRA(WebPPicture* const picture,
|
||||
return Import(picture, rgba, rgba_stride, 4, 1, 1);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Simplest call:
|
||||
|
||||
typedef int (*Importer)(WebPPicture* const, const uint8_t* const, int);
|
||||
@ -643,7 +643,7 @@ ENCODE_FUNC(WebPEncodeBGRA, WebPPictureImportBGRA);
|
||||
|
||||
#undef ENCODE_FUNC
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -26,7 +26,7 @@ extern "C" {
|
||||
#define MAX_PARTITION0_SIZE (1 << 19) // max size of mode partition
|
||||
#define MAX_PARTITION_SIZE (1 << 24) // max size for token partition
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Writers for header's various pieces (in order of appearance)
|
||||
|
||||
// Main keyframe header
|
||||
@ -154,7 +154,7 @@ static int EmitPartitionsSize(const VP8Encoder* const enc,
|
||||
return p ? pic->writer(buf, 3 * p, pic) : 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef WEBP_EXPERIMENTAL_FEATURES
|
||||
|
||||
@ -200,7 +200,7 @@ static int WriteExtensions(VP8Encoder* const enc) {
|
||||
|
||||
#endif /* WEBP_EXPERIMENTAL_FEATURES */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static size_t GeneratePartition0(VP8Encoder* const enc) {
|
||||
VP8BitWriter* const bw = &enc->bw_;
|
||||
@ -293,7 +293,7 @@ int VP8EncWrite(VP8Encoder* const enc) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -15,7 +15,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Default probabilities
|
||||
|
||||
// Paragraph 13.5
|
||||
@ -343,7 +343,7 @@ void VP8CodeIntraModes(VP8Encoder* const enc) {
|
||||
} while (VP8IteratorNext(&it, 0));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Paragraph 13
|
||||
|
||||
const uint8_t
|
||||
|
@ -20,7 +20,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Various defines and enums
|
||||
|
||||
// version numbers
|
||||
@ -161,7 +161,7 @@ static inline int QUANTDIV(int n, int iQ, int B) {
|
||||
}
|
||||
extern const uint8_t VP8Zigzag[16];
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Headers
|
||||
|
||||
typedef uint8_t ProbaArray[NUM_CTX][NUM_PROBAS];
|
||||
@ -199,7 +199,7 @@ typedef struct {
|
||||
int i4x4_lf_delta_; // delta filter level for i4x4 relative to i16x16
|
||||
} VP8FilterHeader;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Informations about the macroblocks.
|
||||
|
||||
typedef struct {
|
||||
@ -305,7 +305,7 @@ void VP8SetSkip(const VP8EncIterator* const it, int skip);
|
||||
void VP8SetSegment(const VP8EncIterator* const it, int segment);
|
||||
void VP8IteratorResetCosts(VP8EncIterator* const it);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// VP8Encoder
|
||||
|
||||
struct VP8Encoder {
|
||||
@ -381,7 +381,7 @@ struct VP8Encoder {
|
||||
LFStats *lf_stats_; // autofilter stats (if NULL, autofilter is off)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// internal functions. Not public.
|
||||
|
||||
// in tree.c
|
||||
@ -502,7 +502,7 @@ extern void VP8InitFilter(VP8EncIterator* const it);
|
||||
extern void VP8StoreFilterStats(VP8EncIterator* const it);
|
||||
extern void VP8AdjustFilterStrength(VP8EncIterator* const it);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -28,15 +28,15 @@ extern "C" {
|
||||
|
||||
#define MAX_DIMENSION 16384 // maximum width/height allowed by the spec
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
int WebPGetEncoderVersion(void) {
|
||||
return (ENC_MAJ_VERSION << 16) | (ENC_MIN_VERSION << 8) | ENC_REV_VERSION;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// WebPPicture
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static int DummyWriter(const uint8_t* data, size_t data_size,
|
||||
const WebPPicture* const picture) {
|
||||
@ -59,9 +59,9 @@ int WebPPictureInitInternal(WebPPicture* const picture, int version) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// VP8Encoder
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static void ResetSegmentHeader(VP8Encoder* const enc) {
|
||||
VP8SegmentHeader* const hdr = &enc->segment_hdr_;
|
||||
@ -270,7 +270,7 @@ static void DeleteEncoder(VP8Encoder* enc) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static double GetPSNR(uint64_t err, uint64_t size) {
|
||||
return err ? 10. * log10(255. * 255. * size / err) : 99.;
|
||||
@ -312,7 +312,7 @@ int WebPEncodingSetError(WebPPicture* const pic, WebPEncodingError error) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
int WebPEncode(const WebPConfig* const config, WebPPicture* const pic) {
|
||||
VP8Encoder* enc;
|
||||
|
@ -105,7 +105,7 @@ WEBP_EXTERN(uint8_t*) WebPDecodeYUVInto(
|
||||
uint8_t* u, int u_size, int u_stride,
|
||||
uint8_t* v, int v_size, int v_stride);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Output colorspaces and buffer
|
||||
|
||||
// Colorspaces
|
||||
@ -162,7 +162,7 @@ static inline int WebPInitDecBuffer(WebPDecBuffer* const buffer) {
|
||||
// Note: doesn't free the 'buffer' structure itself.
|
||||
WEBP_EXTERN(void) WebPFreeDecBuffer(WebPDecBuffer* const buffer);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Enumeration of the status codes
|
||||
|
||||
typedef enum {
|
||||
@ -176,7 +176,7 @@ typedef enum {
|
||||
VP8_STATUS_NOT_ENOUGH_DATA
|
||||
} VP8StatusCode;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Incremental decoding
|
||||
//
|
||||
// This API allows streamlined decoding of partial data.
|
||||
@ -279,7 +279,7 @@ WEBP_EXTERN(const WebPDecBuffer*) WebPIDecodedArea(
|
||||
int* const left, int* const top,
|
||||
int* const width, int* const height);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Advanced decoding parametrization
|
||||
//
|
||||
// Code sample for using the advanced decoding API
|
||||
|
@ -18,7 +18,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Lower-level API
|
||||
//
|
||||
// These functions provide fine-grained control of the decoding process.
|
||||
@ -148,7 +148,7 @@ WEBP_EXTERN(void) VP8Clear(VP8Decoder* const dec);
|
||||
// Destroy the decoder object.
|
||||
WEBP_EXTERN(void) VP8Delete(VP8Decoder* const dec);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
@ -26,7 +26,7 @@ extern "C" {
|
||||
// each of major/minor/revision. E.g: v2.5.7 is 0x020507.
|
||||
WEBP_EXTERN(int) WebPGetEncoderVersion(void);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// One-stop-shop call! No questions asked:
|
||||
|
||||
// Returns the size of the compressed data (pointed to by *output), or 0 if
|
||||
@ -45,7 +45,7 @@ WEBP_EXTERN(size_t) WebPEncodeBGRA(const uint8_t* bgra,
|
||||
int width, int height, int stride,
|
||||
float quality_factor, uint8_t** output);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Coding parameters
|
||||
|
||||
typedef struct {
|
||||
@ -110,7 +110,7 @@ static inline int WebPConfigPreset(WebPConfig* const config,
|
||||
// Returns 1 if all parameters are in valid range and the configuration is OK.
|
||||
WEBP_EXTERN(int) WebPValidateConfig(const WebPConfig* const config);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Input / Output
|
||||
|
||||
typedef struct WebPPicture WebPPicture; // main structure for I/O
|
||||
@ -209,7 +209,7 @@ static inline int WebPPictureInit(WebPPicture* const picture) {
|
||||
return WebPPictureInitInternal(picture, WEBP_ENCODER_ABI_VERSION);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// WebPPicture utils
|
||||
|
||||
// Convenience allocation / deallocation based on picture->width/height:
|
||||
@ -255,7 +255,7 @@ WEBP_EXTERN(int) WebPPictureImportBGR(
|
||||
WEBP_EXTERN(int) WebPPictureImportBGRA(
|
||||
WebPPicture* const picture, const uint8_t* const bgra, int bgra_stride);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Main call
|
||||
|
||||
// Main encoding call, after config and picture have been initialized.
|
||||
@ -266,7 +266,7 @@ WEBP_EXTERN(int) WebPPictureImportBGRA(
|
||||
WEBP_EXTERN(int) WebPEncode(
|
||||
const WebPConfig* const config, WebPPicture* const picture);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
|
Loading…
Reference in New Issue
Block a user