#include "avcodec.h"
#include "internal.h"
-typedef struct {
+typedef struct LibOpenJPEGContext {
AVClass *avclass;
opj_image_t *image;
opj_cparameters_t enc_params;
}
for (i = 0; i < numcomps; i++) {
- cmptparm[i].prec = desc->comp[i].depth_minus1 + 1;
- cmptparm[i].bpp = desc->comp[i].depth_minus1 + 1;
+ cmptparm[i].prec = desc->comp[i].depth;
+ cmptparm[i].bpp = desc->comp[i].depth;
cmptparm[i].sgnd = 0;
cmptparm[i].dx = sub_dx[i];
cmptparm[i].dy = sub_dy[i];
return AVERROR(ENOMEM);
}
- avctx->coded_frame = av_frame_alloc();
- if (!avctx->coded_frame) {
- av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n");
- goto fail;
- }
-
ctx->image = libopenjpeg_create_image(avctx, &ctx->enc_params);
if (!ctx->image) {
av_log(avctx, AV_LOG_ERROR, "Error creating the mj2 image\n");
fail:
av_freep(&ctx->compress);
- av_freep(&avctx->coded_frame);
return err;
}
opj_destroy_compress(ctx->compress);
opj_image_destroy(ctx->image);
- av_freep(&avctx->coded_frame);
return 0;
}