23
23
* function definitions common to libschroedinger decoder and encoder
26
#include "libdirac_libschro.h"
27
26
#include "libschroedinger.h"
27
#include "libavutil/mem.h"
29
static const SchroVideoFormatInfo ff_schro_video_format_info[] = {
30
{ 640, 480, 24000, 1001},
31
{ 176, 120, 15000, 1001},
33
{ 352, 240, 15000, 1001},
35
{ 704, 480, 15000, 1001},
37
{ 720, 480, 30000, 1001},
39
{ 1280, 720, 60000, 1001},
41
{ 1920, 1080, 30000, 1001},
42
{ 1920, 1080, 25, 1 },
43
{ 1920, 1080, 60000, 1001},
44
{ 1920, 1080, 50, 1 },
45
{ 2048, 1080, 24, 1 },
46
{ 4096, 2160, 24, 1 },
49
static unsigned int get_video_format_idx(AVCodecContext *avccontext)
51
unsigned int ret_idx = 0;
53
unsigned int num_formats = sizeof(ff_schro_video_format_info) /
54
sizeof(ff_schro_video_format_info[0]);
56
for (idx = 1; idx < num_formats; ++idx) {
57
const SchroVideoFormatInfo *vf = &ff_schro_video_format_info[idx];
58
if (avccontext->width == vf->width &&
59
avccontext->height == vf->height) {
61
if (avccontext->time_base.den == vf->frame_rate_num &&
62
avccontext->time_base.num == vf->frame_rate_denom)
69
void ff_schro_queue_init(FFSchroQueue *queue)
71
queue->p_head = queue->p_tail = NULL;
75
void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *))
78
free_func(ff_schro_queue_pop(queue));
81
int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data)
83
FFSchroQueueElement *p_new = av_mallocz(sizeof(FFSchroQueueElement));
91
queue->p_head = p_new;
93
queue->p_tail->next = p_new;
94
queue->p_tail = p_new;
100
void *ff_schro_queue_pop(FFSchroQueue *queue)
102
FFSchroQueueElement *top = queue->p_head;
105
void *data = top->data;
106
queue->p_head = queue->p_head->next;
30
116
* Schroedinger video preset table. Ensure that this tables matches up correctly
31
* with the ff_dirac_schro_video_format_info table in libdirac_libschro.c.
117
* with the ff_schro_video_format_info table.
33
119
static const SchroVideoFormatEnum ff_schro_video_formats[]={
34
120
SCHRO_VIDEO_FORMAT_CUSTOM ,
110
196
p_frame->format = schro_frame_fmt;
111
197
p_frame->width = y_width;
112
198
p_frame->height = y_height;
113
schro_frame_set_free_callback(p_frame, FreeSchroFrame, (void *)p_pic);
199
schro_frame_set_free_callback(p_frame, free_schro_frame, (void *)p_pic);
115
201
for (i = 0; i < 3; ++i) {
116
202
p_frame->components[i].width = i ? uv_width : y_width;