Lines Matching defs:avctx
141 static av_cold int decode_init(AVCodecContext *avctx)
144 ProresContext *ctx = avctx->priv_data;
147 avctx->bits_per_raw_sample = 10;
149 switch (avctx->codec_tag) {
151 avctx->profile = FF_PROFILE_PRORES_PROXY;
154 avctx->profile = FF_PROFILE_PRORES_LT;
157 avctx->profile = FF_PROFILE_PRORES_STANDARD;
160 avctx->profile = FF_PROFILE_PRORES_HQ;
163 avctx->profile = FF_PROFILE_PRORES_4444;
164 avctx->bits_per_raw_sample = 12;
167 avctx->profile = FF_PROFILE_PRORES_XQ;
168 avctx->bits_per_raw_sample = 12;
171 avctx->profile = FF_PROFILE_UNKNOWN;
172 av_log(avctx, AV_LOG_WARNING, "Unknown prores profile %d\n", avctx->codec_tag);
175 if (avctx->bits_per_raw_sample == 10) {
176 av_log(avctx, AV_LOG_DEBUG, "Auto bitdepth precision. Use 10b decoding based on codec tag.\n");
178 av_log(avctx, AV_LOG_DEBUG, "Auto bitdepth precision. Use 12b decoding based on codec tag.\n");
181 ff_blockdsp_init(&ctx->bdsp, avctx);
182 ret = ff_proresdsp_init(&ctx->prodsp, avctx);
184 av_log(avctx, AV_LOG_ERROR, "Fail to init proresdsp for bits per raw sample %d\n", avctx->bits_per_raw_sample);
196 if (avctx->bits_per_raw_sample == 10){
198 } else if (avctx->bits_per_raw_sample == 12){
201 av_log(avctx, AV_LOG_ERROR, "Fail to set unpack_alpha for bits per raw sample %d\n", avctx->bits_per_raw_sample);
208 const int data_size, AVCodecContext *avctx)
216 ff_dlog(avctx, "header size %d\n", hdr_size);
218 av_log(avctx, AV_LOG_ERROR, "error, wrong header size\n");
223 ff_dlog(avctx, "%.4s version %d\n", buf+4, version);
225 av_log(avctx, AV_LOG_ERROR, "unsupported version: %d\n", version);
232 if (width != avctx->width || height != avctx->height) {
235 av_log(avctx, AV_LOG_WARNING, "picture resolution change: %dx%d -> %dx%d\n",
236 avctx->width, avctx->height, width, height);
237 if ((ret = ff_set_dimensions(avctx, width, height)) < 0)
245 av_log(avctx, AV_LOG_ERROR, "Invalid alpha mode %d\n", ctx->alpha_info);
248 if (avctx->skip_alpha) ctx->alpha_info = 0;
250 ff_dlog(avctx, "frame type %d\n", ctx->frame_type);
261 if (avctx->bits_per_raw_sample == 10) {
267 if (avctx->bits_per_raw_sample == 10) {
287 if ((ret = ff_thread_get_format(avctx, pix_fmts)) < 0)
290 avctx->pix_fmt = ret;
293 avctx->color_primaries = buf[14];
294 avctx->color_trc = buf[15];
295 avctx->colorspace = buf[16];
296 avctx->color_range = AVCOL_RANGE_MPEG;
300 ff_dlog(avctx, "flags %x\n", flags);
304 av_log(avctx, AV_LOG_ERROR, "Header truncated\n");
315 av_log(avctx, AV_LOG_ERROR, "Header truncated\n");
326 static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, const int buf_size)
328 ProresContext *ctx = avctx->priv_data;
337 av_log(avctx, AV_LOG_ERROR, "error, wrong picture header size\n");
343 av_log(avctx, AV_LOG_ERROR, "error, wrong picture data size\n");
350 av_log(avctx, AV_LOG_ERROR, "unsupported slice resolution: %dx%d\n",
355 ctx->mb_width = (avctx->width + 15) >> 4;
357 ctx->mb_height = (avctx->height + 31) >> 5;
359 ctx->mb_height = (avctx->height + 15) >> 4;
379 av_log(avctx, AV_LOG_ERROR, "error, wrong slice count\n");
406 av_log(avctx, AV_LOG_ERROR, "error, wrong slice data size\n");
417 av_log(avctx, AV_LOG_ERROR, "error, slice out of bounds\n");
423 av_log(avctx, AV_LOG_ERROR, "error wrong mb count y %d h %d\n",
500 static av_always_inline int decode_ac_coeffs(AVCodecContext *avctx, GetBitContext *gb,
503 ProresContext *ctx = avctx->priv_data;
525 av_log(avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", pos, max_coeffs);
543 static int decode_slice_luma(AVCodecContext *avctx, SliceContext *slice,
548 ProresContext *ctx = avctx->priv_data;
562 if ((ret = decode_ac_coeffs(avctx, &gb, blocks, blocks_per_slice)) < 0)
577 static int decode_slice_chroma(AVCodecContext *avctx, SliceContext *slice,
582 ProresContext *ctx = avctx->priv_data;
596 if ((ret = decode_ac_coeffs(avctx, &gb, blocks, blocks_per_slice)) < 0)
644 static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
646 ProresContext *ctx = avctx->priv_data;
661 //av_log(avctx, AV_LOG_INFO, "slice %d mb width %d mb x %d y %d\n",
677 av_log(avctx, AV_LOG_ERROR, "invalid plane data size\n");
696 if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10 || avctx->pix_fmt == AV_PIX_FMT_YUVA444P10 ||
697 avctx->pix_fmt == AV_PIX_FMT_YUV444P12 || avctx->pix_fmt == AV_PIX_FMT_YUVA444P12) {
717 ret = decode_slice_luma(avctx, slice, (uint16_t*)dest_y, luma_stride,
722 if (!(avctx->flags & AV_CODEC_FLAG_GRAY) && (u_data_size + v_data_size) > 0) {
723 ret = decode_slice_chroma(avctx, slice, (uint16_t*)dest_u, chroma_stride,
729 ret = decode_slice_chroma(avctx, slice, (uint16_t*)dest_v, chroma_stride,
738 if (avctx->bits_per_raw_sample == 10) {
762 static int decode_picture(AVCodecContext *avctx)
764 ProresContext *ctx = avctx->priv_data;
768 avctx->execute2(avctx, decode_slice_thread, NULL, NULL, ctx->slice_count);
781 static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
784 ProresContext *ctx = avctx->priv_data;
790 av_log(avctx, AV_LOG_ERROR, "invalid frame header\n");
802 frame_hdr_size = decode_frame_header(ctx, buf, buf_size, avctx);
809 if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0)
811 ff_thread_finish_setup(avctx);
813 if (avctx->hwaccel) {
814 ret = avctx->hwaccel->start_frame(avctx, NULL, 0);
817 ret = avctx->hwaccel->decode_slice(avctx, avpkt->data, avpkt->size);
820 ret = avctx->hwaccel->end_frame(avctx);
827 pic_size = decode_picture_header(avctx, buf, buf_size);
829 av_log(avctx, AV_LOG_ERROR, "error decoding picture header\n");
833 if ((ret = decode_picture(avctx)) < 0) {
834 av_log(avctx, AV_LOG_ERROR, "error decoding picture\n");
852 static av_cold int decode_close(AVCodecContext *avctx)
854 ProresContext *ctx = avctx->priv_data;