MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / apply_cropping

Function apply_cropping

libavcodec/decode.c:744–769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742}
743
744static int apply_cropping(AVCodecContext *avctx, AVFrame *frame)
745{
746 /* make sure we are noisy about decoders returning invalid cropping data */
747 if (frame->crop_left >= INT_MAX - frame->crop_right ||
748 frame->crop_top >= INT_MAX - frame->crop_bottom ||
749 (frame->crop_left + frame->crop_right) >= frame->width ||
750 (frame->crop_top + frame->crop_bottom) >= frame->height) {
751 av_log(avctx, AV_LOG_WARNING,
752 "Invalid cropping information set by a decoder: "
753 "%zu/%zu/%zu/%zu (frame size %dx%d). "
754 "This is a bug, please report it\n",
755 frame->crop_left, frame->crop_right, frame->crop_top, frame->crop_bottom,
756 frame->width, frame->height);
757 frame->crop_left = 0;
758 frame->crop_right = 0;
759 frame->crop_top = 0;
760 frame->crop_bottom = 0;
761 return 0;
762 }
763
764 if (!avctx->apply_cropping)
765 return 0;
766
767 return av_frame_apply_cropping(frame, avctx->flags & AV_CODEC_FLAG_UNALIGNED ?
768 AV_FRAME_CROP_UNALIGNED : 0);
769}
770
771// make sure frames returned to the caller are valid
772static int frame_validate(AVCodecContext *avctx, AVFrame *frame)

Callers 1

ff_decode_receive_frameFunction · 0.85

Calls 2

av_logFunction · 0.85
av_frame_apply_croppingFunction · 0.85

Tested by

no test coverage detected