diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-12-18 23:32:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-12-23 12:59:56 +0100 |
| commit | f09bbf9d037975b5a6113c4d5634c82625a51683 (patch) | |
| tree | 871b72bac57c6b2e69c4ce29fa912dd749117cdc /src | |
| parent | 799639bdd01ec79f517d3196551a98973a619880 (diff) | |
Tiny optimisation.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/image.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/image.cc b/src/lib/image.cc index ad88568cd..c6d2345a8 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -122,15 +122,15 @@ Image::sample_size (int n) const int Image::planes () const { + if (_pixel_format == AV_PIX_FMT_PAL8) { + return 2; + } + auto d = av_pix_fmt_desc_get(_pixel_format); if (!d) { throw PixelFormatError ("planes()", _pixel_format); } - if (_pixel_format == AV_PIX_FMT_PAL8) { - return 2; - } - if ((d->flags & AV_PIX_FMT_FLAG_PLANAR) == 0) { return 1; } |
