Lines Matching defs:avctx

171 static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *parameters)
173 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
189 switch (avctx->pix_fmt) {
248 av_log(avctx, AV_LOG_ERROR,
250 av_get_pix_fmt_name(avctx->pix_fmt));
260 cmptparm[i].w = (avctx->width + sub_dx[i] - 1) / sub_dx[i];
261 cmptparm[i].h = (avctx->height + sub_dy[i] - 1) / sub_dy[i];
273 img->x1 = (avctx->width - 1) * parameters->subsampling_dx + 1;
274 img->y1 = (avctx->height - 1) * parameters->subsampling_dy + 1;
279 static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
281 LibOpenJPEGContext *ctx = avctx->priv_data;
322 av_log(avctx, AV_LOG_ERROR,
329 while (FFMIN(avctx->width, avctx->height) >> ctx->numresolution < 1)
339 ctx->enc_params.tcp_rates[0] = FFMAX(avctx->compression_level, 0) * 2;
348 static int libopenjpeg_copy_packed8(AVCodecContext *avctx, const uint8_t *src[4],
360 av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
366 for (y = 0; y < avctx->height; ++y) {
369 for (x = 0; x < avctx->width; ++x) {
389 static int libopenjpeg_copy_packed12(AVCodecContext *avctx, const uint8_t *src[4],
401 av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
407 for (y = 0; y < avctx->height; ++y) {
410 for (x = 0; x < avctx->width; ++x) {
429 static int libopenjpeg_copy_packed16(AVCodecContext *avctx, const uint8_t *src[4],
442 av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
448 for (y = 0; y < avctx->height; ++y) {
451 for (x = 0; x < avctx->width; ++x) {
470 static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const uint8_t *src[4],
484 av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
490 width = (avctx->width + image->comps[compno].dx - 1) / image->comps[compno].dx;
491 height = (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy;
512 static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const uint8_t *src[4],
526 av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
533 width = (avctx->width + image->comps[compno].dx - 1) / image->comps[compno].dx;
534 height = (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy;
555 static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
558 LibOpenJPEGContext *ctx = avctx->priv_data;
564 opj_image_t *image = mj2_create_image(avctx, &ctx->enc_params);
570 av_log(avctx, AV_LOG_ERROR, "Error creating the mj2 image\n");
575 switch (avctx->pix_fmt) {
579 cpyresult = libopenjpeg_copy_packed8(avctx, data, linesize, image);
582 cpyresult = libopenjpeg_copy_packed12(avctx, data, linesize, image);
587 cpyresult = libopenjpeg_copy_packed16(avctx, data, linesize, image);
601 if (avctx->pix_fmt == AV_PIX_FMT_GBR24P) {
602 cpyresult = libopenjpeg_copy_unpacked8(avctx, data, linesize, image);
604 cpyresult = libopenjpeg_copy_unpacked16(avctx, data, linesize, image);
617 cpyresult = libopenjpeg_copy_unpacked8(avctx, data, linesize, image);
647 cpyresult = libopenjpeg_copy_unpacked16(avctx, data, linesize, image);
650 av_log(avctx, AV_LOG_ERROR,
652 av_get_pix_fmt_name(avctx->pix_fmt));
659 av_log(avctx, AV_LOG_ERROR,
665 if ((ret = ff_alloc_packet(avctx, pkt, 1024)) < 0)
670 av_log(avctx, AV_LOG_ERROR, "Error creating the compressor\n");
675 if (!opj_set_error_handler(compress, error_callback, avctx) ||
676 !opj_set_warning_handler(compress, warning_callback, avctx) ||
677 !opj_set_info_handler(compress, info_callback, avctx)) {
678 av_log(avctx, AV_LOG_ERROR, "Error setting the compressor handlers\n");
684 av_log(avctx, AV_LOG_ERROR, "Error setting up the compressor\n");
691 av_log(avctx, AV_LOG_ERROR, "Error creating the cio stream\n");
705 av_log(avctx, AV_LOG_ERROR, "Error during the opj encode\n");