From: Carl Hetherington Date: Sat, 18 Dec 2021 22:32:11 +0000 (+0100) Subject: Tiny optimisation. X-Git-Tag: checked-for-v2.16.x~133 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;ds=sidebyside;h=f09bbf9d037975b5a6113c4d5634c82625a51683;p=dcpomatic.git Tiny optimisation. --- 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; }