]> git.sesse.net Git - ffmpeg/commitdiff
Use pixel format descriptors for checking if the input format is
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Wed, 3 Feb 2010 23:10:18 +0000 (23:10 +0000)
committerStefano Sabatini <stefano.sabatini-lala@poste.it>
Wed, 3 Feb 2010 23:10:18 +0000 (23:10 +0000)
paletted. Simpler and more robust.

Originally committed as revision 21631 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavfilter/vf_crop.c

index e3944ef059ad41758f50ad4960e6e44a135d41f8..94d89d1e5b2c684ed6dd5c67488f3791aa906a85 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include "avfilter.h"
+#include "libavutil/pixdesc.h"
 
 typedef struct {
     int  x;             ///< x offset of the non-cropped area with respect to the input area
@@ -173,11 +174,7 @@ static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
     ref2->data[0] += crop->y * ref2->linesize[0];
     ref2->data[0] += (crop->x * crop->bpp) >> 3;
 
-    if (link->format != PIX_FMT_PAL8      &&
-        link->format != PIX_FMT_BGR4_BYTE &&
-        link->format != PIX_FMT_RGB4_BYTE &&
-        link->format != PIX_FMT_BGR8      &&
-        link->format != PIX_FMT_RGB8) {
+    if (!(av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PAL)) {
         for (i = 1; i < 3; i ++) {
             if (ref2->data[i]) {
                 ref2->data[i] += (crop->y >> crop->vsub) * ref2->linesize[i];