File: sample_vpp_frc.h

package info (click to toggle)
libvpl-tools 1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,652 kB
  • sloc: cpp: 107,469; python: 4,303; ansic: 3,202; sh: 159; lisp: 52; makefile: 13
file content (85 lines) | stat: -rw-r--r-- 2,251 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*############################################################################
  # Copyright (C) 2005 Intel Corporation
  #
  # SPDX-License-Identifier: MIT
  ############################################################################*/

#ifndef __SAMPLE_VPP_FRC_H
#define __SAMPLE_VPP_FRC_H

#include <stdio.h>
#include "vpl/mfxvideo.h"

#ifndef MFX_VERSION
    #error MFX_VERSION not defined
#endif

class BaseFRCChecker {
public:
    //BaseFRCChecker();
    virtual ~BaseFRCChecker() {}

    virtual mfxStatus Init(mfxVideoParam* par, mfxU32 asyncDeep) = 0;

    // notify FRCChecker about one more input frame
    virtual bool PutInputFrameAndCheck(mfxFrameSurface1* pSurface) = 0;

    // notify FRCChecker about one more output frame and check result
    virtual bool PutOutputFrameAndCheck(mfxFrameSurface1* pSurface) = 0;
};

class FRCChecker : public BaseFRCChecker {
public:
    FRCChecker();
    virtual ~FRCChecker(){};

    virtual mfxStatus Init(mfxVideoParam* par, mfxU32 asyncDeep);

    // notify FRCChecker about one more input frame
    virtual bool PutInputFrameAndCheck(mfxFrameSurface1* pSurface);

    // notify FRCChecker about one more output frame and check result
    virtual bool PutOutputFrameAndCheck(mfxFrameSurface1* pSurface);

protected:
    // calculate greatest common divisor
    mfxU32 CalculateGCD(mfxU32 val1, mfxU32 val2);
    // calculate period
    void DefinePeriods();
    void DefineEdges();

    bool CheckSurfaceCorrespondance() {
        return true;
    }
    void PrintDumpInfoAboutMomentError();
    void PrintDumpInfoAboutAverageError();

    mfxU32 m_FRateExtN_In;
    mfxU32 m_FRateExtD_In;
    mfxU32 m_FRateExtN_Out;
    mfxU32 m_FRateExtD_Out;

    // analyzing periods
    mfxU32 m_FramePeriod_In;
    mfxU32 m_FramePeriod_Out;

    // admissible error on period in frames
    mfxU32 m_Error_In;
    mfxU32 m_Error_Out;

    // edges in times between input and output
    mfxU32 m_UpperEdge;
    mfxU32 m_BottomEdge;

    // frame counter in the period for input frames
    mfxU32 m_NumFrame_In;
    // frame counter in the period  for output frames
    mfxU32 m_NumFrame_Out;

    mfxU32 m_MomentError;
    mfxU64 m_AverageError;

    mfxU32 m_asyncDeep;
};

#endif /* __SAMPLE_VPP_PTS_H*/