diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-01-24 22:30:20 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-01-25 19:44:56 +0100 |
| commit | f471db4e8dc7f3dd1eb7a9cf4d8d11e7d340df65 (patch) | |
| tree | 183c602f84b0fd54230d622406ecc1b550981a40 /src | |
| parent | 07befde2cbbad4d979631727fc35399164d0aa1c (diff) | |
Cleanup: move stride_round_up into the only place it is used.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/image.cc | 8 | ||||
| -rw-r--r-- | src/lib/util.cc | 14 | ||||
| -rw-r--r-- | src/lib/util.h | 1 |
3 files changed, 7 insertions, 16 deletions
diff --git a/src/lib/image.cc b/src/lib/image.cc index 2e1d3fbf5..20aece3e8 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -973,9 +973,15 @@ 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 1984ed476..2767068d4 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -551,20 +551,6 @@ simple_digest (vector<boost::filesystem::path> paths) } -/** 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 ensure_ui_thread () diff --git a/src/lib/util.h b/src/lib/util.h index 790feea05..a36903437 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -102,7 +102,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); |
