summaryrefslogtreecommitdiff
path: root/src/lib/image.cc
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 /src/lib/image.cc
parentd311043bf3c1e3e7f41b314f7ab7c91ed7e5aa7f (diff)
Cleanup: move stride_round_up into the only place it is used.
Diffstat (limited to 'src/lib/image.cc')
-rw-r--r--src/lib/image.cc7
1 files changed, 6 insertions, 1 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.