*/
/**
-* @file
-* JPEG 2000 encoder using libopenjpeg
-*/
+ * @file
+ * JPEG 2000 encoder using libopenjpeg
+ */
#define OPJ_STATIC
#include <openjpeg.h>
-#include "libavutil/opt.h"
-#include "libavutil/imgutils.h"
#include "libavutil/avassert.h"
-#include "avcodec.h"
+#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/opt.h"
+#include "avcodec.h"
#include "internal.h"
typedef struct {
for (y = 0; y < height; ++y) {
image_index = y * width;
frame_index = y * frame->linesize[compno];
- for (x = 0; x < width; ++x) {
+ for (x = 0; x < width; ++x)
image->comps[compno].data[image_index++] = frame->data[compno][frame_index++];
- }
}
}
for (y = 0; y < height; ++y) {
image_index = y * width;
frame_index = y * (frame->linesize[compno] / 2);
- for (x = 0; x < width; ++x) {
+ for (x = 0; x < width; ++x)
image->comps[compno].data[image_index++] = frame_ptr[frame_index++];
- }
}
}
{
LibOpenJPEGContext *ctx = avctx->priv_data;
opj_cinfo_t *compress = ctx->compress;
- opj_image_t *image = ctx->image;
+ opj_image_t *image = ctx->image;
opj_cio_t *stream;
int cpyresult = 0;
int ret, len;
// x1, y1 is the width, height of the reference grid
image->x0 = 0;
image->y0 = 0;
- image->x1 = (avctx->width - 1) * ctx->enc_params.subsampling_dx + 1;
+ image->x1 = (avctx->width - 1) * ctx->enc_params.subsampling_dx + 1;
image->y1 = (avctx->height - 1) * ctx->enc_params.subsampling_dy + 1;
switch (avctx->pix_fmt) {
opj_destroy_compress(ctx->compress);
opj_image_destroy(ctx->image);
av_freep(&avctx->coded_frame);
- return 0 ;
+ return 0;
}
#define OFFSET(x) offsetof(LibOpenJPEGContext, x)
{ "rpcl", NULL, 0, AV_OPT_TYPE_CONST, { RPCL }, 0, 0, VE, "prog_order" },
{ "pcrl", NULL, 0, AV_OPT_TYPE_CONST, { PCRL }, 0, 0, VE, "prog_order" },
{ "cprl", NULL, 0, AV_OPT_TYPE_CONST, { CPRL }, 0, 0, VE, "prog_order" },
- { "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { 6 }, 1, 10, VE },
+ { "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { 6 }, 1, INT_MAX, VE },
{ "numlayers", NULL, OFFSET(numlayers), AV_OPT_TYPE_INT, { 1 }, 1, 10, VE },
{ "disto_alloc", NULL, OFFSET(disto_alloc), AV_OPT_TYPE_INT, { 1 }, 0, 1, VE },
{ "fixed_alloc", NULL, OFFSET(fixed_alloc), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },
AVCodec ff_libopenjpeg_encoder = {
.name = "libopenjpeg",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_JPEG2000,
+ .id = AV_CODEC_ID_JPEG2000,
.priv_data_size = sizeof(LibOpenJPEGContext),
.init = libopenjpeg_encode_init,
.encode2 = libopenjpeg_encode_frame,
.close = libopenjpeg_encode_close,
.capabilities = 0,
- .pix_fmts = (const enum PixelFormat[]){
+ .pix_fmts = (const enum PixelFormat[]) {
PIX_FMT_RGB24, PIX_FMT_RGBA, PIX_FMT_RGB48, PIX_FMT_RGBA64,
PIX_FMT_GRAY8, PIX_FMT_GRAY8A, PIX_FMT_GRAY16,
PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUVA420P,