You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

520 lines
19KB

  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. * @file
  23. * JPEG 2000 encoder using libopenjpeg
  24. */
  25. #define OPJ_STATIC
  26. #include <openjpeg.h>
  27. #include "libavutil/avassert.h"
  28. #include "libavutil/common.h"
  29. #include "libavutil/imgutils.h"
  30. #include "libavutil/intreadwrite.h"
  31. #include "libavutil/opt.h"
  32. #include "avcodec.h"
  33. #include "internal.h"
  34. typedef struct {
  35. AVClass *avclass;
  36. opj_image_t *image;
  37. opj_cparameters_t enc_params;
  38. opj_cinfo_t *compress;
  39. opj_event_mgr_t event_mgr;
  40. int format;
  41. int profile;
  42. int prog_order;
  43. int cinema_mode;
  44. int numresolution;
  45. int numlayers;
  46. int disto_alloc;
  47. int fixed_alloc;
  48. int fixed_quality;
  49. } LibOpenJPEGContext;
  50. static void error_callback(const char *msg, void *data)
  51. {
  52. av_log(data, AV_LOG_ERROR, "%s\n", msg);
  53. }
  54. static void warning_callback(const char *msg, void *data)
  55. {
  56. av_log(data, AV_LOG_WARNING, "%s\n", msg);
  57. }
  58. static void info_callback(const char *msg, void *data)
  59. {
  60. av_log(data, AV_LOG_DEBUG, "%s\n", msg);
  61. }
  62. static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *parameters)
  63. {
  64. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
  65. opj_image_cmptparm_t *cmptparm;
  66. opj_image_t *img;
  67. int i;
  68. int sub_dx[4];
  69. int sub_dy[4];
  70. int numcomps;
  71. OPJ_COLOR_SPACE color_space = CLRSPC_UNKNOWN;
  72. sub_dx[0] = sub_dx[3] = 1;
  73. sub_dy[0] = sub_dy[3] = 1;
  74. sub_dx[1] = sub_dx[2] = 1 << desc->log2_chroma_w;
  75. sub_dy[1] = sub_dy[2] = 1 << desc->log2_chroma_h;
  76. numcomps = desc->nb_components;
  77. switch (avctx->pix_fmt) {
  78. case AV_PIX_FMT_GRAY8:
  79. case AV_PIX_FMT_GRAY8A:
  80. case AV_PIX_FMT_GRAY16:
  81. color_space = CLRSPC_GRAY;
  82. break;
  83. case AV_PIX_FMT_RGB24:
  84. case AV_PIX_FMT_RGBA:
  85. case AV_PIX_FMT_RGB48:
  86. case AV_PIX_FMT_RGBA64:
  87. color_space = CLRSPC_SRGB;
  88. break;
  89. case AV_PIX_FMT_YUV410P:
  90. case AV_PIX_FMT_YUV411P:
  91. case AV_PIX_FMT_YUV420P:
  92. case AV_PIX_FMT_YUV422P:
  93. case AV_PIX_FMT_YUV440P:
  94. case AV_PIX_FMT_YUV444P:
  95. case AV_PIX_FMT_YUVA420P:
  96. case AV_PIX_FMT_YUVA422P:
  97. case AV_PIX_FMT_YUVA444P:
  98. case AV_PIX_FMT_YUV420P9:
  99. case AV_PIX_FMT_YUV422P9:
  100. case AV_PIX_FMT_YUV444P9:
  101. case AV_PIX_FMT_YUVA420P9:
  102. case AV_PIX_FMT_YUVA422P9:
  103. case AV_PIX_FMT_YUVA444P9:
  104. case AV_PIX_FMT_YUV420P10:
  105. case AV_PIX_FMT_YUV422P10:
  106. case AV_PIX_FMT_YUV444P10:
  107. case AV_PIX_FMT_YUVA420P10:
  108. case AV_PIX_FMT_YUVA422P10:
  109. case AV_PIX_FMT_YUVA444P10:
  110. case AV_PIX_FMT_YUV420P12:
  111. case AV_PIX_FMT_YUV422P12:
  112. case AV_PIX_FMT_YUV444P12:
  113. case AV_PIX_FMT_YUV420P14:
  114. case AV_PIX_FMT_YUV422P14:
  115. case AV_PIX_FMT_YUV444P14:
  116. case AV_PIX_FMT_YUV420P16:
  117. case AV_PIX_FMT_YUV422P16:
  118. case AV_PIX_FMT_YUV444P16:
  119. case AV_PIX_FMT_YUVA420P16:
  120. case AV_PIX_FMT_YUVA422P16:
  121. case AV_PIX_FMT_YUVA444P16:
  122. color_space = CLRSPC_SYCC;
  123. break;
  124. default:
  125. av_log(avctx, AV_LOG_ERROR,
  126. "The requested pixel format '%s' is not supported\n",
  127. av_get_pix_fmt_name(avctx->pix_fmt));
  128. return NULL;
  129. }
  130. cmptparm = av_mallocz(numcomps * sizeof(*cmptparm));
  131. if (!cmptparm) {
  132. av_log(avctx, AV_LOG_ERROR, "Not enough memory\n");
  133. return NULL;
  134. }
  135. for (i = 0; i < numcomps; i++) {
  136. cmptparm[i].prec = desc->comp[i].depth_minus1 + 1;
  137. cmptparm[i].bpp = desc->comp[i].depth_minus1 + 1;
  138. cmptparm[i].sgnd = 0;
  139. cmptparm[i].dx = sub_dx[i];
  140. cmptparm[i].dy = sub_dy[i];
  141. cmptparm[i].w = avctx->width / sub_dx[i];
  142. cmptparm[i].h = avctx->height / sub_dy[i];
  143. }
  144. img = opj_image_create(numcomps, cmptparm, color_space);
  145. av_freep(&cmptparm);
  146. return img;
  147. }
  148. static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
  149. {
  150. LibOpenJPEGContext *ctx = avctx->priv_data;
  151. int err = AVERROR(ENOMEM);
  152. opj_set_default_encoder_parameters(&ctx->enc_params);
  153. ctx->enc_params.cp_rsiz = ctx->profile;
  154. ctx->enc_params.mode = !!avctx->global_quality;
  155. ctx->enc_params.cp_cinema = ctx->cinema_mode;
  156. ctx->enc_params.prog_order = ctx->prog_order;
  157. ctx->enc_params.numresolution = ctx->numresolution;
  158. ctx->enc_params.cp_disto_alloc = ctx->disto_alloc;
  159. ctx->enc_params.cp_fixed_alloc = ctx->fixed_alloc;
  160. ctx->enc_params.cp_fixed_quality = ctx->fixed_quality;
  161. ctx->enc_params.tcp_numlayers = ctx->numlayers;
  162. ctx->enc_params.tcp_rates[0] = FFMAX(avctx->compression_level, 0) * 2;
  163. ctx->compress = opj_create_compress(ctx->format);
  164. if (!ctx->compress) {
  165. av_log(avctx, AV_LOG_ERROR, "Error creating the compressor\n");
  166. return AVERROR(ENOMEM);
  167. }
  168. avctx->coded_frame = avcodec_alloc_frame();
  169. if (!avctx->coded_frame) {
  170. av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n");
  171. goto fail;
  172. }
  173. ctx->image = mj2_create_image(avctx, &ctx->enc_params);
  174. if (!ctx->image) {
  175. av_log(avctx, AV_LOG_ERROR, "Error creating the mj2 image\n");
  176. err = AVERROR(EINVAL);
  177. goto fail;
  178. }
  179. memset(&ctx->event_mgr, 0, sizeof(opj_event_mgr_t));
  180. ctx->event_mgr.info_handler = info_callback;
  181. ctx->event_mgr.error_handler = error_callback;
  182. ctx->event_mgr.warning_handler = warning_callback;
  183. opj_set_event_mgr((opj_common_ptr)ctx->compress, &ctx->event_mgr, avctx);
  184. return 0;
  185. fail:
  186. av_freep(&ctx->compress);
  187. av_freep(&avctx->coded_frame);
  188. return err;
  189. }
  190. static int libopenjpeg_copy_packed8(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
  191. {
  192. int compno;
  193. int x;
  194. int y;
  195. int image_index;
  196. int frame_index;
  197. const int numcomps = image->numcomps;
  198. for (compno = 0; compno < numcomps; ++compno) {
  199. if (image->comps[compno].w > frame->linesize[0] / numcomps) {
  200. av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
  201. return 0;
  202. }
  203. }
  204. for (compno = 0; compno < numcomps; ++compno) {
  205. for (y = 0; y < avctx->height; ++y) {
  206. image_index = y * avctx->width;
  207. frame_index = y * frame->linesize[0] + compno;
  208. for (x = 0; x < avctx->width; ++x) {
  209. image->comps[compno].data[image_index++] = frame->data[0][frame_index];
  210. frame_index += numcomps;
  211. }
  212. }
  213. }
  214. return 1;
  215. }
  216. static int libopenjpeg_copy_packed16(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
  217. {
  218. int compno;
  219. int x;
  220. int y;
  221. int image_index;
  222. int frame_index;
  223. const int numcomps = image->numcomps;
  224. uint16_t *frame_ptr = (uint16_t*)frame->data[0];
  225. for (compno = 0; compno < numcomps; ++compno) {
  226. if (image->comps[compno].w > frame->linesize[0] / numcomps) {
  227. av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
  228. return 0;
  229. }
  230. }
  231. for (compno = 0; compno < numcomps; ++compno) {
  232. for (y = 0; y < avctx->height; ++y) {
  233. image_index = y * avctx->width;
  234. frame_index = y * (frame->linesize[0] / 2) + compno;
  235. for (x = 0; x < avctx->width; ++x) {
  236. image->comps[compno].data[image_index++] = frame_ptr[frame_index];
  237. frame_index += numcomps;
  238. }
  239. }
  240. }
  241. return 1;
  242. }
  243. static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
  244. {
  245. int compno;
  246. int x;
  247. int y;
  248. int width;
  249. int height;
  250. int image_index;
  251. int frame_index;
  252. const int numcomps = image->numcomps;
  253. for (compno = 0; compno < numcomps; ++compno) {
  254. if (image->comps[compno].w > frame->linesize[compno]) {
  255. av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
  256. return 0;
  257. }
  258. }
  259. for (compno = 0; compno < numcomps; ++compno) {
  260. width = avctx->width / image->comps[compno].dx;
  261. height = avctx->height / image->comps[compno].dy;
  262. for (y = 0; y < height; ++y) {
  263. image_index = y * width;
  264. frame_index = y * frame->linesize[compno];
  265. for (x = 0; x < width; ++x)
  266. image->comps[compno].data[image_index++] = frame->data[compno][frame_index++];
  267. }
  268. }
  269. return 1;
  270. }
  271. static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
  272. {
  273. int compno;
  274. int x;
  275. int y;
  276. int width;
  277. int height;
  278. int image_index;
  279. int frame_index;
  280. const int numcomps = image->numcomps;
  281. uint16_t *frame_ptr;
  282. for (compno = 0; compno < numcomps; ++compno) {
  283. if (image->comps[compno].w > frame->linesize[compno]) {
  284. av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
  285. return 0;
  286. }
  287. }
  288. for (compno = 0; compno < numcomps; ++compno) {
  289. width = avctx->width / image->comps[compno].dx;
  290. height = avctx->height / image->comps[compno].dy;
  291. frame_ptr = (uint16_t*)frame->data[compno];
  292. for (y = 0; y < height; ++y) {
  293. image_index = y * width;
  294. frame_index = y * (frame->linesize[compno] / 2);
  295. for (x = 0; x < width; ++x)
  296. image->comps[compno].data[image_index++] = frame_ptr[frame_index++];
  297. }
  298. }
  299. return 1;
  300. }
  301. static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
  302. const AVFrame *frame, int *got_packet)
  303. {
  304. LibOpenJPEGContext *ctx = avctx->priv_data;
  305. opj_cinfo_t *compress = ctx->compress;
  306. opj_image_t *image = ctx->image;
  307. opj_cio_t *stream;
  308. int cpyresult = 0;
  309. int ret, len;
  310. // x0, y0 is the top left corner of the image
  311. // x1, y1 is the width, height of the reference grid
  312. image->x0 = 0;
  313. image->y0 = 0;
  314. image->x1 = (avctx->width - 1) * ctx->enc_params.subsampling_dx + 1;
  315. image->y1 = (avctx->height - 1) * ctx->enc_params.subsampling_dy + 1;
  316. switch (avctx->pix_fmt) {
  317. case AV_PIX_FMT_RGB24:
  318. case AV_PIX_FMT_RGBA:
  319. case AV_PIX_FMT_GRAY8A:
  320. cpyresult = libopenjpeg_copy_packed8(avctx, frame, image);
  321. break;
  322. case AV_PIX_FMT_RGB48:
  323. case AV_PIX_FMT_RGBA64:
  324. cpyresult = libopenjpeg_copy_packed16(avctx, frame, image);
  325. break;
  326. case AV_PIX_FMT_GRAY8:
  327. case AV_PIX_FMT_YUV410P:
  328. case AV_PIX_FMT_YUV411P:
  329. case AV_PIX_FMT_YUV420P:
  330. case AV_PIX_FMT_YUV422P:
  331. case AV_PIX_FMT_YUV440P:
  332. case AV_PIX_FMT_YUV444P:
  333. case AV_PIX_FMT_YUVA420P:
  334. case AV_PIX_FMT_YUVA422P:
  335. case AV_PIX_FMT_YUVA444P:
  336. cpyresult = libopenjpeg_copy_unpacked8(avctx, frame, image);
  337. break;
  338. case AV_PIX_FMT_GRAY16:
  339. case AV_PIX_FMT_YUV420P9:
  340. case AV_PIX_FMT_YUV422P9:
  341. case AV_PIX_FMT_YUV444P9:
  342. case AV_PIX_FMT_YUVA420P9:
  343. case AV_PIX_FMT_YUVA422P9:
  344. case AV_PIX_FMT_YUVA444P9:
  345. case AV_PIX_FMT_YUV444P10:
  346. case AV_PIX_FMT_YUV422P10:
  347. case AV_PIX_FMT_YUV420P10:
  348. case AV_PIX_FMT_YUVA444P10:
  349. case AV_PIX_FMT_YUVA422P10:
  350. case AV_PIX_FMT_YUVA420P10:
  351. case AV_PIX_FMT_YUV420P12:
  352. case AV_PIX_FMT_YUV422P12:
  353. case AV_PIX_FMT_YUV444P12:
  354. case AV_PIX_FMT_YUV420P14:
  355. case AV_PIX_FMT_YUV422P14:
  356. case AV_PIX_FMT_YUV444P14:
  357. case AV_PIX_FMT_YUV444P16:
  358. case AV_PIX_FMT_YUV422P16:
  359. case AV_PIX_FMT_YUV420P16:
  360. case AV_PIX_FMT_YUVA444P16:
  361. case AV_PIX_FMT_YUVA422P16:
  362. case AV_PIX_FMT_YUVA420P16:
  363. cpyresult = libopenjpeg_copy_unpacked16(avctx, frame, image);
  364. break;
  365. default:
  366. av_log(avctx, AV_LOG_ERROR,
  367. "The frame's pixel format '%s' is not supported\n",
  368. av_get_pix_fmt_name(avctx->pix_fmt));
  369. return AVERROR(EINVAL);
  370. break;
  371. }
  372. if (!cpyresult) {
  373. av_log(avctx, AV_LOG_ERROR,
  374. "Could not copy the frame data to the internal image buffer\n");
  375. return -1;
  376. }
  377. opj_setup_encoder(compress, &ctx->enc_params, image);
  378. stream = opj_cio_open((opj_common_ptr)compress, NULL, 0);
  379. if (!stream) {
  380. av_log(avctx, AV_LOG_ERROR, "Error creating the cio stream\n");
  381. return AVERROR(ENOMEM);
  382. }
  383. if (!opj_encode(compress, stream, image, NULL)) {
  384. opj_cio_close(stream);
  385. av_log(avctx, AV_LOG_ERROR, "Error during the opj encode\n");
  386. return -1;
  387. }
  388. len = cio_tell(stream);
  389. if ((ret = ff_alloc_packet2(avctx, pkt, len)) < 0) {
  390. opj_cio_close(stream);
  391. return ret;
  392. }
  393. memcpy(pkt->data, stream->buffer, len);
  394. pkt->flags |= AV_PKT_FLAG_KEY;
  395. *got_packet = 1;
  396. opj_cio_close(stream);
  397. return 0;
  398. }
  399. static av_cold int libopenjpeg_encode_close(AVCodecContext *avctx)
  400. {
  401. LibOpenJPEGContext *ctx = avctx->priv_data;
  402. opj_destroy_compress(ctx->compress);
  403. opj_image_destroy(ctx->image);
  404. av_freep(&avctx->coded_frame);
  405. return 0;
  406. }
  407. #define OFFSET(x) offsetof(LibOpenJPEGContext, x)
  408. #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
  409. static const AVOption options[] = {
  410. { "format", "Codec Format", OFFSET(format), AV_OPT_TYPE_INT, { .i64 = CODEC_JP2 }, CODEC_J2K, CODEC_JP2, VE, "format" },
  411. { "j2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CODEC_J2K }, 0, 0, VE, "format" },
  412. { "jp2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CODEC_JP2 }, 0, 0, VE, "format" },
  413. { "profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = STD_RSIZ }, STD_RSIZ, CINEMA4K, VE, "profile" },
  414. { "jpeg2000", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = STD_RSIZ }, 0, 0, VE, "profile" },
  415. { "cinema2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA2K }, 0, 0, VE, "profile" },
  416. { "cinema4k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA4K }, 0, 0, VE, "profile" },
  417. { "cinema_mode", "Digital Cinema", OFFSET(cinema_mode), AV_OPT_TYPE_INT, { .i64 = OFF }, OFF, CINEMA4K_24, VE, "cinema_mode" },
  418. { "off", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OFF }, 0, 0, VE, "cinema_mode" },
  419. { "2k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA2K_24 }, 0, 0, VE, "cinema_mode" },
  420. { "2k_48", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA2K_48 }, 0, 0, VE, "cinema_mode" },
  421. { "4k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA4K_24 }, 0, 0, VE, "cinema_mode" },
  422. { "prog_order", "Progression Order", OFFSET(prog_order), AV_OPT_TYPE_INT, { .i64 = LRCP }, LRCP, CPRL, VE, "prog_order" },
  423. { "lrcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LRCP }, 0, 0, VE, "prog_order" },
  424. { "rlcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = RLCP }, 0, 0, VE, "prog_order" },
  425. { "rpcl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = RPCL }, 0, 0, VE, "prog_order" },
  426. { "pcrl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PCRL }, 0, 0, VE, "prog_order" },
  427. { "cprl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPRL }, 0, 0, VE, "prog_order" },
  428. { "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { .i64 = 6 }, 1, INT_MAX, VE },
  429. { "numlayers", NULL, OFFSET(numlayers), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 10, VE },
  430. { "disto_alloc", NULL, OFFSET(disto_alloc), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
  431. { "fixed_alloc", NULL, OFFSET(fixed_alloc), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
  432. { "fixed_quality", NULL, OFFSET(fixed_quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
  433. { NULL },
  434. };
  435. static const AVClass class = {
  436. .class_name = "libopenjpeg",
  437. .item_name = av_default_item_name,
  438. .option = options,
  439. .version = LIBAVUTIL_VERSION_INT,
  440. };
  441. AVCodec ff_libopenjpeg_encoder = {
  442. .name = "libopenjpeg",
  443. .type = AVMEDIA_TYPE_VIDEO,
  444. .id = AV_CODEC_ID_JPEG2000,
  445. .priv_data_size = sizeof(LibOpenJPEGContext),
  446. .init = libopenjpeg_encode_init,
  447. .encode2 = libopenjpeg_encode_frame,
  448. .close = libopenjpeg_encode_close,
  449. .capabilities = 0,
  450. .pix_fmts = (const enum AVPixelFormat[]) {
  451. AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB48, AV_PIX_FMT_RGBA64,
  452. AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY8A, AV_PIX_FMT_GRAY16,
  453. AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA420P,
  454. AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA422P,
  455. AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUVA444P,
  456. AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9,
  457. AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA444P9,
  458. AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
  459. AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10,
  460. AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12,
  461. AV_PIX_FMT_YUV420P14, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV444P14,
  462. AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
  463. AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16,
  464. AV_PIX_FMT_NONE
  465. },
  466. .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG JPEG 2000"),
  467. .priv_class = &class,
  468. };