Tiny optimisation.
authorCarl Hetherington <cth@carlh.net>
Sat, 18 Dec 2021 22:32:11 +0000 (23:32 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 23 Dec 2021 11:59:56 +0000 (12:59 +0100)
src/lib/image.cc

index ad88568cddf5d489a097d070dd71fc8b4b59b6b7..c6d2345a824916e48f341c7a8339bc3962282316 100644 (file)
@@ -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;
        }