Changeset 820
- Timestamp:
- 02/29/08 20:37:26 (5 months ago)
- Files:
-
- trunk/FFusionCodec.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/FFusionCodec.c
r819 r820 91 91 }; 92 92 93 struct per_frame_decode_stats 94 { 95 unsigned begin_calls; 96 unsigned decode_calls; 97 unsigned draw_calls; 98 unsigned end_calls; 99 }; 100 101 struct decode_stats 102 { 103 struct per_frame_decode_stats type[4]; 104 int max_frames_begun; 105 int max_frames_decoded; 106 }; 107 93 108 typedef struct 94 109 { … … 111 126 FFusionData data; 112 127 struct decode_glob decode; 128 struct decode_stats stats; 113 129 } FFusionGlobalsRecord, *FFusionGlobals; 114 130 … … 168 184 #include <QuickTime/ComponentDispatchHelper.c> 169 185 170 void *launchUpdateChecker(void *args)186 static void *launchUpdateChecker(void *args) 171 187 { 172 188 FSRef *ref = (FSRef *)args; … … 210 226 pthread_t thread; 211 227 pthread_create(&thread, NULL, launchUpdateChecker, updateCheckRef); 228 } 229 230 static void RecomputeMaxCounts(FFusionGlobals glob) 231 { 232 int i; 233 unsigned begun = 0, decoded = 0, ended = 0, drawn = 0; 234 235 for (i = 0; i < 4; i++) { 236 struct per_frame_decode_stats *f = &glob->stats.type[i]; 237 238 begun += f->begin_calls; 239 decoded += f->decode_calls; 240 drawn += f->draw_calls; 241 ended += f->end_calls; 242 } 243 244 signed begin_diff = begun - ended, decode_diff = decoded - drawn; 245 246 if (abs(begin_diff) > glob->stats.max_frames_begun) glob->stats.max_frames_begun = begin_diff; 247 if (abs(decode_diff) > glob->stats.max_frames_decoded) glob->stats.max_frames_decoded = decode_diff; 248 } 249 250 static void DumpFrameDropStats(FFusionGlobals glob) 251 { 252 static const char types[4] = {'?', 'I', 'P', 'B'}; 253 int i; 254 255 if (!glob->fileLog || glob->decode.lastFrame == 0) return; 256 257 Codecprintf(glob->fileLog, "Type\t| BeginBand\t| DecodeBand\t| DrawBand\t| dropped before decode\t| dropped before draw\n"); 258 259 for (i = 0; i < 4; i++) { 260 struct per_frame_decode_stats *f = &glob->stats.type[i]; 261 262 Codecprintf(glob->fileLog, "%c\t| %d\t\t| %d\t\t| %d\t\t| %d/%f%%\t\t| %d/%f%%\n", types[i], f->begin_calls, f->decode_calls, f->draw_calls, 263 f->begin_calls - f->decode_calls,(f->begin_calls > f->decode_calls) ? ((float)(f->begin_calls - f->decode_calls)/(float)f->begin_calls) * 100. : 0., 264 f->decode_calls - f->draw_calls,(f->decode_calls > f->draw_calls) ? ((float)(f->decode_calls - f->draw_calls)/(float)f->decode_calls) * 100. : 0.); 265 } 212 266 } 213 267 … … 316 370 { 317 371 FFusionDebugPrint("%p closed.\n", glob); 372 DumpFrameDropStats(glob); 318 373 319 374 // Make sure to close the base component and deallocate our storage … … 436 491 cap->baseCodecShouldCallDecodeBandForAllFrames = true; 437 492 cap->subCodecSupportsScheduledBackwardsPlaybackWithDifferenceFrames = !doExperimentalFlags; 438 439 // XXX enabling this seems to cause rare visible artifacts in h.264?440 493 cap->subCodecSupportsDrawInDecodeOrder = doExperimentalFlags; 441 494 cap->subCodecSupportsDecodeSmoothing = true; … … 1023 1076 myDrp->GOPStartFrameNumber = glob->begin.lastIFrame; 1024 1077 1078 glob->stats.type[drp->frameType].begin_calls++; 1079 RecomputeMaxCounts(glob); 1025 1080 FFusionDebugPrint("%p BeginBand: frame #%d type %d. (%sskippable)\n", glob, myDrp->frameNumber, type, not(skippable)); 1081 1026 1082 return noErr; 1027 1083 } … … 1050 1106 FFusionDecompressRecord *myDrp = (FFusionDecompressRecord *)drp->userDecompressRecord; 1051 1107 1108 glob->stats.type[drp->frameType].decode_calls++; 1109 RecomputeMaxCounts(glob); 1052 1110 FFusionDebugPrint("%p DecodeBand #%d qtType %d. (packed %d)\n", glob, myDrp->frameNumber, drp->frameType, glob->packedType); 1053 1111 … … 1178 1236 int i, j; 1179 1237 1238 glob->stats.type[drp->frameType].draw_calls++; 1239 RecomputeMaxCounts(glob); 1180 1240 FFusionDebugPrint("%p DrawBand #%d. (%sdecoded)\n", glob, myDrp->frameNumber, not(myDrp->decoded)); 1181 1241 … … 1271 1331 { 1272 1332 FFusionDecompressRecord *myDrp = (FFusionDecompressRecord *)drp->userDecompressRecord; 1333 glob->stats.type[drp->frameType].end_calls++; 1273 1334 FFusionDebugPrint("%p EndBand #%d.\n", glob, myDrp->frameNumber); 1335 1274 1336 return noErr; 1275 1337 }
