* Print the performance stats every five frames, and reset
the counters, so it's not the average for the entire decoding time, but for the last five frames. This gives a more accurate picture of what's going on. * Added NOTE about possibly removing the SWS version of the colorspace conversion code unless it's used for otherwise unsupported conversions. David's code is about 40% faster in my tests (nice job!). * Free the sws context in NegotiateVideoFormat, if necessary. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38651 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -41,6 +41,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_SWS_FOR_COLOR_SPACE_CONVERSION 0
|
#define USE_SWS_FOR_COLOR_SPACE_CONVERSION 0
|
||||||
|
// NOTE: David's color space conversion is much faster than the FFmpeg
|
||||||
|
// version. Perhaps the SWS code can be used for unsupported conversions?
|
||||||
|
// Otherwise the alternative code could simply be removed from this file.
|
||||||
|
|
||||||
|
|
||||||
struct wave_format_ex {
|
struct wave_format_ex {
|
||||||
@@ -494,6 +497,8 @@ AVCodecDecoder::_NegotiateVideoOutputFormat(media_format* inOutFormat)
|
|||||||
// But libavcodec doesn't seem to offer any way to tell the decoder
|
// But libavcodec doesn't seem to offer any way to tell the decoder
|
||||||
// which format it should use.
|
// which format it should use.
|
||||||
#if USE_SWS_FOR_COLOR_SPACE_CONVERSION
|
#if USE_SWS_FOR_COLOR_SPACE_CONVERSION
|
||||||
|
if (fSwsContext != NULL)
|
||||||
|
sws_freeContext(fSwsContext);
|
||||||
fSwsContext = NULL;
|
fSwsContext = NULL;
|
||||||
#else
|
#else
|
||||||
fFormatConversionFunc = 0;
|
fFormatConversionFunc = 0;
|
||||||
@@ -852,20 +857,23 @@ AVCodecDecoder::_DecodeVideo(void* outBuffer, int64* outFrameCount,
|
|||||||
decodingTime += formatConversionStart - startTime;
|
decodingTime += formatConversionStart - startTime;
|
||||||
conversionTime += doneTime - formatConversionStart;
|
conversionTime += doneTime - formatConversionStart;
|
||||||
profileCounter++;
|
profileCounter++;
|
||||||
if (!(fFrame % 10)) {
|
if (!(fFrame % 5)) {
|
||||||
if (info) {
|
if (info) {
|
||||||
printf("[v] profile: d1 = %lld, d2 = %lld (%Ld) required "
|
printf("[v] profile: d1 = %lld, d2 = %lld (%lld) required "
|
||||||
"%Ld\n",
|
"%Ld\n",
|
||||||
decodingTime / profileCounter,
|
decodingTime / profileCounter,
|
||||||
conversionTime / profileCounter,
|
conversionTime / profileCounter,
|
||||||
fFrame, info->time_to_decode);
|
fFrame, info->time_to_decode);
|
||||||
} else {
|
} else {
|
||||||
printf("[v] profile: d1 = %lld, d2 = %lld (%Ld) required "
|
printf("[v] profile: d1 = %lld, d2 = %lld (%lld) required "
|
||||||
"%Ld\n",
|
"%Ld\n",
|
||||||
decodingTime / profileCounter,
|
decodingTime / profileCounter,
|
||||||
conversionTime / profileCounter,
|
conversionTime / profileCounter,
|
||||||
fFrame, bigtime_t(1000000LL / fOutputFrameRate));
|
fFrame, bigtime_t(1000000LL / fOutputFrameRate));
|
||||||
}
|
}
|
||||||
|
decodingTime = 0;
|
||||||
|
conversionTime = 0;
|
||||||
|
profileCounter = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user