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

Unified Diff: skia/ext/convolver.h

Issue 13947013: Complete (but inefficient) implementation of the image retargetting method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | skia/ext/convolver.cc » ('j') | skia/ext/convolver.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/convolver.h
diff --git a/skia/ext/convolver.h b/skia/ext/convolver.h
index 14974e52938690f340fb67a2f157ab035ff76c67..f4501b158bfb917db46957c378f35d6adef98cb0 100644
--- a/skia/ext/convolver.h
+++ b/skia/ext/convolver.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/cpu.h"
+#include "third_party/skia/include/core/SkSize.h"
Stephen White 2013/04/10 15:20:31 I think you could forward-declare SkISize instead
motek. 2013/04/11 16:18:38 SkISize is declared: typedef struct SkTSize<int> S
Stephen White 2013/04/11 17:16:38 Ahh, you're right. I'd forgotten it was a typedef
#include "third_party/skia/include/core/SkTypes.h"
#if defined(ARCH_CPU_X86_FAMILY)
@@ -107,6 +108,25 @@ class ConvolutionFilter1D {
return &filter_values_[filter.data_location];
}
+ // Retrieves the filter for the offset 0, presumed to be the one and only.
+ // The offset and length of the filter values are put into the corresponding
+ // out arguments (see AddFilter). Note that |filter_legth| and
+ // |specified_filter_size| may be different if leading/trailing zeros of the
Stephen White 2013/04/10 15:20:31 Maybe this comment should be on the declaration fo
motek. 2013/04/11 16:18:38 Added it there.
+ // original floating point form were clipped.
+ // There will be |filter_length| values in the return array.
reed1 2013/04/09 15:43:18 Do you want to comment that this can return NULL (
motek. 2013/04/11 16:18:38 Done.
+ inline const Fixed* GetSingleFilter(int* specified_filter_size,
Stephen White 2013/04/10 15:20:31 Nit: prefer out-of-line here unless performance i
motek. 2013/04/11 16:18:38 The original is processed in a loop, so I assume t
+ int* filter_offset,
+ int* filter_length) const {
+ const FilterInstance& filter = filters_[0];
+ *filter_offset = filter.offset;
+ *filter_length = filter.length;
+ *specified_filter_size = filter.filter_size;
+ if (filter.length == 0) {
+ return NULL;
+ }
+ return &filter_values_[filter.data_location];
+ }
+
inline void PaddingForSIMD(int padding_count) {
// Padding |padding_count| of more dummy coefficients after the coefficients
@@ -128,6 +148,9 @@ class ConvolutionFilter1D {
// Number of values in this filter instance.
int length;
+
+ // Given filter size.
+ int filter_size;
Stephen White 2013/04/10 15:20:31 A bit confusing.. maybe filter_size -> length, and
motek. 2013/04/11 16:18:38 Done.
};
// Stores the information for each filter added to this class.
@@ -168,6 +191,39 @@ SK_API void BGRAConvolve2D(const unsigned char* source_data,
int output_byte_row_stride,
unsigned char* output,
bool use_sse2);
+
+// Does a 1D convolution of the given source image along the X dimension on
+// a single channel of the bitmap.
+//
+// The function uses the same convolution kernel for each pixel. That kernel
+// must be added to |filter| at offset 0. This is a most straightforward
+// implementation of convolution, intended chiefly for development purposes.
+SK_API void SingleChannelConvolve1D_X(const unsigned char* source_data,
Stephen White 2013/04/10 15:20:31 Style guide says no underscores in function names,
motek. 2013/04/11 16:18:38 Renamed as suggested. As for the other suggestio
+ int source_byte_row_stride,
+ int input_channel_index,
+ int input_channel_count,
+ const ConvolutionFilter1D& filter,
+ const SkISize& image_size,
+ unsigned char* output,
+ int output_byte_row_stride,
+ int output_channel_index,
+ int output_channel_count,
+ bool absolute_values);
+
+// Does a 1D convolution of the given source image along the Y dimension on
+// a single channel of the bitmap.
+SK_API void SingleChannelConvolve1D_Y(const unsigned char* source_data,
+ int source_byte_row_stride,
+ int input_channel_index,
+ int input_channel_count,
+ const ConvolutionFilter1D& filter,
+ const SkISize& image_size,
+ unsigned char* output,
+ int output_byte_row_stride,
+ int output_channel_index,
+ int output_channel_count,
+ bool absolute_values);
+
} // namespace skia
#endif // SKIA_EXT_CONVOLVER_H_
« no previous file with comments | « no previous file | skia/ext/convolver.cc » ('j') | skia/ext/convolver.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698