Skip to content

Commit

Permalink
Revert "[VPP] scene change detection minor refactor "
Browse files Browse the repository at this point in the history
This reverts commit 8f1b7a1
  • Loading branch information
Sherry-Lin authored and gfxVPLsdm committed Jun 7, 2024
1 parent 79ba6c8 commit e0b981d
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 44 deletions.
1 change: 0 additions & 1 deletion _studio/mfx_lib/ext/asc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ target_sources(asc_ext
target_link_libraries(asc_ext
PRIVATE
cmrt_cross_platform_hw
asc
)

include(sources_ext.cmake OPTIONAL)
6 changes: 4 additions & 2 deletions _studio/mfx_lib/ext/asc/include/asc_cm.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ typedef struct ASCvideoBufferCm: public ASCVidSample

class ASC_Cm: public ASC
{
using ASC::Init;
public:
ASC_Cm();
virtual ~ASC_Cm(){}
Expand Down Expand Up @@ -122,6 +123,7 @@ class ASC_Cm: public ASC

mfxStatus RunFrame(SurfaceIndex *idxFrom, mfxU32 parity);
mfxStatus RunFrame(mfxHDLPair frameHDL, mfxU32 parity);
mfxStatus RunFrame(mfxU8 *frame, mfxU32 parity);

mfxStatus CreateCmSurface2D(mfxHDLPair pSrcPair, CmSurface2D* & pCmSurface2D, SurfaceIndex* &pCmSrcIndex);
mfxStatus CreateCmKernels();
Expand Down Expand Up @@ -152,13 +154,13 @@ class ASC_Cm: public ASC
mfxStatus PutFrameProgressive(mfxHDLPair surface);
mfxStatus PutFrameProgressive(mfxHDL surface);
mfxStatus PutFrameProgressive(SurfaceIndex* idxSurf);
mfxStatus PutFrameProgressive(mfxU8 *frame, mfxI32 Pitch);


mfxStatus PutFrameInterlaced(mfxHDLPair surface);
mfxStatus PutFrameInterlaced(mfxHDL surface);
mfxStatus PutFrameInterlaced(SurfaceIndex* idxSurf);
mfxStatus PutFrameInterlaced(mfxU8 *frame, mfxI32 Pitch);
using ASC::RunFrame;
using ASC::PutFrameProgressive;

virtual mfxStatus calc_RaCa_Surf(mfxHDLPair surface, mfxF64& rscs);
//private:
Expand Down
25 changes: 25 additions & 0 deletions _studio/mfx_lib/ext/asc/src/asc_cm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,18 @@ mfxStatus ASC_Cm::RunFrame(mfxHDLPair frameHDL, mfxU32 parity)
return MFX_ERR_NONE;
}

mfxStatus ASC_Cm::RunFrame(mfxU8 *frame, mfxU32 parity) {
if (!m_ASCinitialized)
return MFX_ERR_NOT_INITIALIZED;
m_videoData[ASCCurrent_Frame]->frame_number = m_videoData[ASCReference_Frame]->frame_number + 1;
(this->*(resizeFunc))(frame, m_width, m_height, m_pitch, (ASCLayers)0, parity);
RsCsCalc();
DetectShotChangeFrame();
Put_LTR_Hint();
GeneralBufferRotation();
return MFX_ERR_NONE;
}

mfxStatus ASC_Cm::CreateCmSurface2D(mfxHDLPair pSrcPair, CmSurface2D* & pCmSurface2D, SurfaceIndex* &pCmSrcIndex)
{
INT cmSts = 0;
Expand Down Expand Up @@ -684,6 +696,19 @@ mfxStatus ASC_Cm::PutFrameProgressive(mfxHDL surface)
return sts;
}

mfxStatus ASC_Cm::PutFrameProgressive(mfxU8 *frame, mfxI32 Pitch) {
mfxStatus sts;
if (Pitch > 0) {
sts = SetPitch(Pitch);
SCD_CHECK_MFX_ERR(sts);
}

sts = RunFrame(frame, ASCTopField);
SCD_CHECK_MFX_ERR(sts);
m_dataReady = (sts == MFX_ERR_NONE);
return sts;
}

mfxStatus ASC_Cm::PutFrameInterlaced(mfxU8 *frame, mfxI32 Pitch) {
mfxStatus sts;

Expand Down
1 change: 1 addition & 0 deletions _studio/shared/asc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ target_link_libraries(asc
PRIVATE
mfx_sdl_properties
umc
$<$<BOOL:${MFX_ENABLE_EXT}>:mfx_ext>
)
5 changes: 0 additions & 5 deletions _studio/shared/asc/include/asc.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ class ASC {
void InitStruct();
mfxStatus VidRead_Init();
void VidSample_Init();
virtual mfxStatus VidSample_Alloc();
void SubSampleASC_ImagePro(mfxU8 *frame, mfxI32 srcWidth, mfxI32 srcHeight, mfxI32 inputPitch, ASCLayers dstIdx, mfxU32 parity);
void SubSampleASC_ImageInt(mfxU8 *frame, mfxI32 srcWidth, mfxI32 srcHeight, mfxI32 inputPitch, ASCLayers dstIdx, mfxU32 parity);
bool CompareStats(mfxU8 current, mfxU8 reference);
Expand Down Expand Up @@ -245,10 +244,6 @@ class ASC {
static mfxI32 Get_CpuFeature_SSE41();

virtual mfxStatus calc_RaCa_Surf(mfxHDLPair surface, mfxF64& rscs);

mfxStatus RunFrame(mfxU8* frame, mfxU32 parity);
mfxStatus PutFrameProgressive(mfxU8* frame, mfxI32 Pitch);

protected:
ASCVidSample** m_videoData;
};
Expand Down
6 changes: 3 additions & 3 deletions _studio/shared/asc/include/asc_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#ifndef __ASC_DEFS_H__
#define __ASC_DEFS_H__

#include <stdint.h>

#include "mfx_config.h"

#ifndef __ASC_DEFS_H__
#define __ASC_DEFS_H__

#define ASCTUNEDATA 0

#undef NULL
Expand Down
33 changes: 0 additions & 33 deletions _studio/shared/asc/src/asc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,6 @@ void ASC::VidSample_Init() {
}
}

mfxStatus ASC::VidSample_Alloc()
{
for (mfxI32 i = 0; i < ASCVIDEOSTATSBUF; i++)
SCD_CHECK_MFX_ERR(m_videoData[i]->layer.InitFrame(m_dataIn->layer));
return MFX_ERR_NONE;
}

void ASC::SetUltraFastDetection() {
m_support->size = ASCSmall_Size;
resizeFunc = &ASC::SubSampleASC_ImagePro;
Expand Down Expand Up @@ -461,7 +454,6 @@ mfxStatus ASC::Init(mfxI32 Width,

VidSample_Init();
Setup_Environment();
VidSample_Alloc();

sts = VidRead_Init();
SCD_CHECK_MFX_ERR(sts);
Expand Down Expand Up @@ -1171,29 +1163,4 @@ void ASC::VidSample_dispose()
free(m_frameBkp);
}

mfxStatus ASC::RunFrame(mfxU8* frame, mfxU32 parity) {
if (!m_ASCinitialized)
return MFX_ERR_NOT_INITIALIZED;
m_videoData[ASCCurrent_Frame]->frame_number = m_videoData[ASCReference_Frame]->frame_number + 1;
(this->*(resizeFunc))(frame, m_width, m_height, m_pitch, (ASCLayers)0, parity);
RsCsCalc();
DetectShotChangeFrame();
Put_LTR_Hint();
GeneralBufferRotation();
return MFX_ERR_NONE;
}

mfxStatus ASC::PutFrameProgressive(mfxU8* frame, mfxI32 Pitch) {
mfxStatus sts;
if (Pitch > 0) {
sts = SetPitch(Pitch);
SCD_CHECK_MFX_ERR(sts);
}

sts = RunFrame(frame, ASCTopField);
SCD_CHECK_MFX_ERR(sts);
m_dataReady = (sts == MFX_ERR_NONE);
return sts;
}

}

0 comments on commit e0b981d

Please sign in to comment.