diff options
authorHans Verkuil <hverkuil@xs4all.nl>2018-11-19 14:45:18 +0100
committerHans Verkuil <hverkuil@xs4all.nl>2018-11-19 14:45:18 +0100
commit044d5ab7b0d02683070d01a369c73d462d7a0cee (patch)
parent99dfae1aa052f46fcc94fabf98e89b47986956f7 (diff)
v4l-stream.c: check FWHT macroblock alignment
The FWHT codec currently expects macroblock alignment of the resolution. So reject the use of FWHT if that's not the case. It will fallback to lossless compression. This restriction can be lifted once the FWHT codec supports non-aligned resolutions as well. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/common/v4l-stream.c b/utils/common/v4l-stream.c
index 89f57379..af096c25 100644
--- a/utils/common/v4l-stream.c
+++ b/utils/common/v4l-stream.c
@@ -180,7 +180,9 @@ struct codec_ctx *fwht_alloc(unsigned pixfmt, unsigned w, unsigned h,
unsigned int chroma_div;
unsigned int size = w * h;
- if (!info)
+ // fwht expects macroblock alignment, check can be dropped once that
+ // restriction is lifted.
+ if (!info || w % 8 || h % 8)
return NULL;
ctx = malloc(sizeof(*ctx));

Privacy Policy