MCPcopy Create free account
hub / github.com/Tencent/libpag / IsKeyFrame

Function IsKeyFrame

exporter/src/export/sequence/BitmapSequence.cpp:26–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24namespace exporter {
25
26static bool IsKeyFrame(pag::Frame curFrame, pag::Frame lastKeyFrame, int diffSize, int fullSize,
27 int keyFrameRate) {
28 pag::Frame frameDistance = curFrame - lastKeyFrame;
29 if (curFrame == 0) {
30 return true;
31 }
32 if (diffSize == 0) {
33 return false;
34 }
35 if (diffSize == fullSize) {
36 return true;
37 }
38 if (diffSize > (fullSize * 0.9) && frameDistance > 5) {
39 return true;
40 }
41 if (diffSize > (fullSize * 0.75) && keyFrameRate > 20 && frameDistance > (keyFrameRate / 2)) {
42 return true;
43 }
44 if (keyFrameRate > 0 && frameDistance > keyFrameRate) {
45 return true;
46 }
47
48 return false;
49}
50
51void GetBitmapSequence(std::shared_ptr<PAGExportSession> session,
52 pag::BitmapComposition* composition, float compositionFactor) {

Callers 1

GetBitmapSequenceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected