2018년 11월 10일 토요일

Visual Studio에서 메모리 누수 확인하기


Visual Studio에서 메모리 누수를 확인하려면 다음과 같이 new를 재정의 한다.

    #ifdef _DEBUG
    #define new DEBUG_NEW
    #endif

DEBUG_NEW로 할당한 메모리를 해제하지 않으면 Output 창에 다음과 같은 에러 메시지가 나온다.

    Detected memory leaks!
    Dumping objects ->
    {10} normal block at 0x12345678, 4 bytes long.
     Data: <  > CD CD CD CD
    Object dump complete.

0x12345678에서 누수가 발생했다고 나오지만, 이것만 봐선 어디에서 메모리 누수가 생겼는지 확인하기 어렵다.
메시지 맨 앞의 {10}은 메모리 할당 순서이다. 따라서 10번째 할당된 변수가 무엇인지 확인하면 된다.

    _CrtSetBreakAlloc(10);

코드 맨 처음 부분에 위와 같이 적어주면 10번째 메모리 할당에서 브레이크가 걸린다.

2018년 10월 31일 수요일

맥OS 모하비 - 강조 색상

MacOS가 모하비로 넘어오면서 많이 홍보된 것이 더욱 발전된 다크 모드였다.
실제로 업그레이드를 해보니 다크모드도 다크모드지만, 강조 색상을 지정할 수 있게 되었다. 
이전 버전에서는 파란 색으로 고정되어 있었으나 모하비로 넘어오면서 8개의 프리셋 중에서 선택할 수 있게 되었다.
강조 색상을 변경하려면 다음과 같이 한다.
  1. 시스템 환경 설정을 연다.
  2. '일반'을 누른다.
  3. 위에서 두 번째 메뉴 '강조 색상'에 있는 색 중에 원하는 것을 고른다. 기본은 파란색이다.


강조 색상은 메뉴에서 마우스가 올라가 있는 아이템, 라디오/체크/드롭다운 버튼, 선택 영역 등의 색에 적용된다.
그런데 아직은 기존 파란색 외의 다른 색들은 익숙하지 않아서 잘 쓸 것 같지는 않다.

참고로 각 색들의 RGB 값은 다음과 같다 (앞에서부터 R, G, B이다).
  • 파란색 - 21, 126, 251
  • 보라색 - 148, 65, 148
  • 분홍색 - 245, 83, 158
  • 빨간색 - 222, 58, 67
  • 주황색 - 245, 130, 46
  • 노란색 - 250, 183, 59
  • 초록색 - 101, 184, 77
  • 흑색 - 152, 152, 152

2018년 10월 30일 화요일

NaraImage updated to version 1.2.2.24


Small updates were made last week.
Most of them were actually 'bug fixes', not updates.

I found that the window size is a little bit smaller than it should be.
Width and height of the window are 1-pixel smaller, to be precise.
That means that you couldn't see the right-most column and the last row of the image with the previous version.
Now, finally, I noticed this and fixed it.

One more thing.
Full screen button was added on a control panel.
(In previous version of NaraImage, you can go full-screen by pressing F11 or maximize button).
When you go full-screen, the application covers everything, even a taskbar.
This is very different from other applications 'maximize' behavior - and that's why this functionality is called 'FULL-SCREEN'.
Every video player supports this since it helps to focus the content, video.
Interestingly enough, YUV viewers usually don't support this.
But finally, the world has the YUV viewer that supports Full-screen functionality.
You're welcome.

2018년 10월 18일 목요일

v1.2.2.21 changelog


  • Removed file buffer reserve requirement.
    Previously, NaraImage had 30% of reserve requirement. It means that the application tried to preload the file to play a sequence smoothly. The reserve requirement was disabled by default, and only will be enabled while playing.
  • Embellished the look - Changes are very subtle.
    • Added border lines to toolbar.
    • Changed the size of close button on property window.
  • When you want to change the size of the image or the color space, you can double click 'Size' or 'Color' from Properties tab on the sidebar (You can also press F2).



    Now if you double click 'Size', size edit box will have focus, and if you double click 'Color', the color list will have focus. What you double clicked tells what you want to change.

2018년 10월 17일 수요일

changelog 1.2.2.20


  • Added RGB 10-bit.
  • Added BGR 10-bit.
  • Fixed a bug
    • Previous version didn't show the rightmost column of the image. This bug has existed since version 1.2.2.19.
    • Close button now has the border like the main window does.
    Do you see the border on a toolbar and a close button?
    • The last row of the image had been seen - I don't even know from when this existed. Fixed it anyway.
    • Last version couldn't check the version from website properly. compiler was too smart so that it removed the code for speed up. 'volatile' solved the problem. I hope nobody downloaded the last version.

2018년 10월 15일 월요일

changelog 1.2.2.18


