diff options
author | rcombs <rcombs@rcombs.me> | 2021-12-23 12:19:11 +0300 |
---|---|---|
committer | rcombs <rcombs@rcombs.me> | 2022-01-05 04:39:22 +0300 |
commit | e5d83463c8745c1b9d8ce83d00a5856a4dd19ceb (patch) | |
tree | af67431de45675cc1ea7f13fed22fec437aee2f5 /libswscale/swscale_internal.h | |
parent | cb87a3b137d26d8af9a96b8bb60294a1668857a4 (diff) |
swscale: introduce isDataInHighBits
Diffstat (limited to 'libswscale/swscale_internal.h')
-rw-r--r-- | libswscale/swscale_internal.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 64aa0b9804..b4acaceebd 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -892,6 +892,25 @@ static av_always_inline int usePal(enum AVPixelFormat pix_fmt) } } +/* + * Identity formats where the data is in the high bits, and the low bits are shifted away. + */ +static av_always_inline int isDataInHighBits(enum AVPixelFormat pix_fmt) +{ + int i; + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); + av_assert0(desc); + if (desc->flags & (AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_HWACCEL)) + return 0; + for (i = 0; i < desc->nb_components; i++) { + if (!desc->comp[i].shift) + return 0; + if ((desc->comp[i].shift + desc->comp[i].depth) & 0x7) + return 0; + } + return 1; +} + extern const uint64_t ff_dither4[2]; extern const uint64_t ff_dither8[2]; |