<br><br>Le lundi 2 novembre 2015, Info || Non-Lethal Applications <<a href="mailto:info@non-lethal-applications.com">info@non-lethal-applications.com</a>> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On 02 Nov 2015, at 11:22, Jean-Yves Avenard <<a href="javascript:_e(%7B%7D,'cvml','jyavenard@gmail.com');" target="_blank">jyavenard@gmail.com</a>> wrote:</div><br><div><br><br>Le vendredi 23 octobre 2015, Isaksson Jörgen <<a href="javascript:_e(%7B%7D,'cvml','jogga@bitfield.se');" target="_blank">jogga@bitfield.se</a>> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I’m new to this list so forgive me if this has been answered before.<br>
<br>
With version 2.8 of the libraries I saw the addition of Video Toolbox hardware decoding support (on Mac OS X that is).<br>
<br>
But I can’t find much documentation on how to use it. There are some clues in the header files on how to set it up, but there’s no docs on how to do the actual decoding.<br>
<br>
I have compiled version 2.8.1 of the libraries and I can confirm that the Video Toolbox hwaccels are there:<br>
<br>
Enabled hwaccels:<br>
h263_videotoolbox       mpeg1_videotoolbox      mpeg4_videotoolbox<br>
h264_videotoolbox       mpeg2_videotoolbox<br>
<br>
In my player app I have setup an AVVideotoolboxContext like described in the headers.<br>
<br>
if (self.codecContext->codec_id == AV_CODEC_ID_H264) {<br>
        _videoToolboxContext = av_videotoolbox_alloc_context();<br>
        int result = av_videotoolbox_default_init2(self.codecContext, self.videoToolboxContext);<br>
        if (result != 0) {<br>
            NSLog(@"Failed to init video toolbox");<br>
            _videoToolboxContext = NULL;<br>
        }<br>
 }<br>
<br>
_codec = avcodec_find_decoder(self.codecContext->codec_id);<br>
<br>
Everything seems to work fine and the _videoToolboxContext is properly allocated.<br>
<br>
But how do I go about actually decoding using it?<br>
<br>
Anyone with any experience from this?<br><br>
</blockquote><div>VideoToolbox is for decoding only, just like VDA </div><div><br></div><div>From 10.9; to get HW decoding the only thing that needs to be set is a constant. And this is just a hint. Vat won't use HW for vertical resolution < 300 typically.</div><div><br></div><div>Note that ffmpeg doesn't enable async decoding, so the performance are poor, nowhere near as fast as what it could be.</div></div></blockquote><br></div><div>And what is the constant that needs to be set and where?</div></div></blockquote><div><br></div><div>kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder</div><div><br></div><div>Looking at the 2.8 ffmpeg source code, this constant is set. The decoder will use HW acceleration if available...</div><div>Note that ffmpeg code will crash if used on OSX < 10.9 (where that constant was introduced)</div><div><br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Do you know if it’s still worth using it?</div><div>Will the decoding be faster than FFmpeg’s standard software decoding?</div><div><br></div></div></blockquote><div><br></div><div>Faster I don't know. Using less CPU certainly.</div><div><br></div><div>However, in my experience, the bottleneck will be in not using async decode.</div><div><br></div><div>There's a good 100% performance increase with that mode set !</div><div><br></div><div>Too bad it isn't set</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br></div></blockquote>