1 /*
2 * JPEG 2000 encoding support via OpenJPEG
3 * Copyright (c) 2011 Michael Bradshaw <mjbshaw gmail 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 * JPEG 2000 encoder using libopenjpeg
25 */
26
28
36
37 #if HAVE_OPENJPEG_2_1_OPENJPEG_H
38 # include <openjpeg-2.1/openjpeg.h>
39 #elif HAVE_OPENJPEG_2_0_OPENJPEG_H
40 # include <openjpeg-2.0/openjpeg.h>
41 #elif HAVE_OPENJPEG_1_5_OPENJPEG_H
42 # include <openjpeg-1.5/openjpeg.h>
43 #else
44 # include <openjpeg.h>
45 #endif
46
47 #if HAVE_OPENJPEG_2_1_OPENJPEG_H || HAVE_OPENJPEG_2_0_OPENJPEG_H
48 # define OPENJPEG_MAJOR_VERSION 2
49 # define OPJ(x) OPJ_##x
50 #else
51 # define OPENJPEG_MAJOR_VERSION 1
53 #endif
54
59 #if OPENJPEG_MAJOR_VERSION == 1
61 #endif // OPENJPEG_MAJOR_VERSION == 1
72
74 {
76 }
77
79 {
81 }
82
84 {
86 }
87
88 #if OPENJPEG_MAJOR_VERSION == 2
89 typedef struct PacketWriter {
90 int pos;
92 } PacketWriter;
93
94 static OPJ_SIZE_T stream_write(
void *out_buffer, OPJ_SIZE_T nb_bytes,
void *
user_data)
95 {
98 int remaining = packet->
size - writer->pos;
99 if (nb_bytes > remaining) {
100 OPJ_SIZE_T needed = nb_bytes - remaining;
102 if (needed > max_growth) {
103 return (OPJ_SIZE_T)-1;
104 }
106 return (OPJ_SIZE_T)-1;
107 }
108 }
109 memcpy(packet->
data + writer->pos, out_buffer, nb_bytes);
110 writer->pos += (int)nb_bytes;
111 return nb_bytes;
112 }
113
114 static OPJ_OFF_T stream_skip(OPJ_OFF_T nb_bytes, void *user_data)
115 {
118 if (nb_bytes < 0) {
119 if (writer->pos == 0) {
120 return (OPJ_SIZE_T)-1;
121 }
122 if (nb_bytes + writer->pos < 0) {
123 nb_bytes = -writer->pos;
124 }
125 } else {
126 int remaining = packet->
size - writer->pos;
127 if (nb_bytes > remaining) {
128 OPJ_SIZE_T needed = nb_bytes - remaining;
130 if (needed > max_growth) {
131 return (OPJ_SIZE_T)-1;
132 }
134 return (OPJ_SIZE_T)-1;
135 }
136 }
137 }
138 writer->pos += (int)nb_bytes;
139 return nb_bytes;
140 }
141
142 static OPJ_BOOL
stream_seek(OPJ_OFF_T nb_bytes,
void *user_data)
143 {
146 if (nb_bytes < 0) {
147 return OPJ_FALSE;
148 }
149 if (nb_bytes > packet->
size) {
152 return OPJ_FALSE;
153 }
154 }
155 writer->pos = (int)nb_bytes;
156 return OPJ_TRUE;
157 }
158 #endif // OPENJPEG_MAJOR_VERSION == 2
159
161 {
162 p->tile_size_on = 0;
163 p->cp_tdx = 1;
164 p->cp_tdy = 1;
165
166 /* Tile part */
167 p->tp_flag = 'C';
168 p->tp_on = 1;
169
170 /* Tile and Image shall be at (0, 0) */
171 p->cp_tx0 = 0;
172 p->cp_ty0 = 0;
173 p->image_offset_x0 = 0;
174 p->image_offset_y0 = 0;
175
176 /* Codeblock size= 32 * 32 */
177 p->cblockw_init = 32;
178 p->cblockh_init = 32;
179 p->csty |= 0x01;
180
181 /* The progression order shall be CPRL */
182 p->prog_order =
OPJ(CPRL);
183
184 /* No ROI */
185 p->roi_compno = -1;
186
187 /* No subsampling */
188 p->subsampling_dx = 1;
189 p->subsampling_dy = 1;
190
191 /* 9-7 transform */
192 p->irreversible = 1;
193
194 p->tcp_mct = 1;
195 }
196
198 {
200 opj_image_cmptparm_t cmptparm[4] = {{0}};
202 int i;
203 int sub_dx[4];
204 int sub_dy[4];
205 int numcomps;
206 OPJ_COLOR_SPACE color_space =
OPJ(CLRSPC_UNKNOWN);
207
208 sub_dx[0] = sub_dx[3] = 1;
209 sub_dy[0] = sub_dy[3] = 1;
212
214
220 color_space =
OPJ(CLRSPC_GRAY);
221 break;
233 color_space =
OPJ(CLRSPC_SRGB);
234 break;
268 color_space =
OPJ(CLRSPC_SYCC);
269 break;
270 default:
272 "The requested pixel format '%s' is not supported\n",
275 }
276
277 for (i = 0; i < numcomps; i++) {
280 cmptparm[i].sgnd = 0;
281 cmptparm[i].dx = sub_dx[i];
282 cmptparm[i].dy = sub_dy[i];
283 cmptparm[i].w = (avctx->
width + sub_dx[i] - 1) / sub_dx[i];
284 cmptparm[i].h = (avctx->
height + sub_dy[i] - 1) / sub_dy[i];
285 }
286
287 img = opj_image_create(numcomps, cmptparm, color_space);
288
289 if (!img)
291
292 // x0, y0 is the top left corner of the image
293 // x1, y1 is the width, height of the reference grid
294 img->x0 = 0;
295 img->y0 = 0;
296 img->x1 = (avctx->
width - 1) * parameters->subsampling_dx + 1;
297 img->y1 = (avctx->
height - 1) * parameters->subsampling_dy + 1;
298
300 }
301
303 {
305 int err = 0;
306
307 opj_set_default_encoder_parameters(&ctx->
enc_params);
308
309 #if HAVE_OPENJPEG_2_1_OPENJPEG_H
311 case OPJ_CINEMA2K_24:
313 ctx->
enc_params.max_cs_size = OPJ_CINEMA_24_CS;
314 ctx->
enc_params.max_comp_size = OPJ_CINEMA_24_COMP;
315 break;
316 case OPJ_CINEMA2K_48:
318 ctx->
enc_params.max_cs_size = OPJ_CINEMA_48_CS;
319 ctx->
enc_params.max_comp_size = OPJ_CINEMA_48_COMP;
320 break;
321 case OPJ_CINEMA4K_24:
323 ctx->
enc_params.max_cs_size = OPJ_CINEMA_24_CS;
324 ctx->
enc_params.max_comp_size = OPJ_CINEMA_24_COMP;
325 break;
326 }
327
329 case OPJ_CINEMA2K:
330 if (ctx->
enc_params.rsiz == OPJ_PROFILE_CINEMA_4K) {
332 break;
333 }
335 break;
336 case OPJ_CINEMA4K:
337 if (ctx->
enc_params.rsiz == OPJ_PROFILE_CINEMA_2K) {
339 break;
340 }
342 break;
343 }
344
345 if (err) {
347 "Invalid parameter pairing: cinema_mode and profile conflict.\n");
349 }
350 #else
353 #endif
354
363
366 }
367
373 }
374
375 return 0;
376
378 opj_image_destroy(ctx->
image);
380 return err;
381 }
382
384 {
385 int compno;
386 int x;
387 int y;
388 int *image_line;
389 int frame_index;
390 const int numcomps = image->numcomps;
391
392 for (compno = 0; compno < numcomps; ++compno) {
393 if (image->comps[compno].w > frame->
linesize[0] / numcomps) {
395 return 0;
396 }
397 }
398
399 for (compno = 0; compno < numcomps; ++compno) {
400 for (y = 0; y < avctx->
height; ++y) {
401 image_line = image->comps[compno].data + y * image->comps[compno].w;
402 frame_index = y * frame->
linesize[0] + compno;
403 for (x = 0; x < avctx->
width; ++x) {
404 image_line[x] = frame->
data[0][frame_index];
405 frame_index += numcomps;
406 }
407 for (; x < image->comps[compno].w; ++x) {
408 image_line[x] = image_line[x - 1];
409 }
410 }
411 for (; y < image->comps[compno].h; ++y) {
412 image_line = image->comps[compno].data + y * image->comps[compno].w;
413 for (x = 0; x < image->comps[compno].w; ++x) {
414 image_line[x] = image_line[x - image->comps[compno].w];
415 }
416 }
417 }
418
419 return 1;
420 }
421
422 // for XYZ 12 bit
424 {
425 int compno;
426 int x, y;
427 int *image_line;
428 int frame_index;
429 const int numcomps = image->numcomps;
430 uint16_t *frame_ptr = (uint16_t *)frame->
data[0];
431
432 for (compno = 0; compno < numcomps; ++compno) {
433 if (image->comps[compno].w > frame->
linesize[0] / numcomps) {
435 return 0;
436 }
437 }
438
439 for (compno = 0; compno < numcomps; ++compno) {
440 for (y = 0; y < avctx->
height; ++y) {
441 image_line = image->comps[compno].data + y * image->comps[compno].w;
442 frame_index = y * (frame->
linesize[0] / 2) + compno;
443 for (x = 0; x < avctx->
width; ++x) {
444 image_line[x] = frame_ptr[frame_index] >> 4;
445 frame_index += numcomps;
446 }
447 for (; x < image->comps[compno].w; ++x) {
448 image_line[x] = image_line[x - 1];
449 }
450 }
451 for (; y < image->comps[compno].h; ++y) {
452 image_line = image->comps[compno].data + y * image->comps[compno].w;
453 for (x = 0; x < image->comps[compno].w; ++x) {
454 image_line[x] = image_line[x - image->comps[compno].w];
455 }
456 }
457 }
458
459 return 1;
460 }
461
463 {
464 int compno;
465 int x;
466 int y;
467 int *image_line;
468 int frame_index;
469 const int numcomps = image->numcomps;
470 uint16_t *frame_ptr = (uint16_t*)frame->
data[0];
471
472 for (compno = 0; compno < numcomps; ++compno) {
473 if (image->comps[compno].w > frame->
linesize[0] / numcomps) {
475 return 0;
476 }
477 }
478
479 for (compno = 0; compno < numcomps; ++compno) {
480 for (y = 0; y < avctx->
height; ++y) {
481 image_line = image->comps[compno].data + y * image->comps[compno].w;
482 frame_index = y * (frame->
linesize[0] / 2) + compno;
483 for (x = 0; x < avctx->
width; ++x) {
484 image_line[x] = frame_ptr[frame_index];
485 frame_index += numcomps;
486 }
487 for (; x < image->comps[compno].w; ++x) {
488 image_line[x] = image_line[x - 1];
489 }
490 }
491 for (; y < image->comps[compno].h; ++y) {
492 image_line = image->comps[compno].data + y * image->comps[compno].w;
493 for (x = 0; x < image->comps[compno].w; ++x) {
494 image_line[x] = image_line[x - image->comps[compno].w];
495 }
496 }
497 }
498
499 return 1;
500 }
501
503 {
504 int compno;
505 int x;
506 int y;
509 int *image_line;
510 int frame_index;
511 const int numcomps = image->numcomps;
512
513 for (compno = 0; compno < numcomps; ++compno) {
514 if (image->comps[compno].w > frame->
linesize[compno]) {
516 return 0;
517 }
518 }
519
520 for (compno = 0; compno < numcomps; ++compno) {
521 width = avctx->
width / image->comps[compno].dx;
522 height = avctx->
height / image->comps[compno].dy;
523 for (y = 0; y <
height; ++y) {
524 image_line = image->comps[compno].data + y * image->comps[compno].w;
525 frame_index = y * frame->
linesize[compno];
526 for (x = 0; x <
width; ++x)
527 image_line[x] = frame->
data[compno][frame_index++];
528 for (; x < image->comps[compno].w; ++x) {
529 image_line[x] = image_line[x - 1];
530 }
531 }
532 for (; y < image->comps[compno].h; ++y) {
533 image_line = image->comps[compno].data + y * image->comps[compno].w;
534 for (x = 0; x < image->comps[compno].w; ++x) {
535 image_line[x] = image_line[x - image->comps[compno].w];
536 }
537 }
538 }
539
540 return 1;
541 }
542
544 {
545 int compno;
546 int x;
547 int y;
550 int *image_line;
551 int frame_index;
552 const int numcomps = image->numcomps;
553 uint16_t *frame_ptr;
554
555 for (compno = 0; compno < numcomps; ++compno) {
556 if (image->comps[compno].w > frame->
linesize[compno]) {
558 return 0;
559 }
560 }
561
562 for (compno = 0; compno < numcomps; ++compno) {
563 width = avctx->
width / image->comps[compno].dx;
564 height = avctx->
height / image->comps[compno].dy;
565 frame_ptr = (uint16_t *)frame->
data[compno];
567 image_line = image->comps[compno].data + y * image->comps[compno].w;
568 frame_index = y * (frame->
linesize[compno] / 2);
569 for (x = 0; x <
width; ++x)
570 image_line[x] = frame_ptr[frame_index++];
571 for (; x < image->comps[compno].w; ++x) {
572 image_line[x] = image_line[x - 1];
573 }
574 }
575 for (; y < image->comps[compno].h; ++y) {
576 image_line = image->comps[compno].data + y * image->comps[compno].w;
577 for (x = 0; x < image->comps[compno].w; ++x) {
578 image_line[x] = image_line[x - image->comps[compno].w];
579 }
580 }
581 }
582
583 return 1;
584 }
585
588 {
590 opj_image_t *image = ctx->
image;
591 #if OPENJPEG_MAJOR_VERSION == 1
592 opj_cinfo_t *compress =
NULL;
593 opj_cio_t *stream =
NULL;
595 #else // OPENJPEG_MAJOR_VERSION == 2
596 opj_codec_t *compress =
NULL;
597 opj_stream_t *stream =
NULL;
598 #endif // OPENJPEG_MAJOR_VERSION == 1
599 int cpyresult = 0;
600 int ret;
602
608 break;
611 break;
616 break;
624 if (!gbrframe)
626 gbrframe->
data[0] = frame->
data[2];
// swap to be rgb
634 } else {
636 }
638 break;
650 break;
677 break;
678 default:
680 "The frame's pixel format '%s' is not supported\n",
683 break;
684 }
685
686 if (!cpyresult) {
688 "Could not copy the frame data to the internal image buffer\n");
689 return -1;
690 }
691
692 #if OPENJPEG_MAJOR_VERSION == 2
694 return ret;
695 }
696 #endif // OPENJPEG_MAJOR_VERSION == 2
697
698 compress = opj_create_compress(ctx->
format);
699 if (!compress) {
702 goto done;
703 }
704
705 #if OPENJPEG_MAJOR_VERSION == 1
706 opj_setup_encoder(compress, &ctx->
enc_params, image);
707 stream = opj_cio_open((opj_common_ptr) compress,
NULL, 0);
708 #else // OPENJPEG_MAJOR_VERSION == 2
714 goto done;
715 }
716
717 if (!opj_setup_encoder(compress, &ctx->
enc_params, image)) {
720 goto done;
721 }
722 stream = opj_stream_default_create(OPJ_STREAM_WRITE);
723 #endif // OPENJPEG_MAJOR_VERSION == 1
724
725 if (!stream) {
728 goto done;
729 }
730 #if OPENJPEG_MAJOR_VERSION == 1
735 opj_set_event_mgr((opj_common_ptr) compress, &ctx->
event_mgr, avctx);
736 if (!opj_encode(compress, stream, image,
NULL)) {
739 goto done;
740 }
741
742 len = cio_tell(stream);
744 goto done;
745 }
746
747 memcpy(pkt->
data, stream->buffer, len);
748 #else // OPENJPEG_MAJOR_VERSION == 2
749 PacketWriter writer = {0, pkt};
750 opj_stream_set_write_function(stream, stream_write);
751 opj_stream_set_skip_function(stream, stream_skip);
753 #if HAVE_OPENJPEG_2_1_OPENJPEG_H
754 opj_stream_set_user_data(stream, &writer,
NULL);
755 #elif HAVE_OPENJPEG_2_0_OPENJPEG_H
756 opj_stream_set_user_data(stream, &writer);
757 #else
758 #error Missing call to opj_stream_set_user_data
759 #endif
760
761 if (!opj_start_compress(compress, ctx->
image, stream) ||
762 !opj_encode(compress, stream) ||
763 !opj_end_compress(compress, stream)) {
766 goto done;
767 }
768
770 #endif // OPENJPEG_MAJOR_VERSION == 1
771
773 *got_packet = 1;
774 ret = 0;
775
776 done:
777 #if OPENJPEG_MAJOR_VERSION == 2
778 opj_stream_destroy(stream);
779 opj_destroy_codec(compress);
780 #else
781 opj_cio_close(stream);
782 opj_destroy_compress(compress);
783 #endif
784 return ret;
785 }
786
788 {
790
791 opj_image_destroy(ctx->
image);
793 return 0;
794 }
795
796 #define OFFSET(x) offsetof(LibOpenJPEGContext, x)
797 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
823 };
824
830 };
831
833 .
name =
"libopenjpeg",
860 },
862 };
#define AV_PIX_FMT_YUVA422P16
static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
#define AV_PIX_FMT_YUVA422P9
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUVA422P10
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
packed RGB 8:8:8, 24bpp, RGBRGB...
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
static av_cold int init(AVCodecContext *avctx)
#define AV_PIX_FMT_RGBA64
AVCodec ff_libopenjpeg_encoder
#define AV_PIX_FMT_GBRP10
static void stream_seek(VideoState *is, int64_t pos, int64_t rel, int seek_by_bytes)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static const AVClass openjpeg_class
#define AV_PIX_FMT_YUV420P12
static int libopenjpeg_copy_packed8(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static av_cold int libopenjpeg_encode_close(AVCodecContext *avctx)
#define AV_CODEC_CAP_INTRA_ONLY
Codec is intra only.
opj_cparameters_t enc_params
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
static void cinema_parameters(opj_cparameters_t *p)
#define AV_PIX_FMT_YUVA420P9
static void warning_callback(const char *msg, void *data)
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUVA420P16
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
static opj_image_t * mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *parameters)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
AVS_Value void * user_data
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_PIX_FMT_YUVA444P16
simple assert() macros that are a bit more flexible than ISO C assert().
static int libopenjpeg_copy_packed16(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
const char * name
Name of the codec implementation.
#define AV_PIX_FMT_YUV444P10
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int flags
A combination of AV_PKT_FLAG values.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
#define AV_PIX_FMT_YUV422P9
uint8_t nb_components
The number of components each pixel has, (1-4)
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GRAY16
int width
picture width / height.
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_GBRP14
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P14
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
main external API structure.
static const char * format
static int libopenjpeg_copy_packed12(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
BYTE int const BYTE int int int height
#define AV_PIX_FMT_YUV420P10
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Describe the class of an AVClass context structure.
opj_event_mgr_t event_mgr
#define AV_PIX_FMT_YUV420P9
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
#define AV_PIX_FMT_GBR24P
static void info_callback(const char *msg, void *data)
static enum AVPixelFormat pix_fmts[]
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GBRP12
int global_quality
Global quality for codecs which cannot change it per frame.
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
common internal and external API header
#define AV_PIX_FMT_YUVA444P9
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
static const AVOption options[]
static void error_callback(const char *msg, void *data)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
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.
int depth
Number of bits in the component.
#define AVERROR_EXTERNAL
Generic error in an external library.
AVPixelFormat
Pixel format.
This structure stores compressed data.
#define AV_PIX_FMT_YUV422P16