diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-12-30 00:20:10 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-12-30 00:20:10 +0000 |
| commit | e8d3e8b4057149b602029ec9a588ccb81a908d5c (patch) | |
| tree | 94836f5be835abbea08fe36d496046bc654cd878 /src/lib | |
| parent | 83c16caa3cdb54244542adf27de700187a00c52c (diff) | |
Make horizontal_factor look the same as vertical_factor.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/image.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/lib/image.cc b/src/lib/image.cc index da1bb86ee..92c1ab9a2 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -68,15 +68,16 @@ Image::vertical_factor (int n) const int Image::horizontal_factor (int n) const { - int horizontal_factor = 1; - if (n > 0) { - AVPixFmtDescriptor const * d = av_pix_fmt_desc_get (_pixel_format); - if (!d) { - throw PixelFormatError ("sample_size()", _pixel_format); - } - horizontal_factor = pow (2.0f, d->log2_chroma_w); + if (n == 0) { + return 1; + } + + AVPixFmtDescriptor const * d = av_pix_fmt_desc_get(_pixel_format); + if (!d) { + throw PixelFormatError ("sample_size()", _pixel_format); } - return horizontal_factor; + + return pow (2.0f, d->log2_chroma_w); } /** @param n Component index. |
