Verified Commit 515f5af5 authored by James Almer's avatar James Almer

Simplify dav1d_thread_picture_alloc()

It's called from a single function in the entire codebase, so no point
passing so many individual arguments to it when almost all of them are
derived from a single struct.
parent 9a33184d
Pipeline #4462 passed with stages
in 7 minutes and 29 seconds
......@@ -3185,13 +3185,7 @@ int dav1d_submit_frame(Dav1dContext *const c) {
c->n_tile_data = 0;
// allocate frame
res = dav1d_thread_picture_alloc(c, &f->sr_cur, f->frame_hdr->width[1],
f->frame_hdr->height,
f->seq_hdr, f->seq_hdr_ref,
f->frame_hdr, f->frame_hdr_ref,
bpc, &f->tile[0].data.m,
c->n_fc > 1 ? &f->frame_thread.td : NULL,
f->frame_hdr->show_frame, &c->allocator);
res = dav1d_thread_picture_alloc(c, f, bpc);
if (res < 0) goto error;
if (f->frame_hdr->super_res.enabled) {
......
......@@ -38,6 +38,7 @@
#include "common/mem.h"
#include "common/validate.h"
#include "src/internal.h"
#include "src/log.h"
#include "src/picture.h"
#include "src/ref.h"
......@@ -152,27 +153,23 @@ static int picture_alloc_with_edges(Dav1dContext *const c, Dav1dPicture *const p
return 0;
}
int dav1d_thread_picture_alloc(Dav1dContext *const c, Dav1dThreadPicture *const p,
const int w, const int h,
Dav1dSequenceHeader *seq_hdr, Dav1dRef *seq_hdr_ref,
Dav1dFrameHeader *frame_hdr, Dav1dRef *frame_hdr_ref,
const int bpc, const Dav1dDataProps *props,
struct thread_data *const t, const int visible,
Dav1dPicAllocator *const p_allocator)
int dav1d_thread_picture_alloc(Dav1dContext *const c, Dav1dFrameContext *const f,
const int bpc)
{
p->t = t;
Dav1dThreadPicture *const p = &f->sr_cur;
p->t = c->n_fc > 1 ? &f->frame_thread.td : NULL;
const int res =
picture_alloc_with_edges(c, &p->p, w, h,
seq_hdr, seq_hdr_ref,
frame_hdr, frame_hdr_ref,
bpc, props, p_allocator,
t != NULL ? sizeof(atomic_int) * 2 : 0,
picture_alloc_with_edges(c, &p->p, f->frame_hdr->width[1], f->frame_hdr->height,
f->seq_hdr, f->seq_hdr_ref,
f->frame_hdr, f->frame_hdr_ref,
bpc, &f->tile[0].data.m, &c->allocator,
p->t != NULL ? sizeof(atomic_int) * 2 : 0,
(void **) &p->progress);
if (res) return res;
p->visible = visible;
if (t) {
p->visible = f->frame_hdr->show_frame;
if (p->t) {
atomic_init(&p->progress[0], 0);
atomic_init(&p->progress[1], 0);
}
......
......@@ -55,12 +55,7 @@ typedef struct Dav1dThreadPicture {
/*
* Allocate a picture with custom border size.
*/
int dav1d_thread_picture_alloc(Dav1dContext *c, Dav1dThreadPicture *p, int w, int h,
Dav1dSequenceHeader *seq_hdr, Dav1dRef *seq_hdr_ref,
Dav1dFrameHeader *frame_hdr, Dav1dRef *frame_hdr_ref,
int bpc, const Dav1dDataProps *props,
struct thread_data *t, int visible,
Dav1dPicAllocator *);
int dav1d_thread_picture_alloc(Dav1dContext *c, Dav1dFrameContext *f, const int bpc);
/**
* Allocate a picture with identical metadata to an existing picture.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment