summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-01-24 22:30:20 +0100
committerCarl Hetherington <cth@carlh.net>2022-04-03 23:43:34 +0200
commit4b74bd9f359b9fe4f841cd9a361f3b2b24c2351e (patch)
tree5c4937e6c902597ac0575c07be9e8b235ecc7c4c
parentd311043bf3c1e3e7f41b314f7ab7c91ed7e5aa7f (diff)
Cleanup: move stride_round_up into the only place it is used.
-rw-r--r--src/lib/image.cc7
-rw-r--r--src/lib/util.cc12
-rw-r--r--src/lib/util.h1
3 files changed, 6 insertions, 14 deletions
diff --git a/src/lib/image.cc b/src/lib/image.cc
index 1adcabc06..d0878efbd 100644
--- a/src/lib/image.cc
+++ b/src/lib/image.cc
@@ -972,9 +972,14 @@ Image::allocate ()
_stride = (int *) wrapped_av_malloc (4 * sizeof (int));
_stride[0] = _stride[1] = _stride[2] = _stride[3] = 0;
+ auto stride_round_up = [](int stride, int t) {
+ int const a = stride + (t - 1);
+ return a - (a % t);
+ };
+
for (int i = 0; i < planes(); ++i) {
_line_size[i] = ceil (_size.width * bytes_per_pixel(i));
- _stride[i] = stride_round_up (i, _line_size, _alignment == Alignment::PADDED ? ALIGNMENT : 1);
+ _stride[i] = stride_round_up (_line_size[i], _alignment == Alignment::PADDED ? ALIGNMENT : 1);
/* The assembler function ff_rgb24ToY_avx (in libswscale/x86/input.asm)
uses a 16-byte fetch to read three bytes (R/G/B) of image data.
diff --git a/src/lib/util.cc b/src/lib/util.cc
index ccd505e57..6bcacf9f2 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -529,18 +529,6 @@ digest_head_tail (vector<boost::filesystem::path> files, boost::uintmax_t size)
return digester.get ();
}
-/** Round a number up to the nearest multiple of another number.
- * @param c Index.
- * @param stride Array of numbers to round, indexed by c.
- * @param t Multiple to round to.
- * @return Rounded number.
- */
-int
-stride_round_up (int c, int const * stride, int t)
-{
- int const a = stride[c] + (t - 1);
- return a - (a % t);
-}
/** Trip an assert if the caller is not in the UI thread */
void
diff --git a/src/lib/util.h b/src/lib/util.h
index cbf4b491b..bd9eaf96e 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -106,7 +106,6 @@ extern boost::filesystem::path mo_path ();
#endif
extern std::string tidy_for_filename (std::string);
extern dcp::Size fit_ratio_within (float ratio, dcp::Size);
-extern int stride_round_up (int, int const *, int);
extern void* wrapped_av_malloc (size_t);
extern void set_backtrace_file (boost::filesystem::path);
extern std::map<std::string, std::string> split_get_request (std::string url);