Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/decode.c5
-rw-r--r--src/lib.c13
-rw-r--r--src/picture.c14
-rw-r--r--src/picture.h11
4 files changed, 16 insertions, 27 deletions
diff --git a/src/decode.c b/src/decode.c
index 0b27de0..bce575b 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -3112,11 +3112,8 @@ int dav1d_submit_frame(Dav1dContext *const c) {
f->sr_cur.p.p.fullrange = f->seq_hdr.color_range;
if (f->frame_hdr.super_res.enabled) {
- res = dav1d_picture_alloc(&f->cur, f->frame_hdr.width[0],
- f->frame_hdr.height, f->seq_hdr.layout,
- f->seq_hdr.bpc, &c->allocator);
+ res = dav1d_picture_alloc_copy(&f->cur, f->frame_hdr.width[0], &f->sr_cur.p);
if (res < 0) goto error;
- f->cur.poc = f->frame_hdr.frame_offset;
} else {
dav1d_picture_ref(&f->cur, &f->sr_cur.p);
}
diff --git a/src/lib.c b/src/lib.c
index 4a52aef..183d9fd 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -187,7 +187,7 @@ static int output_image(Dav1dContext *const c, Dav1dPicture *const out,
}
// Apply film grain to a new copy of the image to avoid corrupting refs
- int res = dav1d_picture_alloc_copy(out, in);
+ int res = dav1d_picture_alloc_copy(out, in->p.w, in);
if (res < 0)
return res;
@@ -233,14 +233,11 @@ int dav1d_get_picture(Dav1dContext *const c, Dav1dPicture *const out)
if (++c->frame_thread.next == c->n_fc)
c->frame_thread.next = 0;
if (out_delayed->p.data[0]) {
- if (out_delayed->visible && !out_delayed->flushed) {
- dav1d_picture_ref(out, &out_delayed->p);
- }
+ if (out_delayed->visible && !out_delayed->flushed)
+ dav1d_picture_ref(&c->out, &out_delayed->p);
dav1d_thread_picture_unref(out_delayed);
- if (out->data[0]) {
- return 0;
- }
- // else continue
+ if (c->out.data[0])
+ return output_image(c, out, &c->out);
}
} while (++flush_count < c->n_fc);
return -EAGAIN;
diff --git a/src/picture.c b/src/picture.c
index 207fcf4..07aefdf 100644
--- a/src/picture.c
+++ b/src/picture.c
@@ -150,13 +150,6 @@ static int picture_alloc_with_edges(Dav1dPicture *const p,
return 0;
}
-int dav1d_picture_alloc(Dav1dPicture *const p, const int w, const int h,
- const enum Dav1dPixelLayout layout, const int bpc,
- Dav1dPicAllocator *const p_allocator)
-{
- return picture_alloc_with_edges(p, w, h, layout, bpc, p_allocator, 0, NULL);
-}
-
int dav1d_thread_picture_alloc(Dav1dThreadPicture *const p,
const int w, const int h,
const enum Dav1dPixelLayout layout, const int bpc,
@@ -180,12 +173,13 @@ int dav1d_thread_picture_alloc(Dav1dThreadPicture *const p,
return res;
}
-int dav1d_picture_alloc_copy(Dav1dPicture *const dst,
+int dav1d_picture_alloc_copy(Dav1dPicture *const dst, const int w,
const Dav1dPicture *const src)
{
struct pic_ctx_context *const pic_ctx = src->ref->user_data;
- int res = dav1d_picture_alloc(dst, src->p.w, src->p.h, src->p.layout,
- src->p.bpc, &pic_ctx->allocator);
+ const int res = picture_alloc_with_edges(dst, w, src->p.h, src->p.layout,
+ src->p.bpc, &pic_ctx->allocator,
+ 0, NULL);
if (!res) {
dst->poc = src->poc;
diff --git a/src/picture.h b/src/picture.h
index 60fb59c..12f1f97 100644
--- a/src/picture.h
+++ b/src/picture.h
@@ -54,10 +54,6 @@ typedef struct Dav1dThreadPicture {
/*
* Allocate a picture with custom border size.
*/
-int dav1d_picture_alloc(Dav1dPicture *p, int w, int h,
- enum Dav1dPixelLayout layout, int bpc,
- Dav1dPicAllocator *);
-
int dav1d_thread_picture_alloc(Dav1dThreadPicture *p, int w, int h,
enum Dav1dPixelLayout layout, int bpc,
struct thread_data *t, int visible,
@@ -65,8 +61,13 @@ int dav1d_thread_picture_alloc(Dav1dThreadPicture *p, int w, int h,
/**
* Allocate a picture with identical metadata to an existing picture.
+ * The width is a separate argument so this function can be used for
+ * super-res, where the width changes, but everything else is the same.
+ * For the more typical use case of allocating a new image of the same
+ * dimensions, use src->p.w as width.
*/
-int dav1d_picture_alloc_copy(Dav1dPicture *dst, const Dav1dPicture *src);
+int dav1d_picture_alloc_copy(Dav1dPicture *dst, const int w,
+ const Dav1dPicture *src);
/**
* Create a copy of a picture.