From: "d.gordenin@ngslab.ru" <d.gordenin@ngslab.ru>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] Decoding slice based frames
Date: Wed, 5 Mar 2025 15:40:59 +0300
Message-ID: <855b230d-e38c-431b-a837-f330439b8cca@ngslab.ru> (raw)
Hi
My decoder receives slice based frame, and it cannot decode them (the
result is a greased picture). How should I decode them and which are
differences from decoding a usual frame? My code of dedoding is canonical:
if (size >= sizeof(kh264Prefix) && memcmp(data, kh264Prefix,
sizeof(kh264Prefix)) != 0)
{
if (size > prefix_buffer_.size() - sizeof(kh264Prefix))
{
logger_->Error("Too large data packet for decoding");
return false;
}
memcpy(prefix_buffer_.data() + sizeof(kh264Prefix), data, size);
data = prefix_buffer_.data();
size += sizeof(kh264Prefix);
}
AVPacket avpkt;
av_init_packet(&avpkt);
avpkt.pts = 0;
avpkt.dts = 0;
avpkt.data = data;
avpkt.size = size;
int gotFrame = false;
while (avpkt.size > 0)
{
// We must use positive result to move through the data buffer
auto len = avcodec_decode_video2(av_context_, av_frame_, &gotFrame,
&avpkt);
if (len < 0)
{
// In case of an error/warning FFmpeg will call
// decoder::LogCallback(...) to inform about the issue
break;
}
avpkt.data += len;
avpkt.size -= len;
}
av_free_packet(&avpkt);
I tried the AV_CODEC_CAP_SLICE_THREADS flag, not sure is it for decoding
or not.
_______________________________________________
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".
reply other threads:[~2025-03-05 12:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=855b230d-e38c-431b-a837-f330439b8cca@ngslab.ru \
--to=d.gordenin@ngslab.ru \
--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