NaraImage was updated to v1.2.2.18 on 15 Oct 2018.
  • Added a description to AA (anti-aliasing) button.
    Anti-aliasing is the technique used to smooth out jagged edges, which occur when the display size is smaller than the actual size, by blending the color of an edge with the color of pixels around it.
    It requires extra filtering processes, thus, it can cause lagginess.
    When you play the video sequences and it is slow, please turn Anti-Aliasing off.
  • Changed AboutBox to look much simpler.
  • Added "more info" button to open homepage.
  • Changed the color of the zoom button on a toolbar.
    Now the color does not change (it used to change when the mouse hovers and the button is clicked).
  • Cursor does not change to I-Beam style on a disabled edit button.
    Zoom button on a toolbar is disabled when no images are selected. 

2018년 10월 8일 월요일

NaraImage - Selections

There are two ways to select an area in NaraImage.

  1. Press 'S' to enter selection mode, click-and-drag to make a select region, then press 'ESC' to end selection mode.
  2. Drag while pressing shift key
Right-click in a selection to see what we can do with a selection.




If you want to change the size of the selection, drag a selection border.
If you want to move a selection, click-and-drag the center of the selection.
(you can see that mouse cursor changes when you move your cursor to the center of the selection area).
You can modify a selection manually by selecting 'Edit Selection'.


 There are 4 edit boxes that represent x and y coordinates of left, top, right, and bottom sides of a selection.

If you want to export a selection to other formats, select 'Export' in the menu.
(Or, press Ctrl+E).
Learn 'Export'.

2018년 10월 3일 수요일

NaraImage - Export

You can export an image as PNG, raw YUV, or raw RGB file.
Press Ctrl+E to export. 


You can export a whole image or a part of the image. Use selection to export a part of the image (Learn 'Selection').

2018년 9월 26일 수요일

[MFC] 인터넷 페이지 열기

1. 디폴트 브라우저로 웹페이지 열기
     디폴트 브라우저를 다음과 같이 얻는다.
wchar_t browser[MAX_PATH];
HFILE h = _lcreat("dummy.html", 0);
_lclose(h);
FindExecutable(L"dummy.html", NULL, browser);
DeleteFile(L"dummy.html");

      ShellExecute를 이용해서 url을 연다.
ShellExecute(NULL, L"open", browser, addr, NULL, 0);



2.  OpenURL()로 url 열기
CInternetSession session;
CInternetFile * pFile = (CInternetFile *)session.OpenURL(addr);
      이렇게만 해도 잘 열리지만, OpenURL이 실패할 경우 프로그램이 죽을 수 있다. try를 이용하여 crash를 막자.
CInternetSession session;
CInternetFile * pFile;
try
{
pFile = (CInternetFile *)session.OpenURL(addr);
}
catch(...)
{
return -1;
}

 3.  가장 중요한 것 - 작업이 끝난 후 pFile은 반드시 삭제해줘야 한다. 삭제하지 않으면 메모리 누수가 생긴다.
delete pFile;

2018년 9월 17일 월요일

NaraImage - Comparing images

NaraImage supports up-to-8 panes.
If you select multiple images using ctrl-click (or shift-click), they will show up in different panes.

Press 'd' to see the differences.

NaraImage supports several diff modes - Pixel, Block, Heatmap, and Overlap.
  - Pixel : Pixel-by-pixel comparison. Differences are represented as red dots.
  - Block : Block-by-block comparison. You can change the block size on the toolbar.
  - Heatmap : Pixel-by-pixel heatmap comparison (see above image).
  - Overlap : Two images are shown overlapped. If two images have different color space, this is the only diff mode you can use.

Press 'v' to peek a pixel value.

You can see the coordinates, pixel values, and the differences in the tooltips. Tooltip will be disappear as soon as you release 'v'.

NaraImage - Investigating images

You can zoom in and out by turning your mouse wheel, or by pressing + or -.
Each click, up or down, increases or decreases the zoom factor by 10%.

If you double click the image, it will be 2 times bigger.

If you double click while holding control key, it will zoom 5000%, which is called 'Extreme close-up'.
You can see pixel values directly on the images when you zoom more than 5000%.


There are of course, shortcuts for zooming.
Press '1' to zoom 50%
Press '2' to zoom 100%
Press '3' to zoom 150%
Press '4' to zoom 200%
Press 'z' to enter yourself.


2018년 9월 16일 일요일

NaraImage - Yet Another YUV file viewer

NaraImage v1.2.4

NaraImage is an image viewer which supports YUV/RGB raw files and compressed image formats, such as Bitmap, JPEG, PNG, etc.



Features
  • supports YUV / RGB raw files
  • supports compressed image formats, such as .bmp, .jpg, .png, etc
  • supports pure raw data files (16-bit integer, and float).
  • supports multiple pane (up to 8) to compare images.
  • compares images visually and with PSNR.
  • you can export an image (whole or a part of the image) as PNG or YUV file.
  • provides 6 different color themes.
Operating system
  Unfortunately, NaraImage only supports Windows.

Copyright
  NaraImage is free-software designed by naranicca.

Download