Revision 5efccce2

View differences:

libavcodec/pixdesc.c
581 581
        .flags = PIX_FMT_BE,
582 582
    },
583 583
};
584

  
585
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
586
{
587
    int c, bits = 0;
588
    int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
589

  
590
    for (c = 0; c < pixdesc->nb_channels; c++) {
591
        int s = c==1 || c==2 ? 0 : log2_pixels;
592
        bits += (pixdesc->comp[c].depth_minus1+1) << s;
593
    }
594

  
595
    return bits >> log2_pixels;
596
}
libavcodec/pixdesc.h
193 193
    }
194 194
}
195 195

  
196
/**
197
 * Returns the number of bits per pixel used by the pixel format
198
 * described by pixdesc.
199
 *
200
 * The returned number of bits refers to the number of bits actually
201
 * used for storing the pixel information, that is padding bits are
202
 * not counted.
203
 */
204
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc);
205

  
196 206
#endif /* AVCODEC_PIXDESC_H */

Also available in: Unified diff