emd_histogram.c
来自「ZPAV (H265) PC(X86) demo ZPAV (H26」· C语言 代码 · 共 91 行
C
91 行
/*
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006-2008 Beijing, pengzhen (pengzhenxp@yahoo.com.cn) //
// //
///////////////////////////////////////////////////////////////////////////////
*/
#include "emd_histogram_upper_envelope.c"
#include "emd_histogram_lower_envelope.c"
static inline void get_all_histogram( HistogramContext* hc )
{
UINT *hist_mean = (UINT*)(hc->m_pMean ) ;
UINT *hist_residue = (UINT*)(hc->m_pResidue ) ;
UINT *hist_upper = (UINT*)hc->m_pUpper ;
UINT *hist_lower = (UINT*)hc->m_pLower ;
UINT *hist_data = (UINT*)hc->m_pHistogram ;
int i = HISTTOGRAM_COUNT ;
/* upper histogram */
get_upper_histogram( hc ) ;
/* lower histogram */
get_lower_histogram( hc ) ;
while( i-- )
{
// *hist_mean = *hist_lower ;
*hist_mean = ( (*hist_upper) + (*hist_lower) ) /2 ;
*hist_residue = (*hist_data) - (*hist_mean) ;
hist_mean ++ ; hist_residue ++; hist_data ++; hist_upper ++ ; hist_lower ++;
}
}
static inline void draw_all_histogram( HistogramContext* hc,
BYTE* data , int stride, int width, int height , int off )
{
/*draw histogram */
draw_histogram( 0x10, hc->m_pHistogram, data, stride, off,0, width-off*2,height-off*2 ) ;
/*draw upper histogram */
//draw_histogram( 0xf0, hc->m_pUpper, data, stride, off,0, width-off*2,height-off*2 ) ;
/*draw lower histogram */
//draw_histogram( 0x80, hc->m_pLower, data, stride, off,0, width-off*2,height-off*2 ) ;
/*draw mean histogram */
draw_histogram( 0xf0, hc->m_pMean, data, stride, off,0, width-off*2,height-off*2 ) ;
/*draw residue histogram */
draw_histogram( 0x80, hc->m_pResidue, data, stride, off,0, width-off*2,height-off*2 ) ;
}
int dvp_emd_analysis_histogram( dvp_ctx *dvpctx, void* data, int width, int height, int stride )
{
HistogramContext* hc = &(m_pHistogramContext) ;
/* histogram */
get_histogram( hc, data, width, height, stride ) ;
// get energy
energy_histogram( hc->m_pHistogram ) ;
#define Hist_H_Off height/8
/* norm histogram */
norm_histogram( hc->m_pHistogram, height-Hist_H_Off*2) ;
/* get histogram */
get_all_histogram( hc ) ;
/*draw histogram */
draw_all_histogram( hc, (BYTE*)data, stride, width, height , Hist_H_Off ) ;
#undef Hist_H_Off
return 1 ;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?