FFmpeg
libkvazaar.c
Go to the documentation of this file.
1 /*
2  * libkvazaar encoder
3  *
4  * Copyright (c) 2015 Tampere University of Technology
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include <kvazaar.h>
24 #include <stdint.h>
25 #include <string.h>
26 
27 #include "libavutil/attributes.h"
28 #include "libavutil/avassert.h"
29 #include "libavutil/dict.h"
30 #include "libavutil/error.h"
31 #include "libavutil/imgutils.h"
32 #include "libavutil/internal.h"
33 #include "libavutil/log.h"
34 #include "libavutil/mem.h"
35 #include "libavutil/pixdesc.h"
36 #include "libavutil/opt.h"
37 
38 #include "avcodec.h"
39 #include "codec_internal.h"
40 #include "encode.h"
41 #include "packet_internal.h"
42 
43 typedef struct LibkvazaarContext {
44  const AVClass *class;
45 
46  const kvz_api *api;
47  kvz_encoder *encoder;
48  kvz_config *config;
49 
50  char *kvz_params;
52 
54 {
55  LibkvazaarContext *const ctx = avctx->priv_data;
56  const kvz_api *const api = ctx->api = kvz_api_get(8);
57  kvz_config *cfg = NULL;
58  kvz_encoder *enc = NULL;
59 
60  /* Kvazaar requires width and height to be multiples of eight. */
61  if (avctx->width % 8 || avctx->height % 8) {
62  av_log(avctx, AV_LOG_ERROR,
63  "Video dimensions are not a multiple of 8 (%dx%d).\n",
64  avctx->width, avctx->height);
65  return AVERROR(ENOSYS);
66  }
67 
68  ctx->config = cfg = api->config_alloc();
69  if (!cfg) {
70  av_log(avctx, AV_LOG_ERROR,
71  "Could not allocate kvazaar config structure.\n");
72  return AVERROR(ENOMEM);
73  }
74 
75  if (!api->config_init(cfg)) {
76  av_log(avctx, AV_LOG_ERROR,
77  "Could not initialize kvazaar config structure.\n");
78  return AVERROR_BUG;
79  }
80 
81  cfg->width = avctx->width;
82  cfg->height = avctx->height;
83 
84  if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
85  cfg->framerate_num = avctx->framerate.num;
86  cfg->framerate_denom = avctx->framerate.den;
87  } else {
88  cfg->framerate_num = avctx->time_base.den;
90  cfg->framerate_denom = avctx->time_base.num
91 #if FF_API_TICKS_PER_FRAME
92  * avctx->ticks_per_frame
93 #endif
94  ;
96  }
97  cfg->target_bitrate = avctx->bit_rate;
98  cfg->vui.sar_width = avctx->sample_aspect_ratio.num;
99  cfg->vui.sar_height = avctx->sample_aspect_ratio.den;
100  if (avctx->bit_rate) {
101  cfg->rc_algorithm = KVZ_LAMBDA;
102  }
103 
104  cfg->vui.fullrange = avctx->color_range == AVCOL_RANGE_JPEG;
105  cfg->vui.colorprim = avctx->color_primaries;
106  cfg->vui.transfer = avctx->color_trc;
107  cfg->vui.colormatrix = avctx->colorspace;
109  cfg->vui.chroma_loc = avctx->chroma_sample_location - 1;
110 
111  if (ctx->kvz_params) {
112  AVDictionary *dict = NULL;
113  if (!av_dict_parse_string(&dict, ctx->kvz_params, "=", ",", 0)) {
114  const AVDictionaryEntry *entry = NULL;
115  while ((entry = av_dict_iterate(dict, entry))) {
116  if (!api->config_parse(cfg, entry->key, entry->value)) {
117  av_log(avctx, AV_LOG_WARNING, "Invalid option: %s=%s.\n",
118  entry->key, entry->value);
119  }
120  }
121  }
122  av_dict_free(&dict);
123  }
124 
125  ctx->encoder = enc = api->encoder_open(cfg);
126  if (!enc) {
127  av_log(avctx, AV_LOG_ERROR, "Could not open kvazaar encoder.\n");
128  return AVERROR_BUG;
129  }
130 
131  if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
132  kvz_data_chunk *data_out = NULL;
133  kvz_data_chunk *chunk = NULL;
134  uint32_t len_out;
135  uint8_t *p;
136 
137  if (!api->encoder_headers(enc, &data_out, &len_out))
138  return AVERROR(ENOMEM);
139 
140  avctx->extradata = p = av_mallocz(len_out + AV_INPUT_BUFFER_PADDING_SIZE);
141  if (!p) {
142  ctx->api->chunk_free(data_out);
143  return AVERROR(ENOMEM);
144  }
145 
146  avctx->extradata_size = len_out;
147 
148  for (chunk = data_out; chunk != NULL; chunk = chunk->next) {
149  memcpy(p, chunk->data, chunk->len);
150  p += chunk->len;
151  }
152 
153  ctx->api->chunk_free(data_out);
154  }
155 
156  return 0;
157 }
158 
160 {
161  LibkvazaarContext *ctx = avctx->priv_data;
162 
163  if (ctx->api) {
164  ctx->api->encoder_close(ctx->encoder);
165  ctx->api->config_destroy(ctx->config);
166  }
167 
168  return 0;
169 }
170 
172  AVPacket *avpkt,
173  const AVFrame *frame,
174  int *got_packet_ptr)
175 {
176  LibkvazaarContext *ctx = avctx->priv_data;
177  kvz_picture *input_pic = NULL;
178  kvz_picture *recon_pic = NULL;
179  kvz_frame_info frame_info;
180  kvz_data_chunk *data_out = NULL;
181  uint32_t len_out = 0;
182  int retval = 0;
183  int pict_type;
184 
185  *got_packet_ptr = 0;
186 
187  if (frame) {
188  if (frame->width != ctx->config->width ||
189  frame->height != ctx->config->height) {
190  av_log(avctx, AV_LOG_ERROR,
191  "Changing video dimensions during encoding is not supported. "
192  "(changed from %dx%d to %dx%d)\n",
193  ctx->config->width, ctx->config->height,
194  frame->width, frame->height);
195  retval = AVERROR_INVALIDDATA;
196  goto done;
197  }
198 
199  if (frame->format != avctx->pix_fmt) {
200  av_log(avctx, AV_LOG_ERROR,
201  "Changing pixel format during encoding is not supported. "
202  "(changed from %s to %s)\n",
204  av_get_pix_fmt_name(frame->format));
205  retval = AVERROR_INVALIDDATA;
206  goto done;
207  }
208 
209  // Allocate input picture for kvazaar.
210  input_pic = ctx->api->picture_alloc(frame->width, frame->height);
211  if (!input_pic) {
212  av_log(avctx, AV_LOG_ERROR, "Failed to allocate picture.\n");
213  retval = AVERROR(ENOMEM);
214  goto done;
215  }
216 
217  // Copy pixels from frame to input_pic.
218  {
219  uint8_t *dst[4] = {
220  input_pic->data[0],
221  input_pic->data[1],
222  input_pic->data[2],
223  NULL,
224  };
225  int dst_linesizes[4] = {
226  frame->width,
227  frame->width / 2,
228  frame->width / 2,
229  0
230  };
231  av_image_copy2(dst, dst_linesizes,
232  frame->data, frame->linesize,
233  frame->format, frame->width, frame->height);
234  }
235 
236  input_pic->pts = frame->pts;
237  }
238 
239  retval = ctx->api->encoder_encode(ctx->encoder,
240  input_pic,
241  &data_out, &len_out,
242  &recon_pic, NULL,
243  &frame_info);
244  if (!retval) {
245  av_log(avctx, AV_LOG_ERROR, "Failed to encode frame.\n");
246  retval = AVERROR_INVALIDDATA;
247  goto done;
248  } else
249  retval = 0; /* kvazaar returns 1 on success */
250 
251  if (data_out) {
252  kvz_data_chunk *chunk = NULL;
253  uint64_t written = 0;
254 
255  retval = ff_get_encode_buffer(avctx, avpkt, len_out, 0);
256  if (retval < 0) {
257  av_log(avctx, AV_LOG_ERROR, "Failed to allocate output packet.\n");
258  goto done;
259  }
260 
261  for (chunk = data_out; chunk != NULL; chunk = chunk->next) {
262  av_assert0(written + chunk->len <= len_out);
263  memcpy(avpkt->data + written, chunk->data, chunk->len);
264  written += chunk->len;
265  }
266 
267  avpkt->pts = recon_pic->pts;
268  avpkt->dts = recon_pic->dts;
269  avpkt->flags = 0;
270  // IRAP VCL NAL unit types span the range
271  // [BLA_W_LP (16), RSV_IRAP_VCL23 (23)].
272  if (frame_info.nal_unit_type >= KVZ_NAL_BLA_W_LP &&
273  frame_info.nal_unit_type <= KVZ_NAL_RSV_IRAP_VCL23) {
274  avpkt->flags |= AV_PKT_FLAG_KEY;
275  }
276 
277  switch (frame_info.slice_type) {
278  case KVZ_SLICE_I:
279  pict_type = AV_PICTURE_TYPE_I;
280  break;
281  case KVZ_SLICE_P:
282  pict_type = AV_PICTURE_TYPE_P;
283  break;
284  case KVZ_SLICE_B:
285  pict_type = AV_PICTURE_TYPE_B;
286  break;
287  default:
288  av_log(avctx, AV_LOG_ERROR, "Unknown picture type encountered.\n");
289  return AVERROR_EXTERNAL;
290  }
291 
292  ff_side_data_set_encoder_stats(avpkt, frame_info.qp * FF_QP2LAMBDA, NULL, 0, pict_type);
293 
294  *got_packet_ptr = 1;
295  }
296 
297 done:
298  ctx->api->picture_free(input_pic);
299  ctx->api->picture_free(recon_pic);
300  ctx->api->chunk_free(data_out);
301  return retval;
302 }
303 
304 static const enum AVPixelFormat pix_fmts[] = {
307 };
308 
309 #define OFFSET(x) offsetof(LibkvazaarContext, x)
310 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
311 static const AVOption options[] = {
312  { "kvazaar-params", "Set kvazaar parameters as a comma-separated list of key=value pairs.",
313  OFFSET(kvz_params), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VE },
314  { NULL },
315 };
316 
317 static const AVClass class = {
318  .class_name = "libkvazaar",
319  .item_name = av_default_item_name,
320  .option = options,
322 };
323 
324 static const FFCodecDefault defaults[] = {
325  { "b", "0" },
326  { NULL },
327 };
328 
330  .p.name = "libkvazaar",
331  CODEC_LONG_NAME("libkvazaar H.265 / HEVC"),
332  .p.type = AVMEDIA_TYPE_VIDEO,
333  .p.id = AV_CODEC_ID_HEVC,
334  .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
336  .p.pix_fmts = pix_fmts,
337  .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG,
338 
339  .p.priv_class = &class,
340  .priv_data_size = sizeof(LibkvazaarContext),
341  .defaults = defaults,
342 
345  .close = libkvazaar_close,
346 
347  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP |
349 
350  .p.wrapper_name = "libkvazaar",
351 };
FF_ENABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:73
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:215
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
entry
#define entry
Definition: aom_film_grain_template.c:66
LibkvazaarContext
Definition: libkvazaar.c:43
OFFSET
#define OFFSET(x)
Definition: libkvazaar.c:309
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
AVCodecContext::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:699
options
static const AVOption options[]
Definition: libkvazaar.c:311
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:403
pixdesc.h
AVCodecContext::color_trc
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition: avcodec.h:692
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:717
AVPacket::data
uint8_t * data
Definition: packet.h:539
AVOption
AVOption.
Definition: opt.h:429
encode.h
LibkvazaarContext::kvz_params
char * kvz_params
Definition: libkvazaar.c:50
FFCodec
Definition: codec_internal.h:127
AVDictionary
Definition: dict.c:34
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:594
defaults
static const FFCodecDefault defaults[]
Definition: libkvazaar.c:324
AV_CODEC_FLAG_GLOBAL_HEADER
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
Definition: avcodec.h:338
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:574
FFCodecDefault
Definition: codec_internal.h:97
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
libkvazaar_init
static av_cold int libkvazaar_init(AVCodecContext *avctx)
Definition: libkvazaar.c:53
AVCodecContext::flags
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:508
ff_libkvazaar_encoder
const FFCodec ff_libkvazaar_encoder
Definition: libkvazaar.c:329
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:320
AVRational::num
int num
Numerator.
Definition: rational.h:59
avassert.h
AVCodecContext::color_primaries
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition: avcodec.h:685
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
av_cold
#define av_cold
Definition: attributes.h:90
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:538
LibkvazaarContext::encoder
kvz_encoder * encoder
Definition: libkvazaar.c:47
AV_CODEC_CAP_OTHER_THREADS
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
Definition: codec.h:124
LibkvazaarContext::api
const kvz_api * api
Definition: libkvazaar.c:46
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:304
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
NULL
#define NULL
Definition: coverity.c:32
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:709
AVCodecContext::bit_rate
int64_t bit_rate
the average bitrate
Definition: avcodec.h:501
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:279
options
Definition: swscale.c:42
error.h
AVCodecContext::time_base
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition: avcodec.h:558
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
codec_internal.h
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
AVCHROMA_LOC_UNSPECIFIED
@ AVCHROMA_LOC_UNSPECIFIED
Definition: pixfmt.h:737
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:538
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
attributes.h
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:545
av_dict_free
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
Definition: dict.c:223
LibkvazaarContext::config
kvz_config * config
Definition: libkvazaar.c:48
VE
#define VE
Definition: libkvazaar.c:310
log.h
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:532
AVCodecContext::extradata
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
Definition: avcodec.h:537
internal.h
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:228
libkvazaar_close
static av_cold int libkvazaar_close(AVCodecContext *avctx)
Definition: libkvazaar.c:159
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:256
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
AVCodecContext::chroma_sample_location
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
Definition: avcodec.h:716
AVCodecContext::height
int height
Definition: avcodec.h:632
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:671
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:700
avcodec.h
AVClass::class_name
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:80
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
dict.h
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
AVCodecContext
main external API structure.
Definition: avcodec.h:451
AV_PICTURE_TYPE_B
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
Definition: avutil.h:281
ff_get_encode_buffer
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
Definition: encode.c:106
av_image_copy2
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
Definition: imgutils.h:184
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
av_dict_parse_string
int av_dict_parse_string(AVDictionary **pm, const char *str, const char *key_val_sep, const char *pairs_sep, int flags)
Parse the key/value pairs list and add the parsed entries to a dictionary.
Definition: dict.c:200
AVCodecContext::ticks_per_frame
attribute_deprecated int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
Definition: avcodec.h:590
AV_CODEC_CAP_DELAY
#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: codec.h:76
FF_DISABLE_DEPRECATION_WARNINGS
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:72
AV_PICTURE_TYPE_P
@ AV_PICTURE_TYPE_P
Predicted.
Definition: avutil.h:280
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
mem.h
packet_internal.h
FF_CODEC_CAP_AUTO_THREADS
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
Definition: codec_internal.h:73
AVDictionaryEntry
Definition: dict.h:89
AVPacket
This structure stores compressed data.
Definition: packet.h:516
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:478
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:632
imgutils.h
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:52
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
ff_side_data_set_encoder_stats
int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
Definition: packet.c:610
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
FF_QP2LAMBDA
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
Definition: avutil.h:227
AVCodecContext::sample_aspect_ratio
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
Definition: avcodec.h:656
av_dict_iterate
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
Definition: dict.c:44
libkvazaar_encode
static int libkvazaar_encode(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: libkvazaar.c:171
av_get_pix_fmt_name
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Definition: pixdesc.c:3090