Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: third_party/libwebp/utils/rescaler.h

Issue 10832153: libwebp: update snapshot to v0.2.0-rc1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2012 Google Inc. All Rights Reserved.
2 //
3 // This code is licensed under the same terms as WebM:
4 // Software License Agreement: http://www.webmproject.org/license/software/
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 // -----------------------------------------------------------------------------
7 //
8 // Rescaling functions
9 //
10 // Author: Skal (pascal.massimino@gmail.com)
11
12 #ifndef WEBP_UTILS_RESCALER_H_
13 #define WEBP_UTILS_RESCALER_H_
14
15 #if defined(__cplusplus) || defined(c_plusplus)
16 extern "C" {
17 #endif
18
19 #include "../webp/types.h"
20
21 // Structure used for on-the-fly rescaling
22 typedef struct {
23 int x_expand; // true if we're expanding in the x direction
24 int num_channels; // bytes to jump between pixels
25 int fy_scale, fx_scale; // fixed-point scaling factor
26 int64_t fxy_scale; // ''
27 // we need hpel-precise add/sub increments, for the downsampled U/V planes.
28 int y_accum; // vertical accumulator
29 int y_add, y_sub; // vertical increments (add ~= src, sub ~= dst)
30 int x_add, x_sub; // horizontal increments (add ~= src, sub ~= dst)
31 int src_width, src_height; // source dimensions
32 int dst_width, dst_height; // destination dimensions
33 uint8_t* dst;
34 int dst_stride;
35 int32_t* irow, *frow; // work buffer
36 } WebPRescaler;
37
38 // Initialize a rescaler given scratch area 'work' and dimensions of src & dst.
39 void WebPRescalerInit(WebPRescaler* const wrk, int src_width, int src_height,
40 uint8_t* const dst,
41 int dst_width, int dst_height, int dst_stride,
42 int num_channels,
43 int x_add, int x_sub,
44 int y_add, int y_sub,
45 int32_t* const work);
46
47 // Import a row of data and save its contribution in the rescaler.
48 // 'channel' denotes the channel number to be imported.
49 void WebPRescalerImportRow(WebPRescaler* const rescaler,
50 const uint8_t* const src, int channel);
51
52 // Import multiple rows over all channels, until at least one row is ready to
53 // be exported. Returns the actual number of lines that were imported.
54 int WebPRescalerImport(WebPRescaler* const rescaler, int num_rows,
55 const uint8_t* src, int src_stride);
56
57 // Return true if there is pending output rows ready.
58 static WEBP_INLINE
59 int WebPRescalerHasPendingOutput(const WebPRescaler* const rescaler) {
60 return (rescaler->y_accum <= 0);
61 }
62
63 // Export one row from rescaler. Returns the pointer where output was written,
64 // or NULL if no row was pending.
65 uint8_t* WebPRescalerExportRow(WebPRescaler* const wrk);
66
67 // Export as many rows as possible. Return the numbers of rows written.
68 int WebPRescalerExport(WebPRescaler* const wrk);
69
70 //------------------------------------------------------------------------------
71
72 #if defined(__cplusplus) || defined(c_plusplus)
73 } // extern "C"
74 #endif
75
76 #endif /* WEBP_UTILS_RESCALER_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698