summaryrefslogtreecommitdiff
path: root/libavcodec/vp9.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-05-27 15:06:57 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-05-31 12:19:19 +0200
commit3f38d4b816b2aeca15c0b90000ea7ed40377eb0c (patch)
treee62c242680bde9cf431a30c80888ab0b66a5f4b9 /libavcodec/vp9.c
parentd68c05380cebf563915412182643a8be04ef890b (diff)
vp9: Parse subsampling and report missing feature
Diffstat (limited to 'libavcodec/vp9.c')
-rw-r--r--libavcodec/vp9.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 50b84ae97e..b9397f58c5 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -219,7 +219,29 @@ static int decode_frame_header(AVCodecContext *avctx,
return AVERROR_INVALIDDATA;
}
s->fullrange = get_bits1(&s->gb);
- // for profile 1, here follows the subsampling bits
+
+ // subsampling bits
+ if (s->profile == 1 || s->profile == 3) {
+ s->sub_x = get_bits1(&s->gb);
+ s->sub_y = get_bits1(&s->gb);
+ if (s->sub_x && s->sub_y) {
+ av_log(avctx, AV_LOG_ERROR,
+ "4:2:0 color not supported in profile 1 or 3\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (get_bits1(&s->gb)) { // reserved bit
+ av_log(avctx, AV_LOG_ERROR, "Reserved bit should be zero\n");
+ return AVERROR_INVALIDDATA;
+ }
+ } else {
+ s->sub_x = s->sub_y = 1;
+ }
+ if (!s->sub_x || !s->sub_y) {
+ avpriv_report_missing_feature(avctx, "Subsampling %d:%d",
+ s->sub_x, s->sub_y);
+ return AVERROR_PATCHWELCOME;
+ }
+
s->refreshrefmask = 0xff;
w = get_bits(&s->gb, 16) + 1;
h = get_bits(&s->gb, 16) + 1;