Commit 6ab4812f authored by Michael Niedermayer's avatar Michael Niedermayer

avfilter/vf_cropdetect: support 9-16bit planar formats

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 5c7227bb
......@@ -51,6 +51,11 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P,
AV_PIX_FMT_YUV411P, AV_PIX_FMT_GRAY8,
AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV410P,
AV_PIX_FMT_YUV420P9 , AV_PIX_FMT_YUV422P9 , AV_PIX_FMT_YUV444P9,
AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12,
AV_PIX_FMT_YUV420P14, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV444P14,
AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
AV_PIX_FMT_NV12, AV_PIX_FMT_NV21,
AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA,
......@@ -65,6 +70,7 @@ static int checkline(void *ctx, const unsigned char *src, int stride, int len, i
{
int total = 0;
int div = len;
const uint16_t *src16 = (const uint16_t *)src;
switch (bpp) {
case 1:
......@@ -79,6 +85,19 @@ static int checkline(void *ctx, const unsigned char *src, int stride, int len, i
src += stride;
}
break;
case 2:
stride >>= 1;
while (len >= 8) {
total += src16[ 0] + src16[ stride] + src16[2*stride] + src16[3*stride]
+ src16[4*stride] + src16[5*stride] + src16[6*stride] + src16[7*stride];
src += 8*stride;
len -= 8;
}
while (--len >= 0) {
total += src16[0];
src += stride;
}
break;
case 3:
case 4:
while (len >= 4) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment