From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH] avcodec/decode: Reset MMX state for receive_frame decoders, too Date: Tue, 14 Mar 2023 03:53:40 +0100 Message-ID: <AS8P250MB0744735E972FB28A7F9DBF2B8FBE9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw) FFmpeg's assembly code currently does not abide by the plattform-specific ABIs wrt its handling of the X86 MMX flag: Resetting the MMX state is deferred to avoid doing it multiple times instead of ensuring that the CPU is in floating point state upon return from any function. Furthermore, resetting said state is sometimes done generically, namely for all the decoders using the ordinary decode callback; yet this is not done for the decoders using the receive_frame API. This led to problems when MJPEG (and the MJPEG-based decoders) were switched to the receive_frame API in commit e9a2a8777317d91af658f774c68442ac4aa726ec, because ff_mjpeg_decode_sos() only resets the MMX state on success, not on failure. Such issues are probably still possible with SMVJPEG, which still uses the receive_frame API. See issue #10210. This commit therefore also resets the MMX state for the receive_frame API to avoid any more surprises of this sort. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- Of course, I am in favour of actually abiding by the ABI, even if it would cost performance; notice that there are currently scenarios where emms_c() is called unnecessarily (it is called generically and therefore even for codecs that don't need it; furthermore, for some codecs it depends upon the CPU flags used whether MMX code is in use, so it is unnecessary for newer CPUs). libavcodec/decode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index d1ba7f167f..22a0f8eb25 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -547,6 +547,7 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) if (codec->cb_type == FF_CODEC_CB_TYPE_RECEIVE_FRAME) { ret = codec->cb.receive_frame(avctx, frame); + emms_c(); } else ret = decode_simple_receive_frame(avctx, frame); -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2023-03-14 2:53 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-14 2:53 Andreas Rheinhardt [this message] 2023-03-17 18:42 Anton Khirnov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=AS8P250MB0744735E972FB28A7F9DBF2B8FBE9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \ --to=andreas.rheinhardt@outlook.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git