Revision 5efccce2 libavcodec/pixdesc.c

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
}

Also available in: Unified diff