[FFmpeg-cvslog] vp9: Parse subsampling and report missing feature
Vittorio Giovara
git at videolan.org
Mon Jun 1 00:34:09 CEST 2015
ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Wed May 27 15:06:57 2015 +0100| [3f38d4b816b2aeca15c0b90000ea7ed40377eb0c] | committer: Vittorio Giovara
vp9: Parse subsampling and report missing feature
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f38d4b816b2aeca15c0b90000ea7ed40377eb0c
---
libavcodec/vp9.c | 24 +++++++++++++++++++++++-
libavcodec/vp9.h | 2 ++
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 50b84ae..b9397f5 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;
diff --git a/libavcodec/vp9.h b/libavcodec/vp9.h
index 724288d..c6f395e 100644
--- a/libavcodec/vp9.h
+++ b/libavcodec/vp9.h
@@ -277,6 +277,8 @@ typedef struct VP9Context {
uint8_t use_last_frame_mvs;
uint8_t errorres;
uint8_t colorspace;
+ uint8_t sub_x;
+ uint8_t sub_y;
uint8_t fullrange;
uint8_t intraonly;
uint8_t resetctx;
More information about the ffmpeg-cvslog
mailing list