FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
libschroedingerenc.c
Go to the documentation of this file.
1 /*
2  * Dirac encoder support via Schroedinger libraries
3  * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23 * @file
24 * Dirac encoder support via libschroedinger-1.0 libraries. More details about
25 * the Schroedinger project can be found at http://www.diracvideo.org/.
26 * The library implements Dirac Specification Version 2.2
27 * (http://dirac.sourceforge.net/specification.html).
28 */
29 
30 #include <schroedinger/schro.h>
31 #include <schroedinger/schrodebug.h>
32 #include <schroedinger/schrovideoformat.h>
33 
34 #include "libavutil/attributes.h"
35 #include "libavutil/avassert.h"
36 #include "libavutil/imgutils.h"
37 #include "libavutil/opt.h"
38 
39 #include "avcodec.h"
40 #include "internal.h"
41 #include "libschroedinger.h"
42 #include "bytestream.h"
43 
44 
45 /** libschroedinger encoder private data */
46 typedef struct SchroEncoderParams {
47  AVClass *class;
48 
49  /** Schroedinger video format */
50  SchroVideoFormat *format;
51 
52  /** Schroedinger frame format */
53  SchroFrameFormat frame_format;
54 
55  /** frame size */
57 
58  /** Schroedinger encoder handle*/
59  SchroEncoder* encoder;
60 
61  /** buffer to store encoder output before writing it to the frame queue*/
62  unsigned char *enc_buf;
63 
64  /** Size of encoder buffer*/
66 
67  /** queue storing encoded frames */
69 
70  /** end of sequence signalled */
72 
73  /** end of sequence pulled */
75 
76  /* counter for frames submitted to encoder, used as dts */
77  int64_t dts;
78 
79  /** enable noarith */
80  int noarith;
82 
83 /**
84 * Works out Schro-compatible chroma format.
85 */
87 {
88  int num_formats = sizeof(schro_pixel_format_map) /
89  sizeof(schro_pixel_format_map[0]);
90  int idx;
91 
92  SchroEncoderParams *p_schro_params = avctx->priv_data;
93 
94  for (idx = 0; idx < num_formats; ++idx) {
95  if (schro_pixel_format_map[idx].ff_pix_fmt == avctx->pix_fmt) {
96  p_schro_params->format->chroma_format =
97  schro_pixel_format_map[idx].schro_pix_fmt;
98  return 0;
99  }
100  }
101 
102  av_log(avctx, AV_LOG_ERROR,
103  "This codec currently only supports planar YUV 4:2:0, 4:2:2"
104  " and 4:4:4 formats.\n");
105 
106  return -1;
107 }
108 
110 {
111  SchroEncoderParams *p_schro_params = avctx->priv_data;
112  SchroVideoFormatEnum preset;
113 
114  /* Initialize the libraries that libschroedinger depends on. */
115  schro_init();
116 
117  /* Create an encoder object. */
118  p_schro_params->encoder = schro_encoder_new();
119 
120  if (!p_schro_params->encoder) {
121  av_log(avctx, AV_LOG_ERROR,
122  "Unrecoverable Error: schro_encoder_new failed. ");
123  return -1;
124  }
125 
126  /* Initialize the format. */
127  preset = ff_get_schro_video_format_preset(avctx);
128  p_schro_params->format =
129  schro_encoder_get_video_format(p_schro_params->encoder);
130  schro_video_format_set_std_video_format(p_schro_params->format, preset);
131  p_schro_params->format->width = avctx->width;
132  p_schro_params->format->height = avctx->height;
133 
134  if (set_chroma_format(avctx) == -1)
135  return -1;
136 
137  if (avctx->color_primaries == AVCOL_PRI_BT709) {
138  p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_HDTV;
139  } else if (avctx->color_primaries == AVCOL_PRI_BT470BG) {
140  p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_SDTV_625;
141  } else if (avctx->color_primaries == AVCOL_PRI_SMPTE170M) {
142  p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_SDTV_525;
143  }
144 
145  if (avctx->colorspace == AVCOL_SPC_BT709) {
146  p_schro_params->format->colour_matrix = SCHRO_COLOUR_MATRIX_HDTV;
147  } else if (avctx->colorspace == AVCOL_SPC_BT470BG) {
148  p_schro_params->format->colour_matrix = SCHRO_COLOUR_MATRIX_SDTV;
149  }
150 
151  if (avctx->color_trc == AVCOL_TRC_BT709) {
152  p_schro_params->format->transfer_function = SCHRO_TRANSFER_CHAR_TV_GAMMA;
153  }
154 
155  if (ff_get_schro_frame_format(p_schro_params->format->chroma_format,
156  &p_schro_params->frame_format) == -1) {
157  av_log(avctx, AV_LOG_ERROR,
158  "This codec currently supports only planar YUV 4:2:0, 4:2:2"
159  " and 4:4:4 formats.\n");
160  return -1;
161  }
162 
163  p_schro_params->format->frame_rate_numerator = avctx->time_base.den;
164  p_schro_params->format->frame_rate_denominator = avctx->time_base.num;
165 
166  p_schro_params->frame_size = av_image_get_buffer_size(avctx->pix_fmt,
167  avctx->width,
168  avctx->height, 1);
169 
170  if (!avctx->gop_size) {
171  schro_encoder_setting_set_double(p_schro_params->encoder,
172  "gop_structure",
173  SCHRO_ENCODER_GOP_INTRA_ONLY);
174 
175 #if FF_API_CODER_TYPE
177  if (avctx->coder_type != FF_CODER_TYPE_VLC)
178  p_schro_params->noarith = 0;
180 #endif
181  schro_encoder_setting_set_double(p_schro_params->encoder,
182  "enable_noarith",
183  p_schro_params->noarith);
184  } else {
185  schro_encoder_setting_set_double(p_schro_params->encoder,
186  "au_distance", avctx->gop_size);
187  avctx->has_b_frames = 1;
188  p_schro_params->dts = -1;
189  }
190 
191  /* FIXME - Need to handle SCHRO_ENCODER_RATE_CONTROL_LOW_DELAY. */
192  if (avctx->flags & AV_CODEC_FLAG_QSCALE) {
193  if (!avctx->global_quality) {
194  /* lossless coding */
195  schro_encoder_setting_set_double(p_schro_params->encoder,
196  "rate_control",
197  SCHRO_ENCODER_RATE_CONTROL_LOSSLESS);
198  } else {
199  int quality;
200  schro_encoder_setting_set_double(p_schro_params->encoder,
201  "rate_control",
202  SCHRO_ENCODER_RATE_CONTROL_CONSTANT_QUALITY);
203 
204  quality = avctx->global_quality / FF_QP2LAMBDA;
205  if (quality > 10)
206  quality = 10;
207  schro_encoder_setting_set_double(p_schro_params->encoder,
208  "quality", quality);
209  }
210  } else {
211  schro_encoder_setting_set_double(p_schro_params->encoder,
212  "rate_control",
213  SCHRO_ENCODER_RATE_CONTROL_CONSTANT_BITRATE);
214 
215  schro_encoder_setting_set_double(p_schro_params->encoder,
216  "bitrate", avctx->bit_rate);
217  }
218 
219  if (avctx->flags & AV_CODEC_FLAG_INTERLACED_ME)
220  /* All material can be coded as interlaced or progressive
221  irrespective of the type of source material. */
222  schro_encoder_setting_set_double(p_schro_params->encoder,
223  "interlaced_coding", 1);
224 
225  schro_encoder_setting_set_double(p_schro_params->encoder, "open_gop",
226  !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP));
227 
228  /* FIXME: Signal range hardcoded to 8-bit data until both libschroedinger
229  * and libdirac support other bit-depth data. */
230  schro_video_format_set_std_signal_range(p_schro_params->format,
231  SCHRO_SIGNAL_RANGE_8BIT_VIDEO);
232 
233  /* Set the encoder format. */
234  schro_encoder_set_video_format(p_schro_params->encoder,
235  p_schro_params->format);
236 
237  /* Set the debug level. */
238  schro_debug_set_level(avctx->debug);
239 
240  schro_encoder_start(p_schro_params->encoder);
241 
242  /* Initialize the encoded frame queue. */
243  ff_schro_queue_init(&p_schro_params->enc_frame_queue);
244  return 0;
245 }
246 
248  const AVFrame *frame)
249 {
250  SchroEncoderParams *p_schro_params = avctx->priv_data;
251  SchroFrame *in_frame = ff_create_schro_frame(avctx,
252  p_schro_params->frame_format);
253 
254  if (in_frame) {
255  /* Copy input data to SchroFrame buffers (they match the ones
256  * referenced by the AVFrame stored in priv) */
257  if (av_frame_copy(in_frame->priv, frame) < 0) {
258  av_log(avctx, AV_LOG_ERROR, "Failed to copy input data\n");
259  return NULL;
260  }
261  }
262 
263  return in_frame;
264 }
265 
267 {
268  FFSchroEncodedFrame *enc_frame = data;
269 
270  av_freep(&enc_frame->p_encbuf);
271  av_free(enc_frame);
272 }
273 
275  const AVFrame *frame, int *got_packet)
276 {
277  int enc_size = 0;
278  SchroEncoderParams *p_schro_params = avctx->priv_data;
279  SchroEncoder *encoder = p_schro_params->encoder;
280  struct FFSchroEncodedFrame *p_frame_output = NULL;
281  int go = 1;
282  SchroBuffer *enc_buf;
283  int presentation_frame;
284  int parse_code;
285  int last_frame_in_sequence = 0;
286  int pkt_size, ret;
287 
288  if (!frame) {
289  /* Push end of sequence if not already signalled. */
290  if (!p_schro_params->eos_signalled) {
291  schro_encoder_end_of_stream(encoder);
292  p_schro_params->eos_signalled = 1;
293  }
294  } else {
295  /* Allocate frame data to schro input buffer. */
296  SchroFrame *in_frame = libschroedinger_frame_from_data(avctx, frame);
297  if (!in_frame)
298  return AVERROR(ENOMEM);
299  /* Load next frame. */
300  schro_encoder_push_frame(encoder, in_frame);
301  }
302 
303  if (p_schro_params->eos_pulled)
304  go = 0;
305 
306  /* Now check to see if we have any output from the encoder. */
307  while (go) {
308  int err;
309  SchroStateEnum state;
310  state = schro_encoder_wait(encoder);
311  switch (state) {
312  case SCHRO_STATE_HAVE_BUFFER:
313  case SCHRO_STATE_END_OF_STREAM:
314  enc_buf = schro_encoder_pull(encoder, &presentation_frame);
315  if (enc_buf->length <= 0)
316  return AVERROR_BUG;
317  parse_code = enc_buf->data[4];
318 
319  /* All non-frame data is prepended to actual frame data to
320  * be able to set the pts correctly. So we don't write data
321  * to the frame output queue until we actually have a frame
322  */
323  if ((err = av_reallocp(&p_schro_params->enc_buf,
324  p_schro_params->enc_buf_size +
325  enc_buf->length)) < 0) {
326  p_schro_params->enc_buf_size = 0;
327  return err;
328  }
329 
330  memcpy(p_schro_params->enc_buf + p_schro_params->enc_buf_size,
331  enc_buf->data, enc_buf->length);
332  p_schro_params->enc_buf_size += enc_buf->length;
333 
334 
335  if (state == SCHRO_STATE_END_OF_STREAM) {
336  p_schro_params->eos_pulled = 1;
337  go = 0;
338  }
339 
340  if (!SCHRO_PARSE_CODE_IS_PICTURE(parse_code)) {
341  schro_buffer_unref(enc_buf);
342  break;
343  }
344 
345  /* Create output frame. */
346  p_frame_output = av_mallocz(sizeof(FFSchroEncodedFrame));
347  if (!p_frame_output)
348  return AVERROR(ENOMEM);
349  /* Set output data. */
350  p_frame_output->size = p_schro_params->enc_buf_size;
351  p_frame_output->p_encbuf = p_schro_params->enc_buf;
352  if (SCHRO_PARSE_CODE_IS_INTRA(parse_code) &&
353  SCHRO_PARSE_CODE_IS_REFERENCE(parse_code))
354  p_frame_output->key_frame = 1;
355 
356  /* Parse the coded frame number from the bitstream. Bytes 14
357  * through 17 represent the frame number. */
358  p_frame_output->frame_num = AV_RB32(enc_buf->data + 13);
359 
360  ff_schro_queue_push_back(&p_schro_params->enc_frame_queue,
361  p_frame_output);
362  p_schro_params->enc_buf_size = 0;
363  p_schro_params->enc_buf = NULL;
364 
365  schro_buffer_unref(enc_buf);
366 
367  break;
368 
369  case SCHRO_STATE_NEED_FRAME:
370  go = 0;
371  break;
372 
373  case SCHRO_STATE_AGAIN:
374  break;
375 
376  default:
377  av_log(avctx, AV_LOG_ERROR, "Unknown Schro Encoder state\n");
378  return -1;
379  }
380  }
381 
382  /* Copy 'next' frame in queue. */
383 
384  if (p_schro_params->enc_frame_queue.size == 1 &&
385  p_schro_params->eos_pulled)
386  last_frame_in_sequence = 1;
387 
388  p_frame_output = ff_schro_queue_pop(&p_schro_params->enc_frame_queue);
389 
390  if (!p_frame_output)
391  return 0;
392 
393  pkt_size = p_frame_output->size;
394  if (last_frame_in_sequence && p_schro_params->enc_buf_size > 0)
395  pkt_size += p_schro_params->enc_buf_size;
396  if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size, 0)) < 0)
397  goto error;
398 
399  memcpy(pkt->data, p_frame_output->p_encbuf, p_frame_output->size);
400 #if FF_API_CODED_FRAME
402  avctx->coded_frame->key_frame = p_frame_output->key_frame;
403  avctx->coded_frame->pts = p_frame_output->frame_num;
405 #endif
406  /* Use the frame number of the encoded frame as the pts. It is OK to
407  * do so since Dirac is a constant frame rate codec. It expects input
408  * to be of constant frame rate. */
409  pkt->pts = p_frame_output->frame_num;
410  pkt->dts = p_schro_params->dts++;
411  enc_size = p_frame_output->size;
412 
413  /* Append the end of sequence information to the last frame in the
414  * sequence. */
415  if (last_frame_in_sequence && p_schro_params->enc_buf_size > 0) {
416  memcpy(pkt->data + enc_size, p_schro_params->enc_buf,
417  p_schro_params->enc_buf_size);
418  enc_size += p_schro_params->enc_buf_size;
419  av_freep(&p_schro_params->enc_buf);
420  p_schro_params->enc_buf_size = 0;
421  }
422 
423  if (p_frame_output->key_frame)
424  pkt->flags |= AV_PKT_FLAG_KEY;
425  *got_packet = 1;
426 
427 error:
428  /* free frame */
429  libschroedinger_free_frame(p_frame_output);
430  return ret;
431 }
432 
433 
435 {
436  SchroEncoderParams *p_schro_params = avctx->priv_data;
437 
438  /* Close the encoder. */
439  schro_encoder_free(p_schro_params->encoder);
440 
441  /* Free data in the output frame queue. */
442  ff_schro_queue_free(&p_schro_params->enc_frame_queue,
444 
445 
446  /* Free the encoder buffer. */
447  if (p_schro_params->enc_buf_size)
448  av_freep(&p_schro_params->enc_buf);
449 
450  /* Free the video format structure. */
451  av_freep(&p_schro_params->format);
452 
453  return 0;
454 }
455 
456 #define OFFSET(x) offsetof(SchroEncoderParams, x)
457 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
458 static const AVOption options[] = {
459  { "noarith", "Enable noarith", OFFSET(noarith), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
460 
461  { NULL },
462 };
463 
465  .class_name = "libschroedinger",
466  .item_name = av_default_item_name,
467  .option = options,
468  .version = LIBAVUTIL_VERSION_INT,
469 };
470 
472  .name = "libschroedinger",
473  .long_name = NULL_IF_CONFIG_SMALL("libschroedinger Dirac 2.2"),
474  .type = AVMEDIA_TYPE_VIDEO,
475  .id = AV_CODEC_ID_DIRAC,
476  .priv_data_size = sizeof(SchroEncoderParams),
477  .priv_class = &libschroedinger_class,
479  .encode2 = libschroedinger_encode_frame,
481  .capabilities = AV_CODEC_CAP_DELAY,
482  .pix_fmts = (const enum AVPixelFormat[]){
484  },
485 };
#define VE
#define AV_CODEC_FLAG_INTERLACED_ME
interlaced motion estimation
Definition: avcodec.h:934
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
Definition: pixfmt.h:456
#define NULL
Definition: coverity.c:32
This structure describes decoded (raw) audio or video data.
Definition: frame.h:194
AVOption.
Definition: opt.h:246
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:67
misc image utilities
int64_t bit_rate
the average bitrate
Definition: avcodec.h:1808
#define LIBAVUTIL_VERSION_INT
Definition: version.h:86
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
uint16_t key_frame
key frame flag.
SchroFrame * ff_create_schro_frame(AVCodecContext *avctx, SchroFrameFormat schro_frame_fmt)
Create a Schro frame based on the dimensions and frame format passed.
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
Definition: pixfmt.h:460
int num
Numerator.
Definition: rational.h:59
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1971
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:222
libschroedinger encoder private data
static AVPacket pkt
int frame_size
frame size
data structures common to libschroedinger decoder and encoder
AVCodec.
Definition: avcodec.h:3719
enum AVPixelFormat ff_pix_fmt
Macro definitions for various function/variable attributes.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avcodec.h:1880
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: avcodec.h:1023
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
Definition: encode.c:32
static void libschroedinger_free_frame(void *data)
#define av_cold
Definition: attributes.h:82
AVOptions.
uint32_t frame_num
encoded frame number.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:287
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
Definition: bytestream.h:87
static AVFrame * frame
uint8_t * data
Definition: avcodec.h:1668
contains a single encoded frame returned from Dirac or Schroedinger
int size
Queue size.
#define av_log(a,...)
uint8_t * p_encbuf
encoded frame data
static const struct @86 schro_pixel_format_map[]
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1700
static int set_chroma_format(AVCodecContext *avctx)
Works out Schro-compatible chroma format.
int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align)
Return the size in bytes of the amount of data required to store an image with the given parameters...
Definition: imgutils.c:429
int noarith
enable noarith
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
int has_b_frames
Size of the frame reordering buffer in the decoder.
Definition: avcodec.h:2065
SchroEncoder * encoder
Schroedinger encoder handle.
SchroFrameFormat frame_format
Schroedinger frame format.
av_default_item_name
void * ff_schro_queue_pop(FFSchroQueue *queue)
Return the first element in the queue.
#define AVERROR(e)
Definition: error.h:43
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:1838
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
Definition: pixfmt.h:403
simple assert() macros that are a bit more flexible than ISO C assert().
const char * name
Name of the codec implementation.
Definition: avcodec.h:3726
FFSchroQueue enc_frame_queue
queue storing encoded frames
SchroVideoFormat * format
Schroedinger video format.
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
Definition: frame.c:737
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:1674
int ff_get_schro_frame_format(SchroChromaFormat schro_pix_fmt, SchroFrameFormat *schro_frame_fmt)
Sets the Schroedinger frame format corresponding to the Schro chroma format passed.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:66
int enc_buf_size
Size of encoder buffer.
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
Definition: avcodec.h:872
int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data)
Add an element to the end of the queue.
void ff_schro_queue_free(FFSchroQueue *queue, void(*free_func)(void *))
Free the queue resources.
av_cold void ff_schro_queue_init(FFSchroQueue *queue)
Initialise the queue.
A simple queue implementation used in libschroedinger.
int width
picture width / height.
Definition: avcodec.h:1930
static av_cold int libschroedinger_encode_init(AVCodecContext *avctx)
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:408
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition: avcodec.h:2459
static int libschroedinger_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
int eos_signalled
end of sequence signalled
attribute_deprecated int coder_type
Definition: avcodec.h:2796
static void error(const char *err)
also ITU-R BT1361
Definition: pixfmt.h:427
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
Definition: mem.c:163
Libavcodec external API header.
int debug
debug
Definition: avcodec.h:2984
main external API structure.
Definition: avcodec.h:1743
static const AVOption options[]
unsigned char * enc_buf
buffer to store encoder output before writing it to the frame queue
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:50
Describe the class of an AVClass context structure.
Definition: log.h:67
#define FF_CODER_TYPE_VLC
Definition: avcodec.h:2785
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:2473
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition: avcodec.h:2466
SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avctx)
Returns the video format preset matching the input video dimensions and time base.
static struct @258 state
int eos_pulled
end of sequence pulled
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:266
int global_quality
Global quality for codecs which cannot change it per frame.
Definition: avcodec.h:1824
static SchroFrame * libschroedinger_frame_from_data(AVCodecContext *avctx, const AVFrame *frame)
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
Definition: avcodec.h:1956
preset
Definition: vf_curves.c:46
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:83
common internal api header.
attribute_deprecated AVFrame * coded_frame
the picture in the bitstream
Definition: avcodec.h:3163
AVCodec ff_libschroedinger_encoder
int den
Denominator.
Definition: rational.h:60
#define OFFSET(x)
static int libschroedinger_encode_close(AVCodecContext *avctx)
void * priv_data
Definition: avcodec.h:1785
static const AVClass libschroedinger_class
#define av_free(p)
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:84
uint32_t size
encoded frame size
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:272
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
Definition: avutil.h:227
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
Definition: avcodec.h:1667
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
Definition: pixfmt.h:409
#define av_freep(p)
#define AV_CODEC_FLAG_CLOSED_GOP
Definition: avcodec.h:935
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60
This structure stores compressed data.
Definition: avcodec.h:1645
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:1661