Status MJPEGVideoDecoderBaseMFX::FillVideoParam(mfxVideoParam *par, bool /*full*/) { memset(par, 0, sizeof(mfxVideoParam)); par->mfx.CodecId = MFX_CODEC_JPEG; par->mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; mfxSize size = m_frameDims; AdjustFrameSize(size); par->mfx.FrameInfo.Width = mfxU16(size.width); par->mfx.FrameInfo.Height = mfxU16(size.height); par->mfx.FrameInfo.CropX = 0; par->mfx.FrameInfo.CropY = 0; par->mfx.FrameInfo.CropH = (mfxU16) (m_frameDims.height); par->mfx.FrameInfo.CropW = (mfxU16) (m_frameDims.width); par->mfx.FrameInfo.CropW = UMC::align_value<mfxU16>(par->mfx.FrameInfo.CropW, 2); par->mfx.FrameInfo.CropH = UMC::align_value<mfxU16>(par->mfx.FrameInfo.CropH, 2); par->mfx.FrameInfo.PicStruct = (mfxU8)(m_interleaved ? MFX_PICSTRUCT_FIELD_TFF : MFX_PICSTRUCT_PROGRESSIVE); par->mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; par->mfx.FrameInfo.AspectRatioW = 0; par->mfx.FrameInfo.AspectRatioH = 0; par->mfx.FrameInfo.FrameRateExtD = 1; par->mfx.FrameInfo.FrameRateExtN = 30; par->mfx.CodecProfile = 1; par->mfx.CodecLevel = 1; par->mfx.JPEGChromaFormat = GetMFXChromaFormat(GetChromaType()); par->mfx.JPEGColorFormat = GetMFXColorFormat(GetColorType()); par->mfx.Rotation = MFX_ROTATION_0; par->mfx.InterleavedDec = (mfxU16)(m_interleavedScan ? MFX_SCANTYPE_INTERLEAVED : MFX_SCANTYPE_NONINTERLEAVED); par->mfx.NumThread = 0; return UMC_OK; }
static void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference) { AdjustFrameSize(GetDlgItem(hDlg, ctrl_id), hDlg, nXDifference, nYDifference, 0); }
INT_PTR CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { RECT rc; int nXDifference; int nYDifference; /* HDC hdc; */ /* PAINTSTRUCT ps; */ switch (message) { case WM_INITDIALOG: /* Save the width and height */ GetClientRect(hDlg, &rc); nPerformancePageWidth = rc.right; nPerformancePageHeight = rc.bottom; /* Update window position */ SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER); /* * Get handles to all the controls */ hPerformancePageTotalsFrame = GetDlgItem(hDlg, IDC_TOTALS_FRAME); hPerformancePageCommitChargeFrame = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_FRAME); hPerformancePageKernelMemoryFrame = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_FRAME); hPerformancePagePhysicalMemoryFrame = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_FRAME); hPerformancePageCpuUsageFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_FRAME); hPerformancePageMemUsageFrame = GetDlgItem(hDlg, IDC_MEM_USAGE_FRAME); hPerformancePageCpuUsageHistoryFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_FRAME); hPerformancePageMemUsageHistoryFrame = GetDlgItem(hDlg, IDC_MEMORY_USAGE_HISTORY_FRAME); hPerformancePageCommitChargeTotalEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_TOTAL); hPerformancePageCommitChargeLimitEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_LIMIT); hPerformancePageCommitChargePeakEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_PEAK); hPerformancePageKernelMemoryTotalEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_TOTAL); hPerformancePageKernelMemoryPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_PAGED); hPerformancePageKernelMemoryNonPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_NONPAGED); hPerformancePagePhysicalMemoryTotalEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_TOTAL); hPerformancePagePhysicalMemoryAvailableEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_AVAILABLE); hPerformancePagePhysicalMemorySystemCacheEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE); hPerformancePageTotalsHandleCountEdit = GetDlgItem(hDlg, IDC_TOTALS_HANDLE_COUNT); hPerformancePageTotalsProcessCountEdit = GetDlgItem(hDlg, IDC_TOTALS_PROCESS_COUNT); hPerformancePageTotalsThreadCountEdit = GetDlgItem(hDlg, IDC_TOTALS_THREAD_COUNT); hPerformancePageCpuUsageGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_GRAPH); hPerformancePageMemUsageGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_GRAPH); hPerformancePageMemUsageHistoryGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_HISTORY_GRAPH); hPerformancePageCpuUsageHistoryGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); GetClientRect(hPerformancePageCpuUsageHistoryGraph, &rc); /* create the control */ /* PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); */ GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph, hPerformancePageCpuUsageHistoryGraph, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); /* customize the control */ GraphCtrl_SetRange(&PerformancePageCpuUsageHistoryGraph, 0.0, 100.0, 10); /* PerformancePageCpuUsageHistoryGraph.SetYUnits("Current") ; */ /* PerformancePageCpuUsageHistoryGraph.SetXUnits("Samples (Windows Timer: 100 msec)") ; */ /* PerformancePageCpuUsageHistoryGraph.SetBackgroundColor(RGB(0, 0, 64)) ; */ /* PerformancePageCpuUsageHistoryGraph.SetGridColor(RGB(192, 192, 255)) ; */ /* PerformancePageCpuUsageHistoryGraph.SetPlotColor(RGB(255, 255, 255)) ; */ GraphCtrl_SetBackgroundColor(&PerformancePageCpuUsageHistoryGraph, RGB(0, 0, 0)) ; GraphCtrl_SetGridColor(&PerformancePageCpuUsageHistoryGraph, RGB(152, 205, 152)) ; GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph, 0, RGB(255, 0, 0)) ; GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph, 1, RGB(0, 255, 0)) ; GetClientRect(hPerformancePageMemUsageHistoryGraph, &rc); GraphCtrl_Create(&PerformancePageMemUsageHistoryGraph, hPerformancePageMemUsageHistoryGraph, hDlg, IDC_MEM_USAGE_HISTORY_GRAPH); GraphCtrl_SetRange(&PerformancePageMemUsageHistoryGraph, 0.0, 100.0, 10) ; GraphCtrl_SetBackgroundColor(&PerformancePageMemUsageHistoryGraph, RGB(0, 0, 0)) ; GraphCtrl_SetGridColor(&PerformancePageMemUsageHistoryGraph, RGB(152, 215, 152)) ; GraphCtrl_SetPlotColor(&PerformancePageMemUsageHistoryGraph, 0, RGB(255, 255, 0)) ; /* Start our refresh thread */ #ifdef RUN_PERF_PAGE CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL); #endif /* * Subclass graph buttons */ OldGraphWndProc = (WNDPROC)SetWindowLongPtr(hPerformancePageCpuUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc); SetWindowLongPtr(hPerformancePageMemUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc); OldGraphCtrlWndProc = (WNDPROC)SetWindowLongPtr(hPerformancePageMemUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc); SetWindowLongPtr(hPerformancePageCpuUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc); return TRUE; case WM_COMMAND: break; #if 0 case WM_NCPAINT: hdc = GetDC(hDlg); GetClientRect(hDlg, &rc); Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT)); ReleaseDC(hDlg, hdc); break; case WM_PAINT: hdc = BeginPaint(hDlg, &ps); GetClientRect(hDlg, &rc); Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT)); EndPaint(hDlg, &ps); break; #endif case WM_SIZE: do { int cx, cy; if (wParam == SIZE_MINIMIZED) return 0; cx = LOWORD(lParam); cy = HIWORD(lParam); nXDifference = cx - nPerformancePageWidth; nYDifference = cy - nPerformancePageHeight; nPerformancePageWidth = cx; nPerformancePageHeight = cy; } while (0); /* Reposition the performance page's controls */ AdjustFrameSize(hPerformancePageTotalsFrame, hDlg, 0, nYDifference, 0); AdjustFrameSize(hPerformancePageCommitChargeFrame, hDlg, 0, nYDifference, 0); AdjustFrameSize(hPerformancePageKernelMemoryFrame, hDlg, 0, nYDifference, 0); AdjustFrameSize(hPerformancePagePhysicalMemoryFrame, hDlg, 0, nYDifference, 0); AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL, hDlg, 0, nYDifference); AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT, hDlg, 0, nYDifference); AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK, hDlg, 0, nYDifference); AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL, hDlg, 0, nYDifference); AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED, hDlg, 0, nYDifference); AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED, hDlg, 0, nYDifference); AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL, hDlg, 0, nYDifference); AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE, hDlg, 0, nYDifference); AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE, hDlg, 0, nYDifference); AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT, hDlg, 0, nYDifference); AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT, hDlg, 0, nYDifference); AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT, hDlg, 0, nYDifference); AdjustControlPostion(hPerformancePageCommitChargeTotalEdit, hDlg, 0, nYDifference); AdjustControlPostion(hPerformancePageCommitChargeLimitEdit, hDlg, 0, nYDifference); AdjustControlPostion(hPerformancePageCommitChargePeakEdit, hDlg, 0, nYDifference); AdjustControlPostion(hPerformancePageKernelMemoryTotalEdit, hDlg, 0, nYDifference); AdjustControlPostion(hPerformancePageKernelMemoryPagedEdit, hDlg, 0, nYDifference); AdjustControlPostion(hPerformancePageKernelMemoryNonPagedEdit, hDlg, 0, nYDifference); AdjustControlPostion(hPerformancePagePhysicalMemoryTotalEdit, hDlg, 0, nYDifference); AdjustControlPostion(hPerformancePagePhysicalMemoryAvailableEdit, hDlg, 0, nYDifference); AdjustControlPostion(hPerformancePagePhysicalMemorySystemCacheEdit, hDlg, 0, nYDifference); AdjustControlPostion(hPerformancePageTotalsHandleCountEdit, hDlg, 0, nYDifference); AdjustControlPostion(hPerformancePageTotalsProcessCountEdit, hDlg, 0, nYDifference); AdjustControlPostion(hPerformancePageTotalsThreadCountEdit, hDlg, 0, nYDifference); { static int lastX, lastY; nXDifference += lastX; nYDifference += lastY; lastX = lastY = 0; if (nXDifference % 2) { if (nXDifference > 0) { nXDifference--; lastX++; } else { nXDifference++; lastX--; } } if (nYDifference % 2) { if (nYDifference > 0) { nYDifference--; lastY++; } else { nYDifference++; lastY--; } } } AdjustFrameSize(hPerformancePageCpuUsageFrame, hDlg, nXDifference, nYDifference, 1); AdjustFrameSize(hPerformancePageMemUsageFrame, hDlg, nXDifference, nYDifference, 2); AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame, hDlg, nXDifference, nYDifference, 3); AdjustFrameSize(hPerformancePageMemUsageHistoryFrame, hDlg, nXDifference, nYDifference, 4); AdjustFrameSize(hPerformancePageCpuUsageGraph, hDlg, nXDifference, nYDifference, 1); AdjustFrameSize(hPerformancePageMemUsageGraph, hDlg, nXDifference, nYDifference, 2); AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph, hDlg, nXDifference, nYDifference, 3); AdjustFrameSize(hPerformancePageMemUsageHistoryGraph, hDlg, nXDifference, nYDifference, 4); break; } return 0; }
static void AdjustControlPostion(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference) { AdjustFrameSize(hCntrl, hDlg, nXDifference, nYDifference, 0); }