FFmpeg
Loading...
Searching...
No Matches
vaapi_encode_mjpeg.c
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include <va/va.h>
20#include <va/va_enc_jpeg.h>
21
22#include "libavutil/avassert.h"
23#include "libavutil/common.h"
24#include "libavutil/internal.h"
25#include "libavutil/opt.h"
26#include "libavutil/pixdesc.h"
27
28#include "avcodec.h"
29#include "bytestream.h"
30#include "cbs.h"
31#include "cbs_jpeg.h"
32#include "codec_internal.h"
33#include "jpegtables.h"
34#include "mjpeg.h"
35#include "put_bits.h"
36#include "vaapi_encode.h"
37
38
39// Standard JPEG quantisation tables, in zigzag order.
40static const unsigned char vaapi_encode_mjpeg_quant_luminance[64] = {
41 16, 11, 12, 14, 12, 10, 16, 14,
42 13, 14, 18, 17, 16, 19, 24, 40,
43 26, 24, 22, 22, 24, 49, 35, 37,
44 29, 40, 58, 51, 61, 60, 57, 51,
45 56, 55, 64, 72, 92, 78, 64, 68,
46 87, 69, 55, 56, 80, 109, 81, 87,
47 95, 98, 103, 104, 103, 62, 77, 113,
48 121, 112, 100, 120, 92, 101, 103, 99,
49};
50static const unsigned char vaapi_encode_mjpeg_quant_chrominance[64] = {
51 17, 18, 18, 24, 21, 24, 47, 26,
52 26, 47, 99, 66, 56, 66, 99, 99,
53 99, 99, 99, 99, 99, 99, 99, 99,
54 99, 99, 99, 99, 99, 99, 99, 99,
55 99, 99, 99, 99, 99, 99, 99, 99,
56 99, 99, 99, 99, 99, 99, 99, 99,
57 99, 99, 99, 99, 99, 99, 99, 99,
58 99, 99, 99, 99, 99, 99, 99, 99,
59};
60
82
85 VAAPIEncodeSlice *slice,
86 char *data, size_t *data_len)
87{
90 int err;
91
92 if (priv->jfif) {
93 err = ff_cbs_insert_unit_content(frag, -1,
95 &priv->jfif_header, NULL);
96 if (err < 0)
97 goto fail;
98 }
99
100 err = ff_cbs_insert_unit_content(frag, -1,
102 &priv->quant_tables, NULL);
103 if (err < 0)
104 goto fail;
105
106 err = ff_cbs_insert_unit_content(frag, -1,
108 &priv->frame_header, NULL);
109 if (err < 0)
110 goto fail;
111
112 if (priv->huffman) {
113 err = ff_cbs_insert_unit_content(frag, -1,
115 &priv->huffman_tables, NULL);
116 if (err < 0)
117 goto fail;
118 }
119
120 err = ff_cbs_insert_unit_content(frag, -1,
122 &priv->scan, NULL);
123 if (err < 0)
124 goto fail;
125
126 err = ff_cbs_write_fragment_data(priv->cbc, frag);
127 if (err < 0) {
128 av_log(avctx, AV_LOG_ERROR, "Failed to write image header.\n");
129 goto fail;
130 }
131
132 if (*data_len < 8 * frag->data_size) {
133 av_log(avctx, AV_LOG_ERROR, "Image header too large: "
134 "%zu < %zu.\n", *data_len, 8 * frag->data_size);
135 err = AVERROR(ENOSPC);
136 goto fail;
137 }
138
139 // Remove the EOI at the end of the fragment.
140 memcpy(data, frag->data, frag->data_size - 2);
141 *data_len = 8 * (frag->data_size - 2);
142
143 err = 0;
144fail:
145 ff_cbs_fragment_reset(frag);
146 return err;
147}
148
151 int index, int *type,
152 char *data, size_t *data_len)
153{
154 VAAPIEncodeMJPEGContext *priv = avctx->priv_data;
155 int t, i, k;
156
157 if (index == 0) {
158 // Write quantisation tables.
159 JPEGRawFrameHeader *fh = &priv->frame_header;
161 VAQMatrixBufferJPEG *quant;
162
163 if (*data_len < sizeof(*quant))
164 return AVERROR(ENOSPC);
165 *type = VAQMatrixBufferType;
166 *data_len = sizeof(*quant);
167
168 quant = (VAQMatrixBufferJPEG*)data;
169 memset(quant, 0, sizeof(*quant));
170
171 quant->load_lum_quantiser_matrix = 1;
172 for (i = 0; i < 64; i++)
173 quant->lum_quantiser_matrix[i] = dqt->table[fh->Tq[0]].Q[i];
174
175 if (fh->Nf > 1) {
176 quant->load_chroma_quantiser_matrix = 1;
177 for (i = 0; i < 64; i++)
178 quant->chroma_quantiser_matrix[i] =
179 dqt->table[fh->Tq[1]].Q[i];
180 }
181
182 } else if (index == 1) {
183 // Write huffman tables.
184 JPEGRawScanHeader *sh = &priv->scan.header;
186 VAHuffmanTableBufferJPEGBaseline *huff;
187
188 if (*data_len < sizeof(*huff))
189 return AVERROR(ENOSPC);
190 *type = VAHuffmanTableBufferType;
191 *data_len = sizeof(*huff);
192
193 huff = (VAHuffmanTableBufferJPEGBaseline*)data;
194 memset(huff, 0, sizeof(*huff));
195
196 for (t = 0; t < 1 + (sh->Ns > 1); t++) {
197 const JPEGRawHuffmanTable *ht;
198
199 huff->load_huffman_table[t] = 1;
200
201 ht = &dht->table[2 * t];
202 for (i = k = 0; i < 16; i++)
203 k += (huff->huffman_table[t].num_dc_codes[i] = ht->L[i]);
204 av_assert0(k <= sizeof(huff->huffman_table[t].dc_values));
205 for (i = 0; i < k; i++)
206 huff->huffman_table[t].dc_values[i] = ht->V[i];
207
208 ht = &dht->table[2 * t + 1];
209 for (i = k = 0; i < 16; i++)
210 k += (huff->huffman_table[t].num_ac_codes[i] = ht->L[i]);
211 av_assert0(k <= sizeof(huff->huffman_table[t].ac_values));
212 for (i = 0; i < k; i++)
213 huff->huffman_table[t].ac_values[i] = ht->V[i];
214 }
215
216 } else {
217 return AVERROR_EOF;
218 }
219 return 0;
220}
221
224{
225 FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
226 VAAPIEncodeMJPEGContext *priv = avctx->priv_data;
227 VAAPIEncodePicture *vaapi_pic = pic->priv;
228 JPEGRawFrameHeader *fh = &priv->frame_header;
229 JPEGRawScanHeader *sh = &priv->scan.header;
230 VAEncPictureParameterBufferJPEG *vpic = vaapi_pic->codec_picture_params;
232 const uint8_t components_rgb[3] = { 'R', 'G', 'B' };
233 const uint8_t components_yuv[3] = { 1, 2, 3 };
234 const uint8_t *components;
235 int t, i, quant_scale, len;
236
238
241 if (desc->flags & AV_PIX_FMT_FLAG_RGB)
242 components = components_rgb;
243 else
244 components = components_yuv;
245
246 // Frame header.
247
248 fh->P = 8;
249 fh->Y = avctx->height;
250 fh->X = avctx->width;
251 fh->Nf = desc->nb_components;
252
253 for (i = 0; i < fh->Nf; i++) {
254 fh->C[i] = components[i];
255 fh->H[i] = 1 + (i == 0 ? desc->log2_chroma_w : 0);
256 fh->V[i] = 1 + (i == 0 ? desc->log2_chroma_h : 0);
257
258 fh->Tq[i] = !!i;
259 }
260
261 fh->Lf = 8 + 3 * fh->Nf;
262
263 // JFIF header.
264 if (priv->jfif) {
267 int sar_w, sar_h;
268 PutByteContext pbc;
269
271 sizeof(priv->jfif_data));
272
273 bytestream2_put_buffer(&pbc, "JFIF", 5);
274 bytestream2_put_be16(&pbc, 0x0102);
275 bytestream2_put_byte(&pbc, 0);
276
277 av_reduce(&sar_w, &sar_h, sar.num, sar.den, 65535);
278 if (sar_w && sar_h) {
279 bytestream2_put_be16(&pbc, sar_w);
280 bytestream2_put_be16(&pbc, sar_h);
281 } else {
282 bytestream2_put_be16(&pbc, 1);
283 bytestream2_put_be16(&pbc, 1);
284 }
285
286 bytestream2_put_byte(&pbc, 0);
287 bytestream2_put_byte(&pbc, 0);
288
290
291 app->Lp = 2 + sizeof(priv->jfif_data);
292 app->Ap = priv->jfif_data;
293 app->Ap_ref = NULL;
294 }
295
296 // Quantisation tables.
297
298 if (priv->quality < 50)
299 quant_scale = 5000 / priv->quality;
300 else
301 quant_scale = 200 - 2 * priv->quality;
302
303 len = 2;
304
305 for (t = 0; t < 1 + (fh->Nf > 1); t++) {
307 const uint8_t *data = t == 0 ?
310
311 quant->Pq = 0;
312 quant->Tq = t;
313 for (i = 0; i < 64; i++)
314 quant->Q[i] = av_clip(data[i] * quant_scale / 100, 1, 255);
315
316 len += 65;
317 }
318
319 priv->quant_tables.Lq = len;
320
321 // Huffman tables.
322
323 len = 2;
324
325 for (t = 0; t < 2 + 2 * (fh->Nf > 1); t++) {
326 JPEGRawHuffmanTable *huff = &priv->huffman_tables.table[t];
327 const uint8_t *lengths, *values;
328 int k;
329
330 switch (t) {
331 case 0:
332 lengths = ff_mjpeg_bits_dc_luminance + 1;
333 values = ff_mjpeg_val_dc;
334 break;
335 case 1:
336 lengths = ff_mjpeg_bits_ac_luminance + 1;
338 break;
339 case 2:
340 lengths = ff_mjpeg_bits_dc_chrominance + 1;
341 values = ff_mjpeg_val_dc;
342 break;
343 case 3:
344 lengths = ff_mjpeg_bits_ac_chrominance + 1;
346 break;
347 }
348
349 huff->Tc = t % 2;
350 huff->Th = t / 2;
351
352 for (i = k = 0; i < 16; i++)
353 k += (huff->L[i] = lengths[i]);
354
355 for (i = 0; i < k; i++)
356 huff->V[i] = values[i];
357
358 len += 17 + k;
359 }
360
361 priv->huffman_tables.Lh = len;
362
363 // Scan header.
364
365 sh->Ns = fh->Nf;
366
367 for (i = 0; i < fh->Nf; i++) {
368 sh->Cs[i] = fh->C[i];
369 sh->Td[i] = i > 0;
370 sh->Ta[i] = i > 0;
371 }
372
373 sh->Ss = 0;
374 sh->Se = 63;
375 sh->Ah = 0;
376 sh->Al = 0;
377
378 sh->Ls = 6 + 2 * sh->Ns;
379
380
381 *vpic = (VAEncPictureParameterBufferJPEG) {
382 .reconstructed_picture = vaapi_pic->recon_surface,
383 .coded_buf = vaapi_pic->output_buffer,
384
385 .picture_width = fh->X,
386 .picture_height = fh->Y,
387
388 .pic_flags.bits = {
389 .profile = 0,
390 .progressive = 0,
391 .huffman = 1,
392 .interleaved = 0,
393 .differential = 0,
394 },
395
396 .sample_bit_depth = fh->P,
397 .num_scan = 1,
398 .num_components = fh->Nf,
399
400 // The driver modifies the provided quantisation tables according
401 // to this quality value; the middle value of 50 makes that the
402 // identity so that they are used unchanged.
403 .quality = 50,
404 };
405
406 for (i = 0; i < fh->Nf; i++) {
407 vpic->component_id[i] = fh->C[i];
408 vpic->quantiser_table_selector[i] = fh->Tq[i];
409 }
410
411 vaapi_pic->nb_slices = 1;
412
413 return 0;
414}
415
418 VAAPIEncodeSlice *slice)
419{
420 VAAPIEncodeMJPEGContext *priv = avctx->priv_data;
421 JPEGRawScanHeader *sh = &priv->scan.header;
422 VAEncSliceParameterBufferJPEG *vslice = slice->codec_slice_params;
423 int i;
424
425 *vslice = (VAEncSliceParameterBufferJPEG) {
426 .restart_interval = 0,
427 .num_components = sh->Ns,
428 };
429
430 for (i = 0; i < sh->Ns; i++) {
431 vslice->components[i].component_selector = sh->Cs[i];
432 vslice->components[i].dc_table_selector = sh->Td[i];
433 vslice->components[i].ac_table_selector = sh->Ta[i];
434 }
435
436 return 0;
437}
438
440{
441 FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
443
446
447 base_ctx->surface_width = FFALIGN(avctx->width, 8 << desc->log2_chroma_w);
448 base_ctx->surface_height = FFALIGN(avctx->height, 8 << desc->log2_chroma_h);
449
450 return 0;
451}
452
454{
456 VAAPIEncodeMJPEGContext *priv = avctx->priv_data;
457 int err;
458
459 priv->quality = ctx->rc_quality;
460 if (priv->quality < 1 || priv->quality > 100) {
461 av_log(avctx, AV_LOG_ERROR, "Invalid quality value %d "
462 "(must be 1-100).\n", priv->quality);
463 return AVERROR(EINVAL);
464 }
465
466 // Hack: the implementation calls the JPEG image header (which we
467 // will use in the same way as a slice header) generic "raw data".
468 // Therefore, if after the packed header capability check we have
469 // PACKED_HEADER_RAW_DATA available, rewrite it as
470 // PACKED_HEADER_SLICE so that the header-writing code can do the
471 // right thing.
472 if (ctx->va_packed_headers & VA_ENC_PACKED_HEADER_RAW_DATA) {
473 ctx->va_packed_headers &= ~VA_ENC_PACKED_HEADER_RAW_DATA;
474 ctx->va_packed_headers |= VA_ENC_PACKED_HEADER_SLICE;
475 }
476
477 err = ff_cbs_init(&priv->cbc, AV_CODEC_ID_MJPEG, avctx);
478 if (err < 0)
479 return err;
480
481 return 0;
482}
483
486 8, 1, 0, 0, VAProfileJPEGBaseline },
488 8, 3, 1, 1, VAProfileJPEGBaseline },
490 8, 3, 1, 0, VAProfileJPEGBaseline },
492 8, 3, 0, 0, VAProfileJPEGBaseline },
494};
495
497 .profiles = vaapi_encode_mjpeg_profiles,
498
501
502 .get_encoder_caps = &vaapi_encode_mjpeg_get_encoder_caps,
503 .configure = &vaapi_encode_mjpeg_configure,
504
505 .default_quality = 80,
506
507 .picture_params_size = sizeof(VAEncPictureParameterBufferJPEG),
508 .init_picture_params = &vaapi_encode_mjpeg_init_picture_params,
509
510 .slice_params_size = sizeof(VAEncSliceParameterBufferJPEG),
511 .init_slice_params = &vaapi_encode_mjpeg_init_slice_params,
512
513 .slice_header_type = VAEncPackedHeaderRawData,
514 .write_slice_header = &vaapi_encode_mjpeg_write_image_header,
515
516 .write_extra_buffer = &vaapi_encode_mjpeg_write_extra_buffer,
517};
518
520{
522
524
525 // The JPEG image header - see note above.
526 ctx->desired_packed_headers =
527 VA_ENC_PACKED_HEADER_RAW_DATA;
528
529 return ff_vaapi_encode_init(avctx);
530}
531
533{
534 VAAPIEncodeMJPEGContext *priv = avctx->priv_data;
535
536 ff_cbs_fragment_free(&priv->current_fragment);
537 ff_cbs_close(&priv->cbc);
538
539 return ff_vaapi_encode_close(avctx);
540}
541
542#define OFFSET(x) offsetof(VAAPIEncodeMJPEGContext, x)
543#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
547
548 { "jfif", "Include JFIF header",
550 { .i64 = 0 }, 0, 1, FLAGS },
551 { "huffman", "Include huffman tables",
552 OFFSET(huffman), AV_OPT_TYPE_BOOL,
553 { .i64 = 1 }, 0, 1, FLAGS },
554
555 { NULL },
556};
557
559 { "b", "0" },
560 { NULL },
561};
562
564 .class_name = "mjpeg_vaapi",
565 .item_name = av_default_item_name,
567 .version = LIBAVUTIL_VERSION_INT,
568};
569
571 .p.name = "mjpeg_vaapi",
572 CODEC_LONG_NAME("MJPEG (VAAPI)"),
573 .p.type = AVMEDIA_TYPE_VIDEO,
574 .p.id = AV_CODEC_ID_MJPEG,
575 .priv_data_size = sizeof(VAAPIEncodeMJPEGContext),
578 .close = &vaapi_encode_mjpeg_close,
579 .p.priv_class = &vaapi_encode_mjpeg_class,
580 .p.capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DR1 |
582 .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
584 .defaults = vaapi_encode_mjpeg_defaults,
586 .color_ranges = AVCOL_RANGE_MPEG, /* FIXME: implement tagging */
587 .hw_configs = ff_vaapi_encode_hw_configs,
588 .p.wrapper_name = "vaapi",
589};
const FFCodec ff_mjpeg_vaapi_encoder
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
Libavcodec external API header.
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
Definition bytestream.h:147
static av_always_inline int bytestream2_get_bytes_left_p(const PutByteContext *p)
Definition bytestream.h:163
static av_always_inline unsigned int bytestream2_put_buffer(PutByteContext *p, const uint8_t *src, unsigned int size)
Definition bytestream.h:286
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
@ JPEG_MARKER_DHT
Definition cbs_jpeg.h:34
@ JPEG_MARKER_APPN
Definition cbs_jpeg.h:40
@ JPEG_MARKER_DQT
Definition cbs_jpeg.h:38
@ JPEG_MARKER_SOF0
Definition cbs_jpeg.h:29
@ JPEG_MARKER_SOS
Definition cbs_jpeg.h:37
static int FUNC dht(CodedBitstreamContext *ctx, RWContext *rw, JPEGRawHuffmanTableSpecification *current)
static int FUNC dqt(CodedBitstreamContext *ctx, RWContext *rw, JPEGRawQuantisationTableSpecification *current)
#define FLAGS
Definition cmdutils.c:598
#define CODEC_PIXFMTS(...)
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
#define FF_CODEC_RECEIVE_PACKET_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
common internal and external API header
#define av_clip
Definition common.h:100
#define NULL
Definition coverity.c:32
#define AV_PROFILE_UNKNOWN
Definition defs.h:65
#define AV_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT
Definition defs.h:173
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define fail
Definition test.h:479
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition codec.h:147
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition codec.h:133
@ AV_CODEC_ID_MJPEG
Definition codec_id.h:57
#define AVERROR_EOF
End of file.
Definition error.h:57
#define AVERROR(e)
Definition error.h:45
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition rational.c:35
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
int index
Definition gxfenc.c:90
#define HW_BASE_ENCODE_COMMON_OPTIONS
@ FF_HW_FLAG_CONSTANT_QUALITY_ONLY
@ FF_HW_FLAG_INTRA_ONLY
@ FF_HW_PICTURE_TYPE_IDR
cl_device_type type
FF_VISIBILITY_PUSH_HIDDEN const uint8_t ff_mjpeg_bits_dc_luminance[]
Definition jpegtabs.h:32
const uint8_t ff_mjpeg_val_ac_chrominance[]
Definition jpegtabs.h:69
const uint8_t ff_mjpeg_bits_ac_luminance[]
Definition jpegtabs.h:40
const uint8_t ff_mjpeg_bits_dc_chrominance[]
Definition jpegtabs.h:37
const uint8_t ff_mjpeg_bits_ac_chrominance[]
Definition jpegtabs.h:66
const uint8_t ff_mjpeg_val_dc[]
Definition jpegtabs.h:34
const uint8_t ff_mjpeg_val_ac_luminance[]
Definition jpegtabs.h:42
const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
#define av_cold
Definition attributes.h:117
common internal API header
const char * desc
Definition libsvtav1.c:83
#define FFALIGN(x, a)
Definition macros.h:78
MJPEG encoder and decoder.
const char data[16]
Definition mxf.c:149
AVOptions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3460
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition pixdesc.h:136
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition pixfmt.h:766
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
Definition pixfmt.h:126
bitstream writer API
Describe the class of an AVClass context structure.
Definition log.h:76
main external API structure.
Definition avcodec.h:443
int width
picture width / height.
Definition avcodec.h:604
void * priv_data
Definition avcodec.h:470
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
Definition frame.h:569
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition hwcontext.h:213
AVOption.
Definition opt.h:428
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
Rational number (pair of numerator and denominator).
Definition rational.h:58
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
Context structure for coded bitstream operations.
Definition cbs.h:226
Coded bitstream fragment structure, combining one or more units.
Definition cbs.h:129
size_t data_size
The number of bytes in the bitstream.
Definition cbs.h:142
uint8_t * data
Pointer to the bitstream form of this fragment.
Definition cbs.h:135
AVHWFramesContext * input_frames
AVBufferRef * Ap_ref
Definition cbs_jpeg.h:113
uint8_t V[JPEG_MAX_COMPONENTS]
Definition cbs_jpeg.h:62
uint8_t H[JPEG_MAX_COMPONENTS]
Definition cbs_jpeg.h:61
uint8_t C[JPEG_MAX_COMPONENTS]
Definition cbs_jpeg.h:60
uint8_t Tq[JPEG_MAX_COMPONENTS]
Definition cbs_jpeg.h:63
JPEGRawHuffmanTable table[8]
Definition cbs_jpeg.h:107
uint8_t V[256]
Definition cbs_jpeg.h:102
uint8_t L[16]
Definition cbs_jpeg.h:101
JPEGRawQuantisationTable table[4]
Definition cbs_jpeg.h:95
uint8_t Ta[JPEG_MAX_COMPONENTS]
Definition cbs_jpeg.h:72
uint8_t Td[JPEG_MAX_COMPONENTS]
Definition cbs_jpeg.h:71
uint8_t Cs[JPEG_MAX_COMPONENTS]
Definition cbs_jpeg.h:70
JPEGRawScanHeader header
Definition cbs_jpeg.h:81
JPEGRawApplicationData jfif_header
CodedBitstreamFragment current_fragment
CodedBitstreamContext * cbc
JPEGRawFrameHeader frame_header
JPEGRawQuantisationTableSpecification quant_tables
VAAPIEncodeContext common
JPEGRawHuffmanTableSpecification huffman_tables
void * codec_picture_params
VASurfaceID recon_surface
VABufferID output_buffer
void * codec_slice_params
#define av_log(a,...)
static AVFormatContext * ctx
Definition movenc.c:49
#define VAAPI_ENCODE_COMMON_OPTIONS
static const FFCodecDefault vaapi_encode_mjpeg_defaults[]
static av_cold int vaapi_encode_mjpeg_configure(AVCodecContext *avctx)
static int vaapi_encode_mjpeg_init_slice_params(AVCodecContext *avctx, FFHWBaseEncodePicture *base, VAAPIEncodeSlice *slice)
static av_cold int vaapi_encode_mjpeg_get_encoder_caps(AVCodecContext *avctx)
static const AVClass vaapi_encode_mjpeg_class
static const VAAPIEncodeType vaapi_encode_type_mjpeg
static av_cold int vaapi_encode_mjpeg_close(AVCodecContext *avctx)
static const unsigned char vaapi_encode_mjpeg_quant_chrominance[64]
static const VAAPIEncodeProfile vaapi_encode_mjpeg_profiles[]
static const unsigned char vaapi_encode_mjpeg_quant_luminance[64]
static const AVOption vaapi_encode_mjpeg_options[]
static int vaapi_encode_mjpeg_init_picture_params(AVCodecContext *avctx, FFHWBaseEncodePicture *pic)
static av_cold int vaapi_encode_mjpeg_init(AVCodecContext *avctx)
#define OFFSET(x)
static int vaapi_encode_mjpeg_write_image_header(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice, char *data, size_t *data_len)
static int vaapi_encode_mjpeg_write_extra_buffer(AVCodecContext *avctx, FFHWBaseEncodePicture *base, int index, int *type, char *data, size_t *data_len)
static const uint8_t quant[64]
Definition vmixdec.c:71
int len
uint8_t base
Definition vp3data.h:128