Monthly Archives: October 2008

H.264 HRD simulator

It might be easier to read H.264 standard Annex C (Hypothetical Reference Decoder) compared to ISO/IEC 13818-2 Annex C (MPEG-2 VBV), but it’s quite difficult to understand why it’s defined in this way. What’s the purpose of initial_cpb_removal_delay_offset? I could … Continue reading

Posted in Video | Leave a comment

Windows Debugging with CDB / NTSD

I’m writing an article about Windows Debugging with CDB / NTSD. Here is the early draft version. Comments are welcome. Windows Debugging with CDB / NTSD

Posted in Advanced Debugging | Leave a comment

Win32 native monitor is much faster than boost

Windows Vista (finally!) introduced APIs to build a monitor object.http://msdn2.microsoft.com/en-us/library/ms683469.aspx So, how’s performance? Let’s benchmark it. I wrote two bounded FIFO classes. One was based on boost threading library (http://www.boost.org/doc/html/thread.html) and the other was based on the new Win32 APIs. … Continue reading

Posted in Optimization | 1 Comment

Non-alignment integer access performance

When you define a structure like this, the integer field is allocated not just after the byte field, but aligned to 4 byte boundary. struct foo{  unsigned char v1;  unsigned int v2;}; It’s because x86 architecture has a performance issue … Continue reading

Posted in Optimization | 2 Comments

Asynchronous Exception Handling

In Windows, you can catch an asynchronous exception (such as an access violation exception) with catch(…) clause. struct Foo {  ~Foo(){    // destructor  }}; try{   Foo foo;   *reinterpret_cast<char*>(0) = 0;}catch(…){    // handle access violation.} However, the behavior differs depends on … Continue reading

Posted in C++ | Leave a comment

std::string is not reference counted

After Visual C++ 6.0, Microsoft has changed the implementation of std::string to non-reference counted object due to threading issues. http://support.microsoft.com/kb/813810 If your in-loop functions take/return std::string object by value, it could be a cause of performance bottle neck. Here is … Continue reading

Posted in C++ | Leave a comment

Implicit null check in object instantiation

When an object with a vtable is instantiated, the vtable is constructed in the allocated buffer. So, what happens if the buffer allocation fails? In the case buffer allocation is done by default allocator, std::bad_alloc() is raised before vtable construction … Continue reading

Posted in C++ | Leave a comment