Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] Decoding slice based frames
@ 2025-03-05 12:40 d.gordenin
  0 siblings, 0 replies; only message in thread
From: d.gordenin @ 2025-03-05 12:40 UTC (permalink / raw)
  To: ffmpeg-devel

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".

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-03-05 12:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-05 12:40 [FFmpeg-devel] Decoding slice based frames d.gordenin

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