Lines Matching defs:avctx

379 static av_always_inline unsigned encode_slice_data(AVCodecContext *avctx,
385 ProresContext* ctx = avctx->priv_data;
390 if (!(avctx->flags & AV_CODEC_FLAG_GRAY)) {
435 static av_always_inline int encode_alpha_slice_data(AVCodecContext *avctx, int8_t * src_a,
468 av_log(avctx, AV_LOG_ERROR,
539 static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, int mb_x,
544 ProresContext* ctx = avctx->priv_data;
550 int tgt_bits = (mb_count * bitrate_table[avctx->profile]) >> 2;
581 luma_stride, avctx->width, avctx->height,
584 chroma_stride, avctx->width >> ctx->is_422, avctx->height,
587 chroma_stride, avctx->width >> ctx->is_422, avctx->height,
595 slice_size = encode_slice_data(avctx, blocks_y, blocks_u, blocks_v,
610 slice_size = encode_slice_data(avctx, blocks_y, blocks_u, blocks_v,
615 if (slice_size > high_bytes && *qp < qp_end_table[avctx->profile]) {
618 slice_size = encode_slice_data(avctx, blocks_y, blocks_u, blocks_v,
622 } while (slice_size > high_bytes && *qp < qp_end_table[avctx->profile]);
624 > qp_start_table[avctx->profile]) {
627 slice_size = encode_slice_data(avctx, blocks_y, blocks_u, blocks_v,
631 } while (slice_size < low_bytes && *qp > qp_start_table[avctx->profile]);
644 alpha_stride, avctx->width, avctx->height,
646 ret = encode_alpha_slice_data(avctx, ctx->fill_a, mb_count,
657 static int prores_encode_picture(AVCodecContext *avctx, const AVFrame *pic,
660 ProresContext *ctx = avctx->priv_data;
661 int mb_width = (avctx->width + 15) >> 4;
669 mb_height = (avctx->height + 15) >> 4;
673 picture_height = (avctx->height + 1) / 2;
675 picture_height = avctx->height / 2;
686 qp = qp_start_table[avctx->profile];
697 unsafe_bot = (avctx->height & 0xf) && (mb_y == unsafe_mb_height_limit - 1);
698 unsafe_right = (avctx->width & 0xf) && (mb_x + slice_mb_count == mb_width);
700 sl_size = encode_slice(avctx, pic, mb_x, mb_y, slice_mb_count,
721 static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
724 ProresContext *ctx = avctx->priv_data;
729 int frame_size = FFALIGN(avctx->width, 16) * FFALIGN(avctx->height, 16)*16 + 500 + AV_INPUT_BUFFER_MIN_SIZE; //FIXME choose tighter limit
732 if ((ret = ff_alloc_packet(avctx, pkt, frame_size + AV_INPUT_BUFFER_MIN_SIZE)) < 0)
744 bytestream_put_be16(&buf, avctx->width);
745 bytestream_put_be16(&buf, avctx->height);
747 if (avctx->profile >= FF_PROFILE_PRORES_4444) /* 4444 or 4444 Xq */
751 av_log(avctx, AV_LOG_DEBUG, "use interlaced encoding, top field first\n");
755 av_log(avctx, AV_LOG_DEBUG, "use interlaced encoding, bottom field first\n");
759 av_log(avctx, AV_LOG_DEBUG, "use progressive encoding\n");
764 *buf++ = ff_int_from_list_or_default(avctx, "frame color primaries", pict->color_primaries, valid_primaries, 0);
765 *buf++ = ff_int_from_list_or_default(avctx, "frame color trc", pict->color_trc, valid_trc, 0);
766 *buf++ = ff_int_from_list_or_default(avctx, "frame colorspace", pict->colorspace, valid_colorspace, 0);
767 if (avctx->profile >= FF_PROFILE_PRORES_4444) {
768 if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10) {
779 bytestream_put_buffer(&buf, QMAT_LUMA[avctx->profile], 64);
780 bytestream_put_buffer(&buf, QMAT_CHROMA[avctx->profile], 64);
782 pic_size = prores_encode_picture(avctx, pict, buf,
790 pic_size = prores_encode_picture(avctx, pict, pkt->data + compress_frame_size,
812 static av_cold int prores_encode_init(AVCodecContext *avctx)
815 ProresContext* ctx = avctx->priv_data;
817 avctx->bits_per_raw_sample = 10;
819 ctx->is_interlaced = !!(avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT);
826 if (avctx->width & 0x1) {
827 av_log(avctx, AV_LOG_ERROR,
832 if (avctx->width > 65534 || avctx->height > 65535) {
833 av_log(avctx, AV_LOG_ERROR,
839 av_log(avctx, AV_LOG_ERROR, "vendor ID should be 4 bytes\n");
843 if (avctx->profile == FF_PROFILE_UNKNOWN) {
844 if (avctx->pix_fmt == AV_PIX_FMT_YUV422P10) {
845 avctx->profile = FF_PROFILE_PRORES_STANDARD;
846 av_log(avctx, AV_LOG_INFO,
848 } else if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10) {
849 avctx->profile = FF_PROFILE_PRORES_4444;
850 av_log(avctx, AV_LOG_INFO,
852 } else if (avctx->pix_fmt == AV_PIX_FMT_YUVA444P10) {
853 avctx->profile = FF_PROFILE_PRORES_4444;
854 av_log(avctx, AV_LOG_INFO,
857 } else if (avctx->profile < FF_PROFILE_PRORES_PROXY
858 || avctx->profile > FF_PROFILE_PRORES_XQ) {
860 avctx,
863 avctx->profile);
865 } else if ((avctx->pix_fmt == AV_PIX_FMT_YUV422P10) && (avctx->profile > FF_PROFILE_PRORES_HQ)){
866 av_log(avctx, AV_LOG_ERROR,
869 } else if ((avctx->pix_fmt == AV_PIX_FMT_YUV444P10 || avctx->pix_fmt == AV_PIX_FMT_YUVA444P10)
870 && (avctx->profile < FF_PROFILE_PRORES_4444)){
871 av_log(avctx, AV_LOG_ERROR,
876 if (avctx->profile < FF_PROFILE_PRORES_4444) { /* 422 versions */
878 if ((avctx->height & 0xf) || (avctx->width & 0xf)) {
887 if ((avctx->height & 0xf) || (avctx->width & 0xf)) {
894 if (avctx->pix_fmt == AV_PIX_FMT_YUVA444P10) {
902 ff_fdctdsp_init(&ctx->fdsp, avctx);
904 avctx->codec_tag = AV_RL32((const uint8_t*)profiles[avctx->profile].name);
907 scale_mat(QMAT_LUMA[avctx->profile] , ctx->qmat_luma[i - 1] , i);
908 scale_mat(QMAT_CHROMA[avctx->profile], ctx->qmat_chroma[i - 1], i);
914 static av_cold int prores_encode_close(AVCodecContext *avctx)
916 ProresContext* ctx = avctx->priv_data;