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.
pull/149/head
Ronald S. Bultje 10 years ago
parent 10142f994a
commit 9ee2ddd773
  1. 26
      libavcodec/vp9_parser.c
  2. 6
      tests/ref/fate/vp9-10-show-existing-frame
  3. 1
      tests/ref/fate/vp9-10-show-existing-frame2
  4. 6
      tests/ref/fate/vp9-16-intra-only

@ -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,

@ -5,10 +5,14 @@
#stream#, dts, pts, duration, size, hash
0, 0, 0, 1, 152064, 18981342ec178e082519451062c3a67f
0, 1, 1, 1, 152064, 04ab9dbeac49ec31be58f6e671698e05
0, 4, 4, 1, 152064, 4ed58a0ba93a5d97a232a50c5876cda2
0, 6, 6, 1, 152064, a41f00034923e56ba51a0b598acc2e3a
0, 7, 7, 1, 152064, 63fa55ae9535ccdf06d44cce8065dda6
0, 8, 8, 1, 152064, a41f00034923e56ba51a0b598acc2e3a
0, 9, 9, 1, 152064, 0e4b08e14d919edee2bbff2ecd47de57
0, 10, 10, 1, 152064, 0e4b08e14d919edee2bbff2ecd47de57
0, 11, 11, 1, 152064, 0e4b08e14d919edee2bbff2ecd47de57
0, 12, 12, 1, 152064, 5d4af03fc3d410413ef2b5a6275528b7
0, 13, 13, 1, 152064, 9e932915c67a789f6877e6d3f76d3649
0, 14, 14, 1, 152064, 12f2e975c217e7ffcf334524e8acec35
0, 15, 15, 1, 152064, 9e932915c67a789f6877e6d3f76d3649
0, 16, 16, 1, 152064, 12f2e975c217e7ffcf334524e8acec35

@ -15,6 +15,7 @@
0, 9, 9, 1, 152064, 7dc65a2af108379f2b9265a9a1ea7cf8
0, 10, 10, 1, 152064, c979e2f084760775a567f60f79f28198
0, 11, 11, 1, 152064, fe668a6417aa0543e4ed4d1c67c5cbcb
0, 12, 12, 1, 152064, bf9901e39815fa93cce0ed5b02b2ef2d
0, 13, 13, 1, 152064, 627466200370e6ad60ea570d31be66e3
0, 14, 14, 1, 152064, 7dc65a2af108379f2b9265a9a1ea7cf8
0, 15, 15, 1, 152064, c979e2f084760775a567f60f79f28198

@ -6,5 +6,7 @@
0, 0, 0, 1, 152064, d57529601178948afa4818c3c8938884
0, 1, 1, 1, 152064, d47e00250c45733d64af067a417bcd06
0, 2, 2, 1, 152064, 984e41cd8350808ac6129746b2377818
0, 4, 4, 1, 152064, 76ba63001170b8992fc72be5c4ace731
0, 5, 5, 1, 152064, c4e7f96a8fd58d901b1d881926ddae09
0, 3, 3, 1, 152064, a5fa62996b4bb52e72e335722cf55bef
0, 4, 4, 1, 152064, b71ca5ad650170ac921a71a6440fb508
0, 5, 5, 1, 152064, 76ba63001170b8992fc72be5c4ace731
0, 6, 6, 1, 152064, c4e7f96a8fd58d901b1d881926ddae09

Loading…
Cancel
Save