Libav
libopenjpegenc.c
Go to the documentation of this file.
1 /*
2  * JPEG 2000 encoding support via OpenJPEG
3  * Copyright (c) 2011 Michael Bradshaw <mbradshaw@sorensonmedia.com>
4  *
5  * This file is part of Libav.
6  *
7  * Libav 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  * Libav 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 Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
27 #define OPJ_STATIC
28 #include <openjpeg.h>
29 
30 #include "libavutil/common.h"
31 #include "libavutil/imgutils.h"
32 #include "libavutil/intreadwrite.h"
33 #include "libavutil/opt.h"
34 #include "avcodec.h"
35 #include "internal.h"
36 
37 typedef struct LibOpenJPEGContext {
39  opj_image_t *image;
40  opj_cparameters_t enc_params;
41  opj_cinfo_t *compress;
42  opj_event_mgr_t event_mgr;
43  int format;
44  int profile;
48  int numlayers;
53 
54 static void error_callback(const char *msg, void *data)
55 {
56  av_log(data, AV_LOG_ERROR, "%s\n", msg);
57 }
58 
59 static void warning_callback(const char *msg, void *data)
60 {
61  av_log(data, AV_LOG_WARNING, "%s\n", msg);
62 }
63 
64 static void info_callback(const char *msg, void *data)
65 {
66  av_log(data, AV_LOG_DEBUG, "%s\n", msg);
67 }
68 
69 static opj_image_t *libopenjpeg_create_image(AVCodecContext *avctx,
70  opj_cparameters_t *parameters)
71 {
73  opj_image_cmptparm_t *cmptparm;
74  OPJ_COLOR_SPACE color_space;
75  opj_image_t *img;
76  int i;
77  int sub_dx[4];
78  int sub_dy[4];
79  int numcomps = desc->nb_components;
80 
81  sub_dx[0] =
82  sub_dx[3] = 1;
83  sub_dy[0] =
84  sub_dy[3] = 1;
85  sub_dx[1] =
86  sub_dx[2] = 1 << desc->log2_chroma_w;
87  sub_dy[1] =
88  sub_dy[2] = 1 << desc->log2_chroma_h;
89 
90  switch (avctx->pix_fmt) {
91  case AV_PIX_FMT_GRAY8:
92  case AV_PIX_FMT_GRAY16:
93  case AV_PIX_FMT_YA8:
94  color_space = CLRSPC_GRAY;
95  break;
96  case AV_PIX_FMT_RGB24:
97  case AV_PIX_FMT_RGBA:
98  case AV_PIX_FMT_RGB48:
99  case AV_PIX_FMT_RGBA64:
100  color_space = CLRSPC_SRGB;
101  break;
102  case AV_PIX_FMT_YUV410P:
103  case AV_PIX_FMT_YUV411P:
104  case AV_PIX_FMT_YUV420P:
105  case AV_PIX_FMT_YUV422P:
106  case AV_PIX_FMT_YUV440P:
107  case AV_PIX_FMT_YUV444P:
108  case AV_PIX_FMT_YUVA420P:
109  case AV_PIX_FMT_YUV420P9:
110  case AV_PIX_FMT_YUV422P9:
111  case AV_PIX_FMT_YUV444P9:
118  color_space = CLRSPC_SYCC;
119  break;
120  default:
121  av_log(avctx, AV_LOG_ERROR,
122  "The requested pixel format '%s' is not supported\n",
123  av_get_pix_fmt_name(avctx->pix_fmt));
124  return NULL;
125  }
126 
127  cmptparm = av_mallocz(numcomps * sizeof(*cmptparm));
128  if (!cmptparm) {
129  av_log(avctx, AV_LOG_ERROR, "Not enough memory");
130  return NULL;
131  }
132 
133  for (i = 0; i < numcomps; i++) {
134  cmptparm[i].prec = desc->comp[i].depth;
135  cmptparm[i].bpp = desc->comp[i].depth;
136  cmptparm[i].sgnd = 0;
137  cmptparm[i].dx = sub_dx[i];
138  cmptparm[i].dy = sub_dy[i];
139  cmptparm[i].w = avctx->width / sub_dx[i];
140  cmptparm[i].h = avctx->height / sub_dy[i];
141  }
142 
143  img = opj_image_create(numcomps, cmptparm, color_space);
144  av_freep(&cmptparm);
145  return img;
146 }
147 
149 {
150  LibOpenJPEGContext *ctx = avctx->priv_data;
151  int err = AVERROR(ENOMEM);
152 
153  opj_set_default_encoder_parameters(&ctx->enc_params);
154 
155  ctx->enc_params.cp_rsiz = ctx->profile;
156  ctx->enc_params.mode = !!avctx->global_quality;
157  ctx->enc_params.cp_cinema = ctx->cinema_mode;
158  ctx->enc_params.prog_order = ctx->prog_order;
159  ctx->enc_params.numresolution = ctx->numresolution;
160  ctx->enc_params.cp_disto_alloc = ctx->disto_alloc;
161  ctx->enc_params.cp_fixed_alloc = ctx->fixed_alloc;
162  ctx->enc_params.cp_fixed_quality = ctx->fixed_quality;
163  ctx->enc_params.tcp_numlayers = ctx->numlayers;
164  ctx->enc_params.tcp_rates[0] = FFMAX(avctx->compression_level, 0) * 2;
165 
166  ctx->compress = opj_create_compress(ctx->format);
167  if (!ctx->compress) {
168  av_log(avctx, AV_LOG_ERROR, "Error creating the compressor\n");
169  return AVERROR(ENOMEM);
170  }
171 
172  ctx->image = libopenjpeg_create_image(avctx, &ctx->enc_params);
173  if (!ctx->image) {
174  av_log(avctx, AV_LOG_ERROR, "Error creating the mj2 image\n");
175  err = AVERROR(EINVAL);
176  goto fail;
177  }
178 
179  ctx->event_mgr.info_handler = info_callback;
180  ctx->event_mgr.error_handler = error_callback;
181  ctx->event_mgr.warning_handler = warning_callback;
182  opj_set_event_mgr((opj_common_ptr) ctx->compress, &ctx->event_mgr, avctx);
183 
184  return 0;
185 
186 fail:
187  av_freep(&ctx->compress);
188  return err;
189 }
190 
192  const AVFrame *frame, opj_image_t *image)
193 {
194  int compno;
195  int x, y;
196  int image_index, frame_index;
197  const int numcomps = image->numcomps;
198 
199  for (compno = 0; compno < numcomps; ++compno)
200  for (y = 0; y < avctx->height; ++y) {
201  image_index = y * avctx->width;
202  frame_index = y * frame->linesize[0] + compno;
203  for (x = 0; x < avctx->width; ++x) {
204  image->comps[compno].data[image_index++] =
205  frame->data[0][frame_index];
206  frame_index += numcomps;
207  }
208  }
209 }
210 
212  const AVFrame *frame, opj_image_t *image)
213 {
214  int compno;
215  int x, y;
216  int image_index, frame_index;
217  const int numcomps = image->numcomps;
218  uint16_t *frame_ptr = (uint16_t *)frame->data[0];
219 
220  for (compno = 0; compno < numcomps; ++compno)
221  for (y = 0; y < avctx->height; ++y) {
222  image_index = y * avctx->width;
223  frame_index = y * (frame->linesize[0] / 2) + compno;
224  for (x = 0; x < avctx->width; ++x) {
225  image->comps[compno].data[image_index++] =
226  frame_ptr[frame_index];
227  frame_index += numcomps;
228  }
229  }
230 }
231 
233  const AVFrame *frame, opj_image_t *image)
234 {
235  int compno;
236  int x, y;
237  int width, height;
238  int image_index, frame_index;
239  const int numcomps = image->numcomps;
240 
241  for (compno = 0; compno < numcomps; ++compno) {
242  width = avctx->width / image->comps[compno].dx;
243  height = avctx->height / image->comps[compno].dy;
244  for (y = 0; y < height; ++y) {
245  image_index = y * width;
246  frame_index = y * frame->linesize[compno];
247  for (x = 0; x < width; ++x)
248  image->comps[compno].data[image_index++] =
249  frame->data[compno][frame_index++];
250  }
251  }
252 }
253 
255  const AVFrame *frame,
256  opj_image_t *image)
257 {
258  int compno;
259  int x, y;
260  int width, height;
261  int image_index, frame_index;
262  const int numcomps = image->numcomps;
263  uint16_t *frame_ptr;
264 
265  for (compno = 0; compno < numcomps; ++compno) {
266  width = avctx->width / image->comps[compno].dx;
267  height = avctx->height / image->comps[compno].dy;
268  frame_ptr = (uint16_t *)frame->data[compno];
269  for (y = 0; y < height; ++y) {
270  image_index = y * width;
271  frame_index = y * (frame->linesize[compno] / 2);
272  for (x = 0; x < width; ++x)
273  image->comps[compno].data[image_index++] =
274  frame_ptr[frame_index++];
275  }
276  }
277 }
278 
280  const AVFrame *frame, int *got_packet)
281 {
282  LibOpenJPEGContext *ctx = avctx->priv_data;
283  opj_cinfo_t *compress = ctx->compress;
284  opj_image_t *image = ctx->image;
285  opj_cio_t *stream;
286  int ret, len;
287 
288  // x0, y0 is the top left corner of the image
289  // x1, y1 is the width, height of the reference grid
290  image->x0 = 0;
291  image->y0 = 0;
292  image->x1 = (avctx->width - 1) * ctx->enc_params.subsampling_dx + 1;
293  image->y1 = (avctx->height - 1) * ctx->enc_params.subsampling_dy + 1;
294 
295  switch (avctx->pix_fmt) {
296  case AV_PIX_FMT_RGB24:
297  case AV_PIX_FMT_RGBA:
298  case AV_PIX_FMT_YA8:
299  libopenjpeg_copy_packed8(avctx, frame, image);
300  break;
301  case AV_PIX_FMT_RGB48:
302  case AV_PIX_FMT_RGBA64:
303  libopenjpeg_copy_packed16(avctx, frame, image);
304  break;
305  case AV_PIX_FMT_GRAY8:
306  case AV_PIX_FMT_YUV410P:
307  case AV_PIX_FMT_YUV411P:
308  case AV_PIX_FMT_YUV420P:
309  case AV_PIX_FMT_YUV422P:
310  case AV_PIX_FMT_YUV440P:
311  case AV_PIX_FMT_YUV444P:
312  case AV_PIX_FMT_YUVA420P:
313  libopenjpeg_copy_unpacked8(avctx, frame, image);
314  break;
315  case AV_PIX_FMT_GRAY16:
316  case AV_PIX_FMT_YUV420P9:
317  case AV_PIX_FMT_YUV422P9:
318  case AV_PIX_FMT_YUV444P9:
325  libopenjpeg_copy_unpacked16(avctx, frame, image);
326  break;
327  default:
328  av_log(avctx, AV_LOG_ERROR,
329  "The frame's pixel format '%s' is not supported\n",
330  av_get_pix_fmt_name(avctx->pix_fmt));
331  return AVERROR(EINVAL);
332  break;
333  }
334 
335  opj_setup_encoder(compress, &ctx->enc_params, image);
336  stream = opj_cio_open((opj_common_ptr) compress, NULL, 0);
337  if (!stream) {
338  av_log(avctx, AV_LOG_ERROR, "Error creating the cio stream\n");
339  return AVERROR(ENOMEM);
340  }
341 
342  if (!opj_encode(compress, stream, image, NULL)) {
343  opj_cio_close(stream);
344  av_log(avctx, AV_LOG_ERROR, "Error during the opj encode\n");
345  return -1;
346  }
347 
348  len = cio_tell(stream);
349  if ((ret = ff_alloc_packet(pkt, len)) < 0) {
350  opj_cio_close(stream);
351  return ret;
352  }
353 
354  memcpy(pkt->data, stream->buffer, len);
355  pkt->flags |= AV_PKT_FLAG_KEY;
356  *got_packet = 1;
357  opj_cio_close(stream);
358  return 0;
359 }
360 
362 {
363  LibOpenJPEGContext *ctx = avctx->priv_data;
364 
365  opj_destroy_compress(ctx->compress);
366  opj_image_destroy(ctx->image);
367  return 0;
368 }
369 
370 #define OFFSET(x) offsetof(LibOpenJPEGContext, x)
371 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
372 static const AVOption options[] = {
373  { "format", "Codec Format", OFFSET(format), AV_OPT_TYPE_INT, { .i64 = CODEC_JP2 }, CODEC_J2K, CODEC_JP2, VE, "format" },
374  { "j2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CODEC_J2K }, 0, 0, VE, "format" },
375  { "jp2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CODEC_JP2 }, 0, 0, VE, "format" },
376  { "profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = STD_RSIZ }, STD_RSIZ, CINEMA4K, VE, "profile" },
377  { "jpeg2000", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = STD_RSIZ }, 0, 0, VE, "profile" },
378  { "cinema2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA2K }, 0, 0, VE, "profile" },
379  { "cinema4k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA4K }, 0, 0, VE, "profile" },
380  { "cinema_mode", "Digital Cinema", OFFSET(cinema_mode), AV_OPT_TYPE_INT, { .i64 = OFF }, OFF, CINEMA4K_24, VE, "cinema_mode" },
381  { "off", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OFF }, 0, 0, VE, "cinema_mode" },
382  { "2k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA2K_24 }, 0, 0, VE, "cinema_mode" },
383  { "2k_48", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA2K_48 }, 0, 0, VE, "cinema_mode" },
384  { "4k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA4K_24 }, 0, 0, VE, "cinema_mode" },
385  { "prog_order", "Progression Order", OFFSET(prog_order), AV_OPT_TYPE_INT, { .i64 = LRCP }, LRCP, CPRL, VE, "prog_order" },
386  { "lrcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LRCP }, 0, 0, VE, "prog_order" },
387  { "rlcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = RLCP }, 0, 0, VE, "prog_order" },
388  { "rpcl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = RPCL }, 0, 0, VE, "prog_order" },
389  { "pcrl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PCRL }, 0, 0, VE, "prog_order" },
390  { "cprl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPRL }, 0, 0, VE, "prog_order" },
391  { "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { .i64 = 6 }, 1, 10, VE },
392  { "numlayers", NULL, OFFSET(numlayers), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 10, VE },
393  { "disto_alloc", NULL, OFFSET(disto_alloc), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
394  { "fixed_alloc", NULL, OFFSET(fixed_alloc), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
395  { "fixed_quality", NULL, OFFSET(fixed_quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
396  { NULL },
397 };
398 
399 static const AVClass class = {
400  .class_name = "libopenjpeg",
401  .item_name = av_default_item_name,
402  .option = options,
404 };
405 
407  .name = "libopenjpeg",
408  .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG JPEG 2000"),
409  .type = AVMEDIA_TYPE_VIDEO,
410  .id = AV_CODEC_ID_JPEG2000,
411  .priv_data_size = sizeof(LibOpenJPEGContext),
413  .encode2 = libopenjpeg_encode_frame,
414  .close = libopenjpeg_encode_close,
415  .capabilities = 0,
416  .pix_fmts = (const enum AVPixelFormat[]) {
427  },
428  .priv_class = &class,
429 };
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:1768
This structure describes decoded (raw) audio or video data.
Definition: frame.h:140
AVOption.
Definition: opt.h:234
8 bits gray, 8 bits alpha
Definition: pixfmt.h:143
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:64
misc image utilities
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:130
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:61
const char * desc
Definition: nvenc.c:101
#define AV_PIX_FMT_RGBA64
Definition: pixfmt.h:253
AVCodec ff_libopenjpeg_encoder
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1621
AVCodec.
Definition: avcodec.h:3120
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:91
static av_cold int libopenjpeg_encode_close(AVCodecContext *avctx)
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Definition: mem.c:202
opj_cparameters_t enc_params
#define OFF(x)
Definition: avplay.c:2916
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:39
opj_cinfo_t * compress
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:98
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:119
static opj_image_t * libopenjpeg_create_image(AVCodecContext *avctx, opj_cparameters_t *parameters)
#define av_cold
Definition: attributes.h:66
static void libopenjpeg_copy_packed16(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
AVOptions.
static void warning_callback(const char *msg, void *data)
const char data[16]
Definition: mxf.c:70
uint8_t * data
Definition: avcodec.h:1346
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:268
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1378
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:124
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:100
#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:148
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:145
#define AV_PIX_FMT_RGB48
Definition: pixfmt.h:249
opj_image_t * image
const char * name
Name of the codec implementation.
Definition: avcodec.h:3127
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:265
#define FFMAX(a, b)
Definition: common.h:64
#define fail()
Definition: checkasm.h:80
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:90
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:1352
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:63
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:261
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:82
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:247
#define VE
int width
picture width / height.
Definition: avcodec.h:1580
AVFormatContext * ctx
Definition: movenc.c:48
int ff_alloc_packet(AVPacket *avpkt, int size)
Check AVPacket size and/or allocate data.
Definition: utils.c:1211
static void libopenjpeg_copy_packed8(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:262
LIBAVUTIL_VERSION_INT
Definition: eval.c:55
static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:266
NULL
Definition: eval.c:55
static int width
Definition: utils.c:156
Libavcodec external API header.
int compression_level
Definition: avcodec.h:1495
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:158
av_default_item_name
Definition: dnxhdenc.c:55
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:80
main external API structure.
Definition: avcodec.h:1409
static void libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:263
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:65
Describe the class of an AVClass context structure.
Definition: log.h:34
opj_event_mgr_t event_mgr
static void libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:260
static void info_callback(const char *msg, void *data)
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:257
int global_quality
Global quality for codecs which cannot change it per frame.
Definition: avcodec.h:1489
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:264
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:146
int height
Definition: gxfenc.c:72
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)
Definition: pixfmt.h:59
Y , 8bpp.
Definition: pixfmt.h:67
common internal api header.
common internal and external API header
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:66
static av_cold int init(AVCodecParserContext *s)
Definition: h264_parser.c:582
void * priv_data
Definition: avcodec.h:1451
int len
static const AVOption options[]
static void error_callback(const char *msg, void *data)
#define OFFSET(x)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:96
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:1704
int depth
Number of bits in the component.
Definition: pixdesc.h:57
AVPixelFormat
Pixel format.
Definition: pixfmt.h:57
This structure stores compressed data.
Definition: avcodec.h:1323
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:211
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:267
for(j=16;j >0;--j)