-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 46645ab
Showing
171 changed files
with
47,147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
// BkdextDlg.cpp : 구현 파일입니다. | ||
// | ||
|
||
#include "stdafx.h" | ||
#include "HMCPT.h" | ||
#include "BkdextDlg.h" | ||
|
||
// CBkdextDlg 대화 상자입니다. | ||
|
||
IMPLEMENT_DYNAMIC(CBkdextDlg, CDialog) | ||
|
||
CBkdextDlg::CBkdextDlg(CWnd* pParent /*=NULL*/) | ||
: CDialog(CBkdextDlg::IDD, pParent) | ||
, PathName(_T("")) | ||
, width(0) | ||
, height(0) | ||
, RGBbuf(0) | ||
, ShowFlag(0) | ||
{ | ||
width = 352; | ||
height = 240; | ||
ShowFlag = 0; | ||
|
||
RGBbuf = (unsigned char*)malloc(width*height*3); | ||
} | ||
|
||
CBkdextDlg::~CBkdextDlg() | ||
{ | ||
free(RGBbuf); | ||
} | ||
|
||
void CBkdextDlg::DoDataExchange(CDataExchange* pDX) | ||
{ | ||
CDialog::DoDataExchange(pDX); | ||
DDX_Control(pDX, IDC_STATIC_PIC, Pic); | ||
} | ||
|
||
|
||
BEGIN_MESSAGE_MAP(CBkdextDlg, CDialog) | ||
ON_BN_CLICKED(IDC_BUTTON_OPEN, &CBkdextDlg::OnBnClickedButtonOpen) | ||
ON_BN_CLICKED(IDC_BUTTON_BKD, &CBkdextDlg::OnBnClickedButtonBkd) | ||
ON_WM_PAINT() | ||
ON_WM_CREATE() | ||
END_MESSAGE_MAP() | ||
|
||
|
||
// CBkdextDlg 메시지 처리기입니다. | ||
|
||
void CBkdextDlg::OnBnClickedButtonOpen() | ||
{ | ||
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다. | ||
char szFilter[] = "YUV video format (*.yuv)|*.yuv|H.264/AVC video format (*.264)|*.264|all files (*.*)|*.*|"; | ||
CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST, szFilter); | ||
|
||
if(dlg.DoModal() == IDOK) | ||
{ | ||
PathName = dlg.GetPathName(); | ||
} | ||
} | ||
|
||
void CBkdextDlg::OnBnClickedButtonBkd() | ||
{ | ||
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다. | ||
char szFilter[] = "YUV format (*.cif)|*.cif|YUV format (*.yuv)|*.yuv|All Files (*.*)|*.*||"; | ||
CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, szFilter); | ||
|
||
UpdateData(true); | ||
|
||
if(dlg.DoModal() == IDOK) | ||
{ | ||
|
||
// Save the image | ||
int FrameSize = width * height * 1.5; | ||
|
||
unsigned char* FrameBuf; | ||
FrameBuf = new unsigned char [FrameSize]; | ||
|
||
FILE *Video = fopen(PathName, "rb"); | ||
fread(FrameBuf, sizeof(unsigned char), FrameSize, Video); | ||
|
||
CString FileName = dlg.GetFileName(); | ||
FILE *FileWrite = fopen(FileName, "wb"); | ||
fwrite(FrameBuf, sizeof(unsigned char), FrameSize, FileWrite); | ||
fclose(FileWrite); | ||
|
||
// Copy the image to buffer for showing | ||
unsigned char* srcY; | ||
unsigned char* srcU; | ||
unsigned char* srcV; | ||
srcY = (unsigned char*)malloc(FrameSize); | ||
srcU = (unsigned char*)malloc(FrameSize/4); | ||
srcV = (unsigned char*)malloc(FrameSize/4); | ||
|
||
int CbOffSet = height * width; | ||
int CrOffSet = CbOffSet + (CbOffSet / 4); | ||
for(int y=0; y < height; y++) | ||
{ | ||
for(int x=0; x<width; x++) | ||
{ | ||
srcY[y*width + x] = FrameBuf[y*width + x]; | ||
srcU[(y>>1)*(width>>1) + (x>>1)] = FrameBuf[CbOffSet + (y>>1)*(width>>1) + (x>>1)]; | ||
srcV[(y>>1)*(width>>1) + (x>>1)] = FrameBuf[CrOffSet + (y>>1)*(width>>1) + (x>>1)]; | ||
} | ||
} | ||
|
||
pCon.YV12_to_RGB24(srcY,srcU,srcV,RGBbuf,width,height); | ||
|
||
free(srcY); | ||
free(srcU); | ||
free(srcV); | ||
free(FrameBuf); | ||
|
||
ShowFlag = 1; | ||
} | ||
|
||
UpdateData(false); | ||
} | ||
|
||
void CBkdextDlg::OnPaint() | ||
{ | ||
CPaintDC dc(this); // device context for painting | ||
// TODO: 여기에 메시지 처리기 코드를 추가합니다. | ||
// 그리기 메시지에 대해서는 CDialog::OnPaint()을(를) 호출하지 마십시오. | ||
|
||
CDC *pDC = Pic.GetDC(); | ||
CRect pRect; | ||
Pic.GetWindowRect(pRect); | ||
|
||
if(ShowFlag==1) | ||
{ | ||
BmpInfo->bmiHeader.biBitCount = 24; | ||
pDC->SetStretchBltMode(STRETCH_DELETESCANS); | ||
StretchDIBits( pDC->m_hDC, | ||
0,0,pRect.Width(),pRect.Height(), // destination; | ||
0,0,width,height, // source; | ||
RGBbuf, BmpInfo, | ||
DIB_RGB_COLORS, SRCCOPY); | ||
} | ||
} | ||
|
||
int CBkdextDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) | ||
{ | ||
if (CDialog::OnCreate(lpCreateStruct) == -1) | ||
return -1; | ||
|
||
// TODO: 여기에 특수화된 작성 코드를 추가합니다. | ||
// allocates memory block into device-independent bitmap structure | ||
hloc = GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE, | ||
sizeof(BITMAPINFOHEADER) + (sizeof(RGBQUAD) * 256)); | ||
BmpInfo = (LPBITMAPINFO) GlobalLock(hloc); | ||
|
||
// initializes information about the dimensions and color format of a DIB | ||
BmpInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); | ||
BmpInfo->bmiHeader.biPlanes = 1; | ||
BmpInfo->bmiHeader.biBitCount = 24; | ||
BmpInfo->bmiHeader.biCompression = BI_RGB; | ||
BmpInfo->bmiHeader.biWidth = width; | ||
BmpInfo->bmiHeader.biHeight = height; | ||
|
||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#pragma once | ||
#include "afxwin.h" | ||
|
||
// Custom | ||
#include "Convert.h" | ||
|
||
#define clip(a) ((a)<0?0:((a)>255?255:(a))) | ||
|
||
// CBkdextDlg 대화 상자입니다. | ||
|
||
class CBkdextDlg : public CDialog | ||
{ | ||
DECLARE_DYNAMIC(CBkdextDlg) | ||
|
||
public: | ||
CBkdextDlg(CWnd* pParent = NULL); // 표준 생성자입니다. | ||
virtual ~CBkdextDlg(); | ||
|
||
// 대화 상자 데이터입니다. | ||
enum { IDD = IDD_DIALOG_BKDEXT }; | ||
|
||
protected: | ||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원입니다. | ||
|
||
DECLARE_MESSAGE_MAP() | ||
public: | ||
afx_msg void OnBnClickedButtonOpen(); | ||
afx_msg void OnBnClickedButtonBkd(); | ||
CString PathName; | ||
int width; | ||
int height; | ||
// Picture Control | ||
CStatic Pic; | ||
afx_msg void OnPaint(); | ||
LPBITMAPINFO BmpInfo; | ||
HANDLE hloc; | ||
LPBYTE RGBbuf; | ||
int ShowFlag; | ||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); | ||
ColorSpaceConversions pCon; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// ChildView.cpp : implementation of the CChildView class | ||
// | ||
|
||
#include "stdafx.h" | ||
#include "HMCPT.h" | ||
#include "ChildView.h" | ||
|
||
//custom | ||
#include "MainFrm.h" | ||
#include "MainDlg.h" | ||
#include "BkdextDlg.h" | ||
|
||
#ifdef _DEBUG | ||
#define new DEBUG_NEW | ||
#endif | ||
|
||
|
||
// CChildView | ||
|
||
CChildView::CChildView() | ||
{ | ||
} | ||
|
||
CChildView::~CChildView() | ||
{ | ||
} | ||
|
||
|
||
BEGIN_MESSAGE_MAP(CChildView, CWnd) | ||
ON_WM_PAINT() | ||
ON_COMMAND(ID_TOOLS_ANALYZER, &CChildView::OnToolsAnalyzer) | ||
// ON_WM_CREATE() | ||
ON_COMMAND(ID_TOOLS_BKDEXTRACTOR, &CChildView::OnToolsBkdExtractor) | ||
END_MESSAGE_MAP() | ||
|
||
|
||
|
||
// CChildView message handlers | ||
|
||
BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs) | ||
{ | ||
if (!CWnd::PreCreateWindow(cs)) | ||
return FALSE; | ||
|
||
cs.dwExStyle |= WS_EX_CLIENTEDGE; | ||
cs.style &= ~WS_BORDER; | ||
cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS, | ||
::LoadCursor(NULL, IDC_ARROW), reinterpret_cast<HBRUSH>(COLOR_WINDOW+1), NULL); | ||
|
||
return TRUE; | ||
} | ||
|
||
void CChildView::OnPaint() | ||
{ | ||
CPaintDC dc(this); // device context for painting | ||
|
||
// TODO: Add your message handler code here | ||
|
||
// Do not call CWnd::OnPaint() for painting messages | ||
} | ||
|
||
void CChildView::OnToolsAnalyzer() | ||
{ | ||
// TODO: 여기에 명령 처리기 코드를 추가합니다. | ||
CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd(); | ||
mDlg.DoModal(); | ||
} | ||
void CChildView::OnToolsBkdExtractor() | ||
{ | ||
// TODO: 여기에 명령 처리기 코드를 추가합니다. | ||
CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd(); | ||
bDlg.DoModal(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// ChildView.h : interface of the CChildView class | ||
// | ||
|
||
|
||
#pragma once | ||
#include "maindlg.h" | ||
#include "bkdextdlg.h" | ||
|
||
// CChildView window | ||
|
||
class CChildView : public CWnd | ||
{ | ||
// Construction | ||
public: | ||
CChildView(); | ||
|
||
// Attributes | ||
public: | ||
CMainDlg mDlg; | ||
|
||
// Operations | ||
public: | ||
|
||
// Overrides | ||
protected: | ||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs); | ||
|
||
// Implementation | ||
public: | ||
virtual ~CChildView(); | ||
|
||
// Generated message map functions | ||
protected: | ||
afx_msg void OnPaint(); | ||
DECLARE_MESSAGE_MAP() | ||
public: | ||
afx_msg void OnToolsAnalyzer(); | ||
|
||
// afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); | ||
afx_msg void OnToolsBkdExtractor(); | ||
CBkdextDlg bDlg; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/***************************************************************/ | ||
/* convert.h - H.261 Codec (TU-Dresden) */ | ||
/* */ | ||
/* Autor: Dagmar Geske */ | ||
/* Datum: 05.08.1997 */ | ||
/* */ | ||
/***************************************************************/ | ||
|
||
// modified for use as lib: 16.12.97, Henrik Thuermer | ||
|
||
#ifndef _CONVERT_H | ||
#define _CONVERT_H | ||
|
||
// I use a class because I don't know how to export simple | ||
// functions to the library: If I use simple functions the | ||
// linker does'nt find the functions in the library :-( . | ||
// (Henrik) | ||
|
||
class ColorSpaceConversions { | ||
|
||
public: | ||
|
||
ColorSpaceConversions(); | ||
|
||
void RGB24_to_YV12(unsigned char * in, unsigned char * out,int w, int h); | ||
void YV12_to_RGB24(unsigned char *src0,unsigned char *src1,unsigned char *src2,unsigned char *dst_ori,int width,int height); | ||
void YVU9_to_YV12(unsigned char * in,unsigned char * out, int w, int h); | ||
void YUY2_to_YV12(unsigned char * in,unsigned char * out, int w, int h); | ||
void YV12_to_YVU9(unsigned char * in,unsigned char * out, int w, int h); | ||
void YV12_to_YUY2(unsigned char * in,unsigned char * out, int w, int h); | ||
}; | ||
|
||
#endif /* _CONVERT_H */ | ||
|
Binary file not shown.
Oops, something went wrong.