ref: 331d88d3ae1263251e234bbc219ebd129e91b55d
parent: 3d7920e6ff7c8e8f032a8e685595bcd38e4a3028
author: James Almer <jamrial@gmail.com>
date: Sun Sep 30 05:38:15 EDT 2018
api: add a frame type field to Dav1dPictureParameters
--- a/include/dav1d/picture.h
+++ b/include/dav1d/picture.h
@@ -40,6 +40,13 @@
DAV1D_PIXEL_LAYOUT_I444, ///< 4:4:4 planar
};
+enum Dav1dFrameType {
+ DAV1D_FRAME_TYPE_KEY = 0, ///< Key Intra frame
+ DAV1D_FRAME_TYPE_INTER = 1, ///< Inter frame
+ DAV1D_FRAME_TYPE_INTRA = 2, ///< Non key Intra frame
+ DAV1D_FRAME_TYPE_SWITCH = 3, ///< Switch Inter frame
+};
+
enum Dav1dColorPrimaries {
DAV1D_COLOR_PRI_BT709 = 1,
DAV1D_COLOR_PRI_UNKNOWN = 2,
@@ -103,6 +110,7 @@
int w; ///< width (in pixels)
int h; ///< height (in pixels)
enum Dav1dPixelLayout layout; ///< format of the picture
+ enum Dav1dFrameType type; ///< type of the picture
int bpc; ///< bits per pixel component (8 or 10)
enum Dav1dColorPrimaries pri; ///< color primaries (av1)
--- a/src/decode.c
+++ b/src/decode.c
@@ -2779,6 +2779,7 @@
}
f->cur.p.poc = f->frame_hdr.frame_offset;
+ f->cur.p.p.type = f->frame_hdr.frame_type;
f->cur.p.p.pri = f->seq_hdr.pri;
f->cur.p.p.trc = f->seq_hdr.trc;
f->cur.p.p.mtrx = f->seq_hdr.mtrx;
--- a/src/levels.h
+++ b/src/levels.h
@@ -40,13 +40,6 @@
OBU_PADDING = 15,
};
-enum FrameType {
- KEY_FRAME = 0,
- INTER_FRAME = 1,
- INTRAONLY_FRAME = 2,
- S_FRAME = 3,
-} FRAME_TYPE;
-
enum TxfmSize {
TX_4X4,
TX_8X8,
@@ -421,7 +414,7 @@
int show_existing_frame;
int existing_frame_idx;
int frame_id;
- enum FrameType frame_type;
+ enum Dav1dFrameType frame_type;
int show_frame;
int showable_frame;
int error_resilient_mode;
--- a/src/obu.c
+++ b/src/obu.c
@@ -340,13 +340,13 @@
goto end;
}
- hdr->frame_type = seqhdr->reduced_still_picture_header ? KEY_FRAME : get_bits(gb, 2);
+ hdr->frame_type = seqhdr->reduced_still_picture_header ? DAV1D_FRAME_TYPE_KEY : get_bits(gb, 2);
hdr->show_frame = seqhdr->reduced_still_picture_header || get_bits(gb, 1);
if (!hdr->show_frame)
hdr->showable_frame = get_bits(gb, 1);
hdr->error_resilient_mode =
- (hdr->frame_type == KEY_FRAME && hdr->show_frame) ||
- hdr->frame_type == S_FRAME ||
+ (hdr->frame_type == DAV1D_FRAME_TYPE_KEY && hdr->show_frame) ||
+ hdr->frame_type == DAV1D_FRAME_TYPE_SWITCH ||
seqhdr->reduced_still_picture_header || get_bits(gb, 1);
#if DEBUG_FRAME_HDR
printf("HDR: post-frametype_bits: off=%ld\n",
@@ -363,7 +363,7 @@
hdr->frame_id = get_bits(gb, seqhdr->frame_id_n_bits);
hdr->frame_size_override = seqhdr->reduced_still_picture_header ? 0 :
- hdr->frame_type == S_FRAME ? 1 : get_bits(gb, 1);
+ hdr->frame_type == DAV1D_FRAME_TYPE_SWITCH ? 1 : get_bits(gb, 1);
#if DEBUG_FRAME_HDR
printf("HDR: post-frame_size_override_flag: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
@@ -373,7 +373,7 @@
hdr->primary_ref_frame = !hdr->error_resilient_mode && hdr->frame_type & 1 ?
get_bits(gb, 3) : PRIMARY_REF_NONE;
- if (hdr->frame_type == KEY_FRAME) {
+ if (hdr->frame_type == DAV1D_FRAME_TYPE_KEY) {
hdr->refresh_frame_flags = hdr->show_frame ? 0xff : get_bits(gb, 8);
if ((res = read_frame_size(c, gb, 0)) < 0) goto error;
hdr->allow_intrabc = hdr->allow_screen_content_tools &&
@@ -384,7 +384,7 @@
for (int i = 0; i < 8; i++)
get_bits(gb, seqhdr->order_hint_n_bits);
- if (hdr->frame_type == INTRAONLY_FRAME) {
+ if (hdr->frame_type == DAV1D_FRAME_TYPE_INTRA) {
hdr->refresh_frame_flags = get_bits(gb, 8);
if ((res = read_frame_size(c, gb, 0)) < 0) goto error;
hdr->allow_intrabc = hdr->allow_screen_content_tools &&
@@ -391,7 +391,7 @@
/* FIXME: no superres scaling && */ get_bits(gb, 1);
} else {
hdr->allow_intrabc = 0;
- hdr->refresh_frame_flags = hdr->frame_type == S_FRAME ? 0xff :
+ hdr->refresh_frame_flags = hdr->frame_type == DAV1D_FRAME_TYPE_SWITCH ? 0xff :
get_bits(gb, 8);
hdr->frame_ref_short_signaling =
seqhdr->order_hint && get_bits(gb, 1);
@@ -867,7 +867,7 @@
get_bits(gb, 1);
if (hdr->film_grain.present) {
hdr->film_grain.seed = get_bits(gb, 16);
- hdr->film_grain.update = hdr->frame_type != INTER_FRAME || get_bits(gb, 1);
+ hdr->film_grain.update = hdr->frame_type != DAV1D_FRAME_TYPE_INTER || get_bits(gb, 1);
if (!hdr->film_grain.update) {
const int refidx = get_bits(gb, 3);
int i;