Vergleich zweier Bitmaps

/// <summary>
/// Funktion zum schnellen Vergleich zweier Bitmaps per unsafe-Code
/// im Projekt muss "Erstellen->unsicheren Code zulassen" angewählt sein
/// </summary>
/// <param name="b1"->1. Bitmap</param>
/// <param name="b2"->2. Bitmap</param>
/// <returns>true, wenn gleich, sonst false</returns>
private bool BitmapsAreEqual(Bitmap b1, Bitmap b2)
{
    bool bRetVal = true;

    if ((b1 != null) && (b2 != null))
    {
        BitmapData bmd1 = b1.LockBits(new Rectangle(0, 0, b1.Width, b1.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
        BitmapData bmd2 = b2.LockBits(new Rectangle(0, 0, b2.Width, b2.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);

        int cnt_px = b1.Width * b2.Height;

        unsafe
        {
            byte* p1 = (byte*)bmd1.Scan0;
            byte* p2 = (byte*)bmd2.Scan0;

            for (int i = 0; i < cnt_px; i++)
            {
                if (p1[i] != p2[i])
                {
                    bRetVal = false;
                    break;
                }
            }
        }

        b1.UnlockBits(bmd1);
        b2.UnlockBits(bmd2);
    }
    else
    {
        bRetVal = false;
    }

    return bRetVal;
}