diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2015-09-04 09:59:17 -0400 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2015-09-04 09:59:17 -0400 |
commit | 9ee2ddd773f98d0ce815c5715bcd9bb290d8d3cd (patch) | |
tree | ed145403f0fa6e26aab1e37e81dbdccd9731007d /libavcodec | |
parent | 10142f994acb8b640a09b615da7a1091502bd6fb (diff) | |
download | ffmpeg-9ee2ddd773f98d0ce815c5715bcd9bb290d8d3cd.tar.gz |
vp9_parse: fix parsing of pskip and profile 2/3.
The fate results change because we now correctly timestamp the pskip
frames, which means the results are now identical to -vsync 0.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/vp9_parser.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c index ab33c33414..f1f7e350d2 100644 --- a/libavcodec/vp9_parser.c +++ b/libavcodec/vp9_parser.c @@ -22,6 +22,7 @@ */ #include "libavutil/intreadwrite.h" +#include "libavcodec/get_bits.h" #include "parser.h" typedef struct VP9ParseContext { @@ -30,11 +31,28 @@ typedef struct VP9ParseContext { int64_t pts; } VP9ParseContext; -static void parse_frame(AVCodecParserContext *ctx, const uint8_t *buf, int size) +static int parse_frame(AVCodecParserContext *ctx, const uint8_t *buf, int size) { VP9ParseContext *s = ctx->priv_data; + GetBitContext gb; + int res, profile, keyframe, invisible; + + if ((res = init_get_bits8(&gb, buf, size)) < 0) + return res; + get_bits(&gb, 2); // frame marker + profile = get_bits1(&gb); + profile |= get_bits1(&gb) << 1; + if (profile == 3) profile += get_bits1(&gb); + + if (get_bits1(&gb)) { + keyframe = 0; + invisible = 0; + } else { + keyframe = !get_bits1(&gb); + invisible = !get_bits1(&gb); + } - if (buf[0] & 0x4) { + if (!keyframe) { ctx->pict_type = AV_PICTURE_TYPE_P; ctx->key_frame = 0; } else { @@ -42,7 +60,7 @@ static void parse_frame(AVCodecParserContext *ctx, const uint8_t *buf, int size) ctx->key_frame = 1; } - if (buf[0] & 0x2) { + if (!invisible) { if (ctx->pts == AV_NOPTS_VALUE) ctx->pts = s->pts; s->pts = AV_NOPTS_VALUE; @@ -50,6 +68,8 @@ static void parse_frame(AVCodecParserContext *ctx, const uint8_t *buf, int size) s->pts = ctx->pts; ctx->pts = AV_NOPTS_VALUE; } + + return 0; } static int parse(AVCodecParserContext *ctx, |