; Listing generated by Microsoft (R) Optimizing Compiler Version 15.00.21022.08 

	TITLE	c:\Develop\DScaler423a\DScaler\AspectDetect.cpp
	.686P
	.XMM
	include listing.inc
	.model	flat

INCLUDELIB OLDNAMES

PUBLIC	?RatioStatistics@@3PAUTRatioStatistics@@A	; RatioStatistics
PUBLIC	?nNbRatioSwitch@@3HA				; nNbRatioSwitch
PUBLIC	?nARInitialTicks@@3HA				; nARInitialTicks
PUBLIC	?nARLastTicks@@3HA				; nARLastTicks
PUBLIC	??_C@_1DG@KJENAICD@?$AAS?$AAw?$AAi?$AAt?$AAc?$AAh?$AAi?$AAn?$AAg?$AA?5?$AAt?$AAo?$AA?5?$AAr?$AAa?$AAt?$AAi?$AAo?$AA?5?$AA?$CF?$AAd?$AA?5?$AA?$CI?$AA?$CF?$AAd?$AA?$CJ?$AA?$AA@ ; `string'
PUBLIC	??_C@_1EI@LEFJMILC@?$AAC?$AAo?$AAu?$AAn?$AAt?$AA?5?$AA?$CF?$AAd?$AA?5?$AAm?$AAi?$AAn?$AA?5?$AA?$CF?$AAd?$AA?5?$AAm?$AAa?$AAx?$AA?5?$AA?$CF?$AAd?$AA?5?$AAl?$AAu?$AAm?$AAt?$AAh?$AAr?$AAe?$AAs?$AAh@ ; `string'
PUBLIC	??_C@_1EC@FHHPGBEN@?$AAF?$AAi?$AAn?$AAd?$AAE?$AAd?$AAg?$AAe?$AAO?$AAf?$AAI?$AAm?$AAa?$AAg?$AAe?$AA?5?$AAl?$AAi?$AAn?$AAe?$AA?5?$AA?$CF?$AAd?$AA?5?$AAC?$AAo?$AAu?$AAn?$AAt?$AA?5?$AA?$CF?$AAd@ ; `string'
PUBLIC	??_C@_1GC@NPILCMCN@?$AAS?$AAa?$AAn?$AAi?$AAt?$AAy?$AA?5?$AAc?$AAh?$AAe?$AAc?$AAk?$AA?5?$AAf?$AAa?$AAi?$AAl?$AAe?$AAd?$AA?$DL?$AA?5?$AAs?$AAc?$AAa?$AAn?$AAn?$AAe?$AAd?$AA?5?$AAp?$AAa?$AAs@ ; `string'
PUBLIC	??_C@_1DK@EKJPJJJB@?$AAt?$AAo?$AAp?$AA?5?$AA?$CF?$AAd?$AA?5?$AAb?$AAo?$AAt?$AA?5?$AA?$CF?$AAd?$AA?5?$AAb?$AAo?$AAr?$AAd?$AA?5?$AA?$CF?$AAd?$AA?5?$AAr?$AAa?$AAt?$AA?5?$AA?$CF?$AAd?$AA?$AA@ ; `string'
EXTRN	_memmove:PROC
EXTRN	__imp__GetTickCount@0:PROC
?RatioStatistics@@3PAUTRatioStatistics@@A DB 0140H DUP (?) ; RatioStatistics
_min_ratio_tick_count DD 01H DUP (?)
?nNbRatioSwitch@@3HA DD 01H DUP (?)			; nNbRatioSwitch
?nARLastTicks@@3HA DD 01H DUP (?)			; nARLastTicks
;	COMDAT ?lastNewRatio@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA
_BSS	SEGMENT
?lastNewRatio@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA DD 01H DUP (?) ; `AdjustAspectRatio'::`2'::lastNewRatio
_BSS	ENDS
;	COMDAT ?newRatioFrameCount@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA
_BSS	SEGMENT
?newRatioFrameCount@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA DD 01H DUP (?) ; `AdjustAspectRatio'::`2'::newRatioFrameCount
_BSS	ENDS
;	COMDAT ?newRatioFrameCount2@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA
_BSS	SEGMENT
?newRatioFrameCount2@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA DD 01H DUP (?) ; `AdjustAspectRatio'::`2'::newRatioFrameCount2
;	COMDAT ?LastSourceAspectAdjust@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4JA
_DATA	SEGMENT
?LastSourceAspectAdjust@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4JA DD 0ffffffffH ; `AdjustAspectRatio'::`2'::LastSourceAspectAdjust
_DATA	ENDS
;	COMDAT ??_C@_1DK@EKJPJJJB@?$AAt?$AAo?$AAp?$AA?5?$AA?$CF?$AAd?$AA?5?$AAb?$AAo?$AAt?$AA?5?$AA?$CF?$AAd?$AA?5?$AAb?$AAo?$AAr?$AAd?$AA?5?$AA?$CF?$AAd?$AA?5?$AAr?$AAa?$AAt?$AA?5?$AA?$CF?$AAd?$AA?$AA@
CONST	SEGMENT
??_C@_1DK@EKJPJJJB@?$AAt?$AAo?$AAp?$AA?5?$AA?$CF?$AAd?$AA?5?$AAb?$AAo?$AAt?$AA?5?$AA?$CF?$AAd?$AA?5?$AAb?$AAo?$AAr?$AAd?$AA?5?$AA?$CF?$AAd?$AA?5?$AAr?$AAa?$AAt?$AA?5?$AA?$CF?$AAd?$AA?$AA@ DB 't'
	DB	00H, 'o', 00H, 'p', 00H, ' ', 00H, '%', 00H, 'd', 00H, ' ', 00H
	DB	'b', 00H, 'o', 00H, 't', 00H, ' ', 00H, '%', 00H, 'd', 00H, ' '
	DB	00H, 'b', 00H, 'o', 00H, 'r', 00H, 'd', 00H, ' ', 00H, '%', 00H
	DB	'd', 00H, ' ', 00H, 'r', 00H, 'a', 00H, 't', 00H, ' ', 00H, '%'
	DB	00H, 'd', 00H, 00H, 00H			; `string'
CONST	ENDS
;	COMDAT ??_C@_1GC@NPILCMCN@?$AAS?$AAa?$AAn?$AAi?$AAt?$AAy?$AA?5?$AAc?$AAh?$AAe?$AAc?$AAk?$AA?5?$AAf?$AAa?$AAi?$AAl?$AAe?$AAd?$AA?$DL?$AA?5?$AAs?$AAc?$AAa?$AAn?$AAn?$AAe?$AAd?$AA?5?$AAp?$AAa?$AAs@
CONST	SEGMENT
??_C@_1GC@NPILCMCN@?$AAS?$AAa?$AAn?$AAi?$AAt?$AAy?$AA?5?$AAc?$AAh?$AAe?$AAc?$AAk?$AA?5?$AAf?$AAa?$AAi?$AAl?$AAe?$AAd?$AA?$DL?$AA?5?$AAs?$AAc?$AAa?$AAn?$AAn?$AAe?$AAd?$AA?5?$AAp?$AAa?$AAs@ DB 'S'
	DB	00H, 'a', 00H, 'n', 00H, 'i', 00H, 't', 00H, 'y', 00H, ' ', 00H
	DB	'c', 00H, 'h', 00H, 'e', 00H, 'c', 00H, 'k', 00H, ' ', 00H, 'f'
	DB	00H, 'a', 00H, 'i', 00H, 'l', 00H, 'e', 00H, 'd', 00H, ';', 00H
	DB	' ', 00H, 's', 00H, 'c', 00H, 'a', 00H, 'n', 00H, 'n', 00H, 'e'
	DB	00H, 'd', 00H, ' ', 00H, 'p', 00H, 'a', 00H, 's', 00H, 't', 00H
	DB	' ', 00H, 'e', 00H, 'd', 00H, 'g', 00H, 'e', 00H, ' ', 00H, 'o'
	DB	00H, 'f', 00H, ' ', 00H, 's', 00H, 'c', 00H, 'r', 00H, 'e', 00H
	DB	'e', 00H, 'n', 00H, 00H, 00H			; `string'
CONST	ENDS
;	COMDAT ??_C@_1EC@FHHPGBEN@?$AAF?$AAi?$AAn?$AAd?$AAE?$AAd?$AAg?$AAe?$AAO?$AAf?$AAI?$AAm?$AAa?$AAg?$AAe?$AA?5?$AAl?$AAi?$AAn?$AAe?$AA?5?$AA?$CF?$AAd?$AA?5?$AAC?$AAo?$AAu?$AAn?$AAt?$AA?5?$AA?$CF?$AAd@
CONST	SEGMENT
??_C@_1EC@FHHPGBEN@?$AAF?$AAi?$AAn?$AAd?$AAE?$AAd?$AAg?$AAe?$AAO?$AAf?$AAI?$AAm?$AAa?$AAg?$AAe?$AA?5?$AAl?$AAi?$AAn?$AAe?$AA?5?$AA?$CF?$AAd?$AA?5?$AAC?$AAo?$AAu?$AAn?$AAt?$AA?5?$AA?$CF?$AAd@ DB 'F'
	DB	00H, 'i', 00H, 'n', 00H, 'd', 00H, 'E', 00H, 'd', 00H, 'g', 00H
	DB	'e', 00H, 'O', 00H, 'f', 00H, 'I', 00H, 'm', 00H, 'a', 00H, 'g'
	DB	00H, 'e', 00H, ' ', 00H, 'l', 00H, 'i', 00H, 'n', 00H, 'e', 00H
	DB	' ', 00H, '%', 00H, 'd', 00H, ' ', 00H, 'C', 00H, 'o', 00H, 'u'
	DB	00H, 'n', 00H, 't', 00H, ' ', 00H, '%', 00H, 'd', 00H, 00H, 00H ; `string'
CONST	ENDS
;	COMDAT ??_C@_1EI@LEFJMILC@?$AAC?$AAo?$AAu?$AAn?$AAt?$AA?5?$AA?$CF?$AAd?$AA?5?$AAm?$AAi?$AAn?$AA?5?$AA?$CF?$AAd?$AA?5?$AAm?$AAa?$AAx?$AA?5?$AA?$CF?$AAd?$AA?5?$AAl?$AAu?$AAm?$AAt?$AAh?$AAr?$AAe?$AAs?$AAh@
CONST	SEGMENT
??_C@_1EI@LEFJMILC@?$AAC?$AAo?$AAu?$AAn?$AAt?$AA?5?$AA?$CF?$AAd?$AA?5?$AAm?$AAi?$AAn?$AA?5?$AA?$CF?$AAd?$AA?5?$AAm?$AAa?$AAx?$AA?5?$AA?$CF?$AAd?$AA?5?$AAl?$AAu?$AAm?$AAt?$AAh?$AAr?$AAe?$AAs?$AAh@ DB 'C'
	DB	00H, 'o', 00H, 'u', 00H, 'n', 00H, 't', 00H, ' ', 00H, '%', 00H
	DB	'd', 00H, ' ', 00H, 'm', 00H, 'i', 00H, 'n', 00H, ' ', 00H, '%'
	DB	00H, 'd', 00H, ' ', 00H, 'm', 00H, 'a', 00H, 'x', 00H, ' ', 00H
	DB	'%', 00H, 'd', 00H, ' ', 00H, 'l', 00H, 'u', 00H, 'm', 00H, 't'
	DB	00H, 'h', 00H, 'r', 00H, 'e', 00H, 's', 00H, 'h', 00H, ' ', 00H
	DB	'%', 00H, 'd', 00H, 00H, 00H			; `string'
CONST	ENDS
;	COMDAT ??_C@_1DG@KJENAICD@?$AAS?$AAw?$AAi?$AAt?$AAc?$AAh?$AAi?$AAn?$AAg?$AA?5?$AAt?$AAo?$AA?5?$AAr?$AAa?$AAt?$AAi?$AAo?$AA?5?$AA?$CF?$AAd?$AA?5?$AA?$CI?$AA?$CF?$AAd?$AA?$CJ?$AA?$AA@
CONST	SEGMENT
??_C@_1DG@KJENAICD@?$AAS?$AAw?$AAi?$AAt?$AAc?$AAh?$AAi?$AAn?$AAg?$AA?5?$AAt?$AAo?$AA?5?$AAr?$AAa?$AAt?$AAi?$AAo?$AA?5?$AA?$CF?$AAd?$AA?5?$AA?$CI?$AA?$CF?$AAd?$AA?$CJ?$AA?$AA@ DB 'S'
	DB	00H, 'w', 00H, 'i', 00H, 't', 00H, 'c', 00H, 'h', 00H, 'i', 00H
	DB	'n', 00H, 'g', 00H, ' ', 00H, 't', 00H, 'o', 00H, ' ', 00H, 'r'
	DB	00H, 'a', 00H, 't', 00H, 'i', 00H, 'o', 00H, ' ', 00H, '%', 00H
	DB	'd', 00H, ' ', 00H, '(', 00H, '%', 00H, 'd', 00H, ')', 00H, 00H
	DB	00H						; `string'
?nARInitialTicks@@3HA DD 0ffffffffH			; nARInitialTicks
PUBLIC	?ResetARStats@@YAXXZ				; ResetARStats
; Function compile flags: /Odtp
; File c:\develop\dscaler423a\dscaler\aspectdetect.cpp
;	COMDAT ?ResetARStats@@YAXXZ
_TEXT	SEGMENT
_i$141195 = -8						; size = 4
_now$ = -4						; size = 4
?ResetARStats@@YAXXZ PROC				; ResetARStats, COMDAT

; 81   : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 08	 sub	 esp, 8

; 82   :     int now = GetTickCount();

  00006	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__GetTickCount@0
  0000c	89 45 fc	 mov	 DWORD PTR _now$[ebp], eax

; 83   :     for (int i=0 ; i<MAX_RATIO_STATISTICS ; i++)

  0000f	c7 45 f8 00 00
	00 00		 mov	 DWORD PTR _i$141195[ebp], 0
  00016	eb 09		 jmp	 SHORT $LN3@ResetARSta
$LN2@ResetARSta:
  00018	8b 45 f8	 mov	 eax, DWORD PTR _i$141195[ebp]
  0001b	83 c0 01	 add	 eax, 1
  0001e	89 45 f8	 mov	 DWORD PTR _i$141195[ebp], eax
$LN3@ResetARSta:
  00021	83 7d f8 14	 cmp	 DWORD PTR _i$141195[ebp], 20 ; 00000014H
  00025	7d 42		 jge	 SHORT $LN1@ResetARSta

; 84   :     {
; 85   :         RatioStatistics[i].mode = -1;

  00027	8b 4d f8	 mov	 ecx, DWORD PTR _i$141195[ebp]
  0002a	c1 e1 04	 shl	 ecx, 4
  0002d	c7 81 00 00 00
	00 ff ff ff ff	 mov	 DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[ecx], -1

; 86   :         RatioStatistics[i].ratio = -1;

  00037	8b 55 f8	 mov	 edx, DWORD PTR _i$141195[ebp]
  0003a	c1 e2 04	 shl	 edx, 4
  0003d	c7 82 04 00 00
	00 ff ff ff ff	 mov	 DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[edx+4], -1

; 87   :         RatioStatistics[i].switch_count = 0;

  00047	8b 45 f8	 mov	 eax, DWORD PTR _i$141195[ebp]
  0004a	c1 e0 04	 shl	 eax, 4
  0004d	c7 80 08 00 00
	00 00 00 00 00	 mov	 DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[eax+8], 0

; 88   :         RatioStatistics[i].ticks = 0;

  00057	8b 4d f8	 mov	 ecx, DWORD PTR _i$141195[ebp]
  0005a	c1 e1 04	 shl	 ecx, 4
  0005d	c7 81 0c 00 00
	00 00 00 00 00	 mov	 DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[ecx+12], 0

; 89   :     }

  00067	eb af		 jmp	 SHORT $LN2@ResetARSta
$LN1@ResetARSta:

; 90   :     nARInitialTicks = now;

  00069	8b 55 fc	 mov	 edx, DWORD PTR _now$[ebp]
  0006c	89 15 00 00 00
	00		 mov	 DWORD PTR ?nARInitialTicks@@3HA, edx ; nARInitialTicks

; 91   :     nARLastTicks = now;

  00072	8b 45 fc	 mov	 eax, DWORD PTR _now$[ebp]
  00075	a3 00 00 00 00	 mov	 DWORD PTR ?nARLastTicks@@3HA, eax ; nARLastTicks

; 92   :     RatioStatistics[0].mode = AspectSettings.AspectMode;

  0007a	8b 0d 08 00 00
	00		 mov	 ecx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+8
  00080	89 0d 00 00 00
	00		 mov	 DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A, ecx

; 93   :     RatioStatistics[0].ratio = AspectSettings.SourceAspect;

  00086	8b 15 00 00 00
	00		 mov	 edx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A
  0008c	89 15 04 00 00
	00		 mov	 DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A+4, edx

; 94   :     RatioStatistics[0].switch_count = 1;

  00092	c7 05 08 00 00
	00 01 00 00 00	 mov	 DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A+8, 1

; 95   :     nNbRatioSwitch = 1;

  0009c	c7 05 00 00 00
	00 01 00 00 00	 mov	 DWORD PTR ?nNbRatioSwitch@@3HA, 1 ; nNbRatioSwitch

; 96   : }

  000a6	8b e5		 mov	 esp, ebp
  000a8	5d		 pop	 ebp
  000a9	c3		 ret	 0
?ResetARStats@@YAXXZ ENDP				; ResetARStats
EXTRN	__allshr:PROC
EXTRN	__allshl:PROC
; Function compile flags: /Odtp
;	COMDAT ?GetNonBlackCount@@YAHPAEHH@Z
_TEXT	SEGMENT
_chromaMax$ = -76					; size = 4
_totals$ = -72						; size = 8
_OneMask$ = -64						; size = 8
_threshold$ = -52					; size = 4
_chromaMaxes$ = -48					; size = 8
_counts$ = -40						; size = 4
_qwordCount$ = -36					; size = 4
_chromaMins$ = -32					; size = 8
_YMask$ = -24						; size = 8
_luminances$ = -16					; size = 8
_chromaMin$ = -4					; size = 4
_Line$ = 8						; size = 4
_StartX$ = 12						; size = 4
_EndX$ = 16						; size = 4
?GetNonBlackCount@@YAHPAEHH@Z PROC			; GetNonBlackCount, COMDAT

; 202  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 4c	 sub	 esp, 76			; 0000004cH
  00006	56		 push	 esi
  00007	57		 push	 edi

; 203  :     int qwordCount = (EndX - StartX) / 4;

  00008	8b 45 10	 mov	 eax, DWORD PTR _EndX$[ebp]
  0000b	2b 45 0c	 sub	 eax, DWORD PTR _StartX$[ebp]
  0000e	99		 cdq
  0000f	83 e2 03	 and	 edx, 3
  00012	03 c2		 add	 eax, edx
  00014	c1 f8 02	 sar	 eax, 2
  00017	89 45 dc	 mov	 DWORD PTR _qwordCount$[ebp], eax

; 204  :     int threshold;
; 205  :     int counts;
; 206  :     __int64 luminances;
; 207  :     __int64 chromaMins;
; 208  :     __int64 chromaMaxes;
; 209  :     __int64 totals;
; 210  :     const __int64 YMask = 0x00FF00FF00FF00FF;

  0001a	c7 45 e8 ff 00
	ff 00		 mov	 DWORD PTR _YMask$[ebp], 16711935 ; 00ff00ffH
  00021	c7 45 ec ff 00
	ff 00		 mov	 DWORD PTR _YMask$[ebp+4], 16711935 ; 00ff00ffH

; 211  :     const __int64 OneMask = 0x0001000100010001;

  00028	c7 45 c0 01 00
	01 00		 mov	 DWORD PTR _OneMask$[ebp], 65537 ; 00010001H
  0002f	c7 45 c4 01 00
	01 00		 mov	 DWORD PTR _OneMask$[ebp+4], 65537 ; 00010001H

; 212  :     int chromaMin, chromaMax;
; 213  : 
; 214  :     if (qwordCount <= 0)

  00036	83 7d dc 00	 cmp	 DWORD PTR _qwordCount$[ebp], 0
  0003a	7f 07		 jg	 SHORT $LN4@GetNonBlac

; 215  :     {
; 216  :         return 0;

  0003c	33 c0		 xor	 eax, eax
  0003e	e9 f4 01 00 00	 jmp	 $LN5@GetNonBlac
$LN4@GetNonBlac:

; 217  :     }
; 218  : 
; 219  :     // Black pixels are U=128 and V=128.  If U or V is significantly
; 220  :     // different from 128, it's a different color, e.g. green if
; 221  :     // they're both 0.  We compare each U and V Value to the chroma
; 222  :     // min and max computed here: if ((chroma - chromaMin) > chromaMax)...
; 223  :     chromaMax = AspectSettings.ChromaRange;

  00043	a1 18 00 00 00	 mov	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+24
  00048	89 45 b4	 mov	 DWORD PTR _chromaMax$[ebp], eax

; 224  :     if (chromaMax > 255)

  0004b	81 7d b4 ff 00
	00 00		 cmp	 DWORD PTR _chromaMax$[ebp], 255 ; 000000ffH
  00052	7e 07		 jle	 SHORT $LN3@GetNonBlac

; 225  :         chromaMax = 255;

  00054	c7 45 b4 ff 00
	00 00		 mov	 DWORD PTR _chromaMax$[ebp], 255 ; 000000ffH
$LN3@GetNonBlac:

; 226  :     chromaMin = 128 - (chromaMax / 2);

  0005b	8b 45 b4	 mov	 eax, DWORD PTR _chromaMax$[ebp]
  0005e	99		 cdq
  0005f	2b c2		 sub	 eax, edx
  00061	d1 f8		 sar	 eax, 1
  00063	b9 80 00 00 00	 mov	 ecx, 128		; 00000080H
  00068	2b c8		 sub	 ecx, eax
  0006a	89 4d fc	 mov	 DWORD PTR _chromaMin$[ebp], ecx

; 227  : 
; 228  :     threshold = AspectSettings.LuminanceThreshold;

  0006d	8b 15 14 00 00
	00		 mov	 edx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+20
  00073	89 55 cc	 mov	 DWORD PTR _threshold$[ebp], edx

; 229  :     if (threshold > 255)

  00076	81 7d cc ff 00
	00 00		 cmp	 DWORD PTR _threshold$[ebp], 255 ; 000000ffH
  0007d	7e 07		 jle	 SHORT $LN2@GetNonBlac

; 230  :     {
; 231  :         threshold = 255;

  0007f	c7 45 cc ff 00
	00 00		 mov	 DWORD PTR _threshold$[ebp], 255 ; 000000ffH
$LN2@GetNonBlac:

; 232  :     }
; 233  : 
; 234  :     luminances = threshold;

  00086	8b 45 cc	 mov	 eax, DWORD PTR _threshold$[ebp]
  00089	99		 cdq
  0008a	89 45 f0	 mov	 DWORD PTR _luminances$[ebp], eax
  0008d	89 55 f4	 mov	 DWORD PTR _luminances$[ebp+4], edx

; 235  :     luminances |= (luminances << 48) | (luminances << 32) | (luminances << 16);

  00090	8b 45 f0	 mov	 eax, DWORD PTR _luminances$[ebp]
  00093	8b 55 f4	 mov	 edx, DWORD PTR _luminances$[ebp+4]
  00096	b1 30		 mov	 cl, 48			; 00000030H
  00098	e8 00 00 00 00	 call	 __allshl
  0009d	8b f0		 mov	 esi, eax
  0009f	8b fa		 mov	 edi, edx
  000a1	8b 45 f0	 mov	 eax, DWORD PTR _luminances$[ebp]
  000a4	8b 55 f4	 mov	 edx, DWORD PTR _luminances$[ebp+4]
  000a7	b1 20		 mov	 cl, 32			; 00000020H
  000a9	e8 00 00 00 00	 call	 __allshl
  000ae	0b f0		 or	 esi, eax
  000b0	0b fa		 or	 edi, edx
  000b2	8b 45 f0	 mov	 eax, DWORD PTR _luminances$[ebp]
  000b5	8b 55 f4	 mov	 edx, DWORD PTR _luminances$[ebp+4]
  000b8	b1 10		 mov	 cl, 16			; 00000010H
  000ba	e8 00 00 00 00	 call	 __allshl
  000bf	0b f0		 or	 esi, eax
  000c1	0b fa		 or	 edi, edx
  000c3	0b 75 f0	 or	 esi, DWORD PTR _luminances$[ebp]
  000c6	0b 7d f4	 or	 edi, DWORD PTR _luminances$[ebp+4]
  000c9	89 75 f0	 mov	 DWORD PTR _luminances$[ebp], esi
  000cc	89 7d f4	 mov	 DWORD PTR _luminances$[ebp+4], edi

; 236  :     chromaMins = chromaMin;

  000cf	8b 45 fc	 mov	 eax, DWORD PTR _chromaMin$[ebp]
  000d2	99		 cdq
  000d3	89 45 e0	 mov	 DWORD PTR _chromaMins$[ebp], eax
  000d6	89 55 e4	 mov	 DWORD PTR _chromaMins$[ebp+4], edx

; 237  :     chromaMins |= (chromaMins << 48) | (chromaMins << 32) | (chromaMins << 16);

  000d9	8b 45 e0	 mov	 eax, DWORD PTR _chromaMins$[ebp]
  000dc	8b 55 e4	 mov	 edx, DWORD PTR _chromaMins$[ebp+4]
  000df	b1 30		 mov	 cl, 48			; 00000030H
  000e1	e8 00 00 00 00	 call	 __allshl
  000e6	8b f0		 mov	 esi, eax
  000e8	8b fa		 mov	 edi, edx
  000ea	8b 45 e0	 mov	 eax, DWORD PTR _chromaMins$[ebp]
  000ed	8b 55 e4	 mov	 edx, DWORD PTR _chromaMins$[ebp+4]
  000f0	b1 20		 mov	 cl, 32			; 00000020H
  000f2	e8 00 00 00 00	 call	 __allshl
  000f7	0b f0		 or	 esi, eax
  000f9	0b fa		 or	 edi, edx
  000fb	8b 45 e0	 mov	 eax, DWORD PTR _chromaMins$[ebp]
  000fe	8b 55 e4	 mov	 edx, DWORD PTR _chromaMins$[ebp+4]
  00101	b1 10		 mov	 cl, 16			; 00000010H
  00103	e8 00 00 00 00	 call	 __allshl
  00108	0b f0		 or	 esi, eax
  0010a	0b fa		 or	 edi, edx
  0010c	0b 75 e0	 or	 esi, DWORD PTR _chromaMins$[ebp]
  0010f	0b 7d e4	 or	 edi, DWORD PTR _chromaMins$[ebp+4]
  00112	89 75 e0	 mov	 DWORD PTR _chromaMins$[ebp], esi
  00115	89 7d e4	 mov	 DWORD PTR _chromaMins$[ebp+4], edi

; 238  :     chromaMaxes = chromaMax;

  00118	8b 45 b4	 mov	 eax, DWORD PTR _chromaMax$[ebp]
  0011b	99		 cdq
  0011c	89 45 d0	 mov	 DWORD PTR _chromaMaxes$[ebp], eax
  0011f	89 55 d4	 mov	 DWORD PTR _chromaMaxes$[ebp+4], edx

; 239  :     chromaMaxes |= (chromaMaxes << 48) | (chromaMaxes << 32) | (chromaMaxes << 16);

  00122	8b 45 d0	 mov	 eax, DWORD PTR _chromaMaxes$[ebp]
  00125	8b 55 d4	 mov	 edx, DWORD PTR _chromaMaxes$[ebp+4]
  00128	b1 30		 mov	 cl, 48			; 00000030H
  0012a	e8 00 00 00 00	 call	 __allshl
  0012f	8b f0		 mov	 esi, eax
  00131	8b fa		 mov	 edi, edx
  00133	8b 45 d0	 mov	 eax, DWORD PTR _chromaMaxes$[ebp]
  00136	8b 55 d4	 mov	 edx, DWORD PTR _chromaMaxes$[ebp+4]
  00139	b1 20		 mov	 cl, 32			; 00000020H
  0013b	e8 00 00 00 00	 call	 __allshl
  00140	0b f0		 or	 esi, eax
  00142	0b fa		 or	 edi, edx
  00144	8b 45 d0	 mov	 eax, DWORD PTR _chromaMaxes$[ebp]
  00147	8b 55 d4	 mov	 edx, DWORD PTR _chromaMaxes$[ebp+4]
  0014a	b1 10		 mov	 cl, 16			; 00000010H
  0014c	e8 00 00 00 00	 call	 __allshl
  00151	0b f0		 or	 esi, eax
  00153	0b fa		 or	 edi, edx
  00155	0b 75 d0	 or	 esi, DWORD PTR _chromaMaxes$[ebp]
  00158	0b 7d d4	 or	 edi, DWORD PTR _chromaMaxes$[ebp+4]
  0015b	89 75 d0	 mov	 DWORD PTR _chromaMaxes$[ebp], esi
  0015e	89 7d d4	 mov	 DWORD PTR _chromaMaxes$[ebp+4], edi

; 240  : 
; 241  :     // Start on a 16-byte boundary even if it means ignoring some extra
; 242  :     // pixels?  Try not doing it for now, but it could make memory access
; 243  :     // more efficient.
; 244  : 
; 245  :     Line += StartX * 2;

  00161	8b 45 0c	 mov	 eax, DWORD PTR _StartX$[ebp]
  00164	8b 4d 08	 mov	 ecx, DWORD PTR _Line$[ebp]
  00167	8d 14 41	 lea	 edx, DWORD PTR [ecx+eax*2]
  0016a	89 55 08	 mov	 DWORD PTR _Line$[ebp], edx

; 246  : 
; 247  :     _asm {
; 248  :         mov     ecx, qwordCount

  0016d	8b 4d dc	 mov	 ecx, DWORD PTR _qwordCount$[ebp]

; 249  :         mov     eax, dword ptr[Line]

  00170	8b 45 08	 mov	 eax, DWORD PTR _Line$[ebp]

; 250  :         movq    mm1, YMask

  00173	0f 6f 4d e8	 movq	 mm1, MMWORD PTR _YMask$[ebp]

; 251  :         movq    mm2, luminances

  00177	0f 6f 55 f0	 movq	 mm2, MMWORD PTR _luminances$[ebp]

; 252  :         movq    mm3, OneMask

  0017b	0f 6f 5d c0	 movq	 mm3, MMWORD PTR _OneMask$[ebp]

; 253  :         pxor    mm4, mm4            // mm4 = pixel counts, one Count in each word

  0017f	0f ef e4	 pxor	 mm4, mm4

; 254  :         movq    mm6, chromaMins

  00182	0f 6f 75 e0	 movq	 mm6, MMWORD PTR _chromaMins$[ebp]

; 255  :         movq    mm7, chromaMaxes

  00186	0f 6f 7d d0	 movq	 mm7, MMWORD PTR _chromaMaxes$[ebp]
$BlackLoop$141240:

; 256  : 
; 257  : BlackLoop:
; 258  :         movq    mm0, qword ptr[eax] // mm0 = next 4 pixels

  0018a	0f 6f 00	 movq	 mm0, MMWORD PTR [eax]

; 259  :         movq    mm5, mm0

  0018d	0f 7f c5	 movq	 mm5, mm0

; 260  :         psrlw   mm5, 8              // mm5 = chroma values in lower 8 bits of each word

  00190	0f 71 d5 08	 psrlw	 mm5, 8

; 261  :         pand    mm0, mm1            // mm0 = luminance values in lower 8 bits of each word

  00194	0f db c1	 pand	 mm0, mm1

; 262  :         pcmpgtw mm0, mm2            // mm0 = 0xFFFF where luminance > threshold

  00197	0f 65 c2	 pcmpgtw mm0, mm2

; 263  :         psubw   mm5, mm6            // mm5 = chroma - chromaMin

  0019a	0f f9 ee	 psubw	 mm5, mm6

; 264  :         pand    mm5, mm1            // mm5 = lower 8 bits of (chroma - chromaMin); <0 becomes positive

  0019d	0f db e9	 pand	 mm5, mm1

; 265  :         pcmpgtw mm5, mm7            // mm5 = 0xFFFF where chroma < chromaMin or chroma > chromaMax

  001a0	0f 65 ef	 pcmpgtw mm5, mm7

; 266  :         por     mm0, mm5            // mm0 = 0xFFFF where U, V, or Y is past threshold

  001a3	0f eb c5	 por	 mm0, mm5

; 267  :         pand    mm0, mm3            // Translate that into 1 for exceed, 0 for not, in each word

  001a6	0f db c3	 pand	 mm0, mm3

; 268  :         paddw   mm4, mm0            // And add up the ones, maintaining four separate counts

  001a9	0f fd e0	 paddw	 mm4, mm0

; 269  :         add     eax, 8              // Next qword

  001ac	83 c0 08	 add	 eax, 8

; 270  :         loop    BlackLoop

  001af	e2 d9		 loop	 $BlackLoop$141240

; 271  : 
; 272  :         movq    totals, mm4            // Save totals so C code can deal with them

  001b1	0f 7f 65 b8	 movq	 MMWORD PTR _totals$[ebp], mm4

; 273  :         emms

  001b5	0f 77		 emms

; 274  :     }
; 275  : 
; 276  :     // Add up the four totals (each in one word of the _T("totals") qword) to
; 277  :     // get the total overall count.
; 278  :     counts = (int)(totals & 0xffff) +
; 279  :              (int)((totals >> 16) & 0xffff) +
; 280  :              (int)((totals >> 32) & 0xffff) +
; 281  :              (int)((totals >> 48) & 0xffff);

  001b7	8b 45 b8	 mov	 eax, DWORD PTR _totals$[ebp]
  001ba	25 ff ff 00 00	 and	 eax, 65535		; 0000ffffH
  001bf	8b 4d bc	 mov	 ecx, DWORD PTR _totals$[ebp+4]
  001c2	83 e1 00	 and	 ecx, 0
  001c5	8b f0		 mov	 esi, eax
  001c7	8b 45 b8	 mov	 eax, DWORD PTR _totals$[ebp]
  001ca	8b 55 bc	 mov	 edx, DWORD PTR _totals$[ebp+4]
  001cd	b1 10		 mov	 cl, 16			; 00000010H
  001cf	e8 00 00 00 00	 call	 __allshr
  001d4	25 ff ff 00 00	 and	 eax, 65535		; 0000ffffH
  001d9	83 e2 00	 and	 edx, 0
  001dc	03 f0		 add	 esi, eax
  001de	8b 45 b8	 mov	 eax, DWORD PTR _totals$[ebp]
  001e1	8b 55 bc	 mov	 edx, DWORD PTR _totals$[ebp+4]
  001e4	b1 20		 mov	 cl, 32			; 00000020H
  001e6	e8 00 00 00 00	 call	 __allshr
  001eb	25 ff ff 00 00	 and	 eax, 65535		; 0000ffffH
  001f0	83 e2 00	 and	 edx, 0
  001f3	03 f0		 add	 esi, eax
  001f5	8b 45 b8	 mov	 eax, DWORD PTR _totals$[ebp]
  001f8	8b 55 bc	 mov	 edx, DWORD PTR _totals$[ebp+4]
  001fb	b1 30		 mov	 cl, 48			; 00000030H
  001fd	e8 00 00 00 00	 call	 __allshr
  00202	25 ff ff 00 00	 and	 eax, 65535		; 0000ffffH
  00207	83 e2 00	 and	 edx, 0
  0020a	03 f0		 add	 esi, eax
  0020c	89 75 d8	 mov	 DWORD PTR _counts$[ebp], esi

; 282  : 
; 283  :     //
; 284  :     // Log the offending pixels
; 285  :     if (counts > 0)

  0020f	83 7d d8 00	 cmp	 DWORD PTR _counts$[ebp], 0
  00213	7e 1f		 jle	 SHORT $LN1@GetNonBlac

; 286  :     {
; 287  :         LOG(3, _T("Count %d min %d max %d lumthresh %d"), counts, chromaMin, chromaMax, threshold);

  00215	8b 55 cc	 mov	 edx, DWORD PTR _threshold$[ebp]
  00218	52		 push	 edx
  00219	8b 45 b4	 mov	 eax, DWORD PTR _chromaMax$[ebp]
  0021c	50		 push	 eax
  0021d	8b 4d fc	 mov	 ecx, DWORD PTR _chromaMin$[ebp]
  00220	51		 push	 ecx
  00221	8b 55 d8	 mov	 edx, DWORD PTR _counts$[ebp]
  00224	52		 push	 edx
  00225	68 00 00 00 00	 push	 OFFSET ??_C@_1EI@LEFJMILC@?$AAC?$AAo?$AAu?$AAn?$AAt?$AA?5?$AA?$CF?$AAd?$AA?5?$AAm?$AAi?$AAn?$AA?5?$AA?$CF?$AAd?$AA?5?$AAm?$AAa?$AAx?$AA?5?$AA?$CF?$AAd?$AA?5?$AAl?$AAu?$AAm?$AAt?$AAh?$AAr?$AAe?$AAs?$AAh@
  0022a	6a 03		 push	 3
  0022c	e8 00 00 00 00	 call	 ?LOG@@YAXHPB_WZZ	; LOG
  00231	83 c4 18	 add	 esp, 24			; 00000018H
$LN1@GetNonBlac:

; 288  :     }
; 289  : 
; 290  : 
; 291  :     return counts;

  00234	8b 45 d8	 mov	 eax, DWORD PTR _counts$[ebp]
$LN5@GetNonBlac:

; 292  : }

  00237	5f		 pop	 edi
  00238	5e		 pop	 esi
  00239	8b e5		 mov	 esp, ebp
  0023b	5d		 pop	 ebp
  0023c	c3		 ret	 0
?GetNonBlackCount@@YAHPAEHH@Z ENDP			; GetNonBlackCount
PUBLIC	?FindEdgeOfImage@@YAHPAUTDeinterlaceInfo@@H@Z	; FindEdgeOfImage
; Function compile flags: /Odtp
;	COMDAT ?FindEdgeOfImage@@YAHPAUTDeinterlaceInfo@@H@Z
_TEXT	SEGMENT
tv149 = -28						; size = 4
_skipCountPercent$ = -24				; size = 4
_skipCount$ = -20					; size = 4
_ylimit$ = -16						; size = 4
_line$ = -12						; size = 4
_pixelCount$ = -8					; size = 4
_y$ = -4						; size = 4
_pInfo$ = 8						; size = 4
_direction$ = 12					; size = 4
?FindEdgeOfImage@@YAHPAUTDeinterlaceInfo@@H@Z PROC	; FindEdgeOfImage, COMDAT

; 349  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 1c	 sub	 esp, 28			; 0000001cH

; 350  :     int y, ylimit;
; 351  :     BYTE* line;
; 352  :     int skipCount = 0;

  00006	c7 45 ec 00 00
	00 00		 mov	 DWORD PTR _skipCount$[ebp], 0

; 353  :     int skipCountPercent = AspectSettings.SkipPercent;

  0000d	a1 24 00 00 00	 mov	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+36
  00012	89 45 e8	 mov	 DWORD PTR _skipCountPercent$[ebp], eax

; 354  :     int pixelCount;
; 355  : 
; 356  :     skipCount = (pInfo->FrameWidth * AspectSettings.SkipPercent / 100) +
; 357  :                 AspectSettings.InitialLeftOverscan;

  00015	8b 4d 08	 mov	 ecx, DWORD PTR _pInfo$[ebp]
  00018	8b 41 4c	 mov	 eax, DWORD PTR [ecx+76]
  0001b	0f af 05 24 00
	00 00		 imul	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+36
  00022	99		 cdq
  00023	b9 64 00 00 00	 mov	 ecx, 100		; 00000064H
  00028	f7 f9		 idiv	 ecx
  0002a	03 05 8c 00 00
	00		 add	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+140
  00030	89 45 ec	 mov	 DWORD PTR _skipCount$[ebp], eax

; 358  : 
; 359  :     // Decide whether we're scanning from the top or bottom
; 360  :     if (direction < 0)

  00033	83 7d 0c 00	 cmp	 DWORD PTR _direction$[ebp], 0
  00037	7d 25		 jge	 SHORT $LN11@FindEdgeOf

; 361  :     {
; 362  :         y = pInfo->FrameHeight - 1 - AspectSettings.InitialBottomOverscan;  // from bottom

  00039	8b 55 08	 mov	 edx, DWORD PTR _pInfo$[ebp]
  0003c	8b 42 50	 mov	 eax, DWORD PTR [edx+80]
  0003f	83 e8 01	 sub	 eax, 1
  00042	2b 05 88 00 00
	00		 sub	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+136
  00048	89 45 fc	 mov	 DWORD PTR _y$[ebp], eax

; 363  :         ylimit = pInfo->FrameHeight / 2 - 1;

  0004b	8b 4d 08	 mov	 ecx, DWORD PTR _pInfo$[ebp]
  0004e	8b 41 50	 mov	 eax, DWORD PTR [ecx+80]
  00051	99		 cdq
  00052	2b c2		 sub	 eax, edx
  00054	d1 f8		 sar	 eax, 1
  00056	83 e8 01	 sub	 eax, 1
  00059	89 45 f0	 mov	 DWORD PTR _ylimit$[ebp], eax

; 364  :     }
; 365  :     else

  0005c	eb 17		 jmp	 SHORT $LN10@FindEdgeOf
$LN11@FindEdgeOf:

; 366  :     {
; 367  :         y = AspectSettings.InitialTopOverscan; // from top

  0005e	8b 15 84 00 00
	00		 mov	 edx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+132
  00064	89 55 fc	 mov	 DWORD PTR _y$[ebp], edx

; 368  :         ylimit = pInfo->FrameHeight / 2;

  00067	8b 45 08	 mov	 eax, DWORD PTR _pInfo$[ebp]
  0006a	8b 40 50	 mov	 eax, DWORD PTR [eax+80]
  0006d	99		 cdq
  0006e	2b c2		 sub	 eax, edx
  00070	d1 f8		 sar	 eax, 1
  00072	89 45 f0	 mov	 DWORD PTR _ylimit$[ebp], eax
$LN10@FindEdgeOf:

; 369  :     }
; 370  : 
; 371  :     for (; y != ylimit; y += direction)

  00075	eb 09		 jmp	 SHORT $LN9@FindEdgeOf
$LN8@FindEdgeOf:
  00077	8b 4d fc	 mov	 ecx, DWORD PTR _y$[ebp]
  0007a	03 4d 0c	 add	 ecx, DWORD PTR _direction$[ebp]
  0007d	89 4d fc	 mov	 DWORD PTR _y$[ebp], ecx
$LN9@FindEdgeOf:
  00080	8b 55 fc	 mov	 edx, DWORD PTR _y$[ebp]
  00083	3b 55 f0	 cmp	 edx, DWORD PTR _ylimit$[ebp]
  00086	0f 84 df 00 00
	00		 je	 $LN7@FindEdgeOf

; 372  :     {
; 373  :         if (y & 1)

  0008c	8b 45 fc	 mov	 eax, DWORD PTR _y$[ebp]
  0008f	83 e0 01	 and	 eax, 1
  00092	74 1f		 je	 SHORT $LN6@FindEdgeOf

; 374  :         {
; 375  :             line = pInfo->PictureHistory[0]->pData + pInfo->InputPitch * (y / 2);

  00094	8b 4d 08	 mov	 ecx, DWORD PTR _pInfo$[ebp]
  00097	8b 49 04	 mov	 ecx, DWORD PTR [ecx+4]
  0009a	8b 45 fc	 mov	 eax, DWORD PTR _y$[ebp]
  0009d	99		 cdq
  0009e	2b c2		 sub	 eax, edx
  000a0	d1 f8		 sar	 eax, 1
  000a2	8b 55 08	 mov	 edx, DWORD PTR _pInfo$[ebp]
  000a5	0f af 82 84 00
	00 00		 imul	 eax, DWORD PTR [edx+132]
  000ac	03 01		 add	 eax, DWORD PTR [ecx]
  000ae	89 45 f4	 mov	 DWORD PTR _line$[ebp], eax

; 376  :         }
; 377  :         else

  000b1	eb 1d		 jmp	 SHORT $LN5@FindEdgeOf
$LN6@FindEdgeOf:

; 378  :         {
; 379  :             line = pInfo->PictureHistory[1]->pData + pInfo->InputPitch * (y / 2);

  000b3	8b 45 08	 mov	 eax, DWORD PTR _pInfo$[ebp]
  000b6	8b 48 08	 mov	 ecx, DWORD PTR [eax+8]
  000b9	8b 45 fc	 mov	 eax, DWORD PTR _y$[ebp]
  000bc	99		 cdq
  000bd	2b c2		 sub	 eax, edx
  000bf	d1 f8		 sar	 eax, 1
  000c1	8b 55 08	 mov	 edx, DWORD PTR _pInfo$[ebp]
  000c4	0f af 82 84 00
	00 00		 imul	 eax, DWORD PTR [edx+132]
  000cb	03 01		 add	 eax, DWORD PTR [ecx]
  000cd	89 45 f4	 mov	 DWORD PTR _line$[ebp], eax
$LN5@FindEdgeOf:

; 380  :         }
; 381  : 
; 382  :         pixelCount = GetNonBlackCount(line, skipCount, pInfo->FrameWidth - skipCount * 2);

  000d0	8b 45 ec	 mov	 eax, DWORD PTR _skipCount$[ebp]
  000d3	d1 e0		 shl	 eax, 1
  000d5	8b 4d 08	 mov	 ecx, DWORD PTR _pInfo$[ebp]
  000d8	8b 51 4c	 mov	 edx, DWORD PTR [ecx+76]
  000db	2b d0		 sub	 edx, eax
  000dd	52		 push	 edx
  000de	8b 45 ec	 mov	 eax, DWORD PTR _skipCount$[ebp]
  000e1	50		 push	 eax
  000e2	8b 4d f4	 mov	 ecx, DWORD PTR _line$[ebp]
  000e5	51		 push	 ecx
  000e6	e8 00 00 00 00	 call	 ?GetNonBlackCount@@YAHPAEHH@Z ; GetNonBlackCount
  000eb	83 c4 0c	 add	 esp, 12			; 0000000cH
  000ee	89 45 f8	 mov	 DWORD PTR _pixelCount$[ebp], eax

; 383  :         if (pixelCount > 0)

  000f1	83 7d f8 00	 cmp	 DWORD PTR _pixelCount$[ebp], 0
  000f5	7e 17		 jle	 SHORT $LN4@FindEdgeOf

; 384  :         {
; 385  :             LOG(3, _T("FindEdgeOfImage line %d Count %d"), y, pixelCount);

  000f7	8b 55 f8	 mov	 edx, DWORD PTR _pixelCount$[ebp]
  000fa	52		 push	 edx
  000fb	8b 45 fc	 mov	 eax, DWORD PTR _y$[ebp]
  000fe	50		 push	 eax
  000ff	68 00 00 00 00	 push	 OFFSET ??_C@_1EC@FHHPGBEN@?$AAF?$AAi?$AAn?$AAd?$AAE?$AAd?$AAg?$AAe?$AAO?$AAf?$AAI?$AAm?$AAa?$AAg?$AAe?$AA?5?$AAl?$AAi?$AAn?$AAe?$AA?5?$AA?$CF?$AAd?$AA?5?$AAC?$AAo?$AAu?$AAn?$AAt?$AA?5?$AA?$CF?$AAd@
  00104	6a 03		 push	 3
  00106	e8 00 00 00 00	 call	 ?LOG@@YAXHPB_WZZ	; LOG
  0010b	83 c4 10	 add	 esp, 16			; 00000010H
$LN4@FindEdgeOf:

; 386  :         }
; 387  : 
; 388  :         if (pixelCount > AspectSettings.IgnoreNonBlackPixels)

  0010e	8b 4d f8	 mov	 ecx, DWORD PTR _pixelCount$[ebp]
  00111	3b 0d 20 00 00
	00		 cmp	 ecx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+32
  00117	7e 02		 jle	 SHORT $LN3@FindEdgeOf

; 389  :             break;

  00119	eb 50		 jmp	 SHORT $LN7@FindEdgeOf
$LN3@FindEdgeOf:

; 390  : 
; 391  :         if (y < 0 || y >= pInfo->FrameHeight)

  0011b	83 7d fc 00	 cmp	 DWORD PTR _y$[ebp], 0
  0011f	7c 0b		 jl	 SHORT $LN1@FindEdgeOf
  00121	8b 55 08	 mov	 edx, DWORD PTR _pInfo$[ebp]
  00124	8b 45 fc	 mov	 eax, DWORD PTR _y$[ebp]
  00127	3b 42 50	 cmp	 eax, DWORD PTR [edx+80]
  0012a	7c 3a		 jl	 SHORT $LN2@FindEdgeOf
$LN1@FindEdgeOf:

; 392  :         {
; 393  :             LOG(2, _T("Sanity check failed; scanned past edge of screen"));

  0012c	68 00 00 00 00	 push	 OFFSET ??_C@_1GC@NPILCMCN@?$AAS?$AAa?$AAn?$AAi?$AAt?$AAy?$AA?5?$AAc?$AAh?$AAe?$AAc?$AAk?$AA?5?$AAf?$AAa?$AAi?$AAl?$AAe?$AAd?$AA?$DL?$AA?5?$AAs?$AAc?$AAa?$AAn?$AAn?$AAe?$AAd?$AA?5?$AAp?$AAa?$AAs@
  00131	6a 02		 push	 2
  00133	e8 00 00 00 00	 call	 ?LOG@@YAXHPB_WZZ	; LOG
  00138	83 c4 08	 add	 esp, 8

; 394  :             y = (direction > 0) ? AspectSettings.InitialTopOverscan : pInfo->FrameHeight - 1 - AspectSettings.InitialBottomOverscan;

  0013b	83 7d 0c 00	 cmp	 DWORD PTR _direction$[ebp], 0
  0013f	7e 0b		 jle	 SHORT $LN14@FindEdgeOf
  00141	8b 0d 84 00 00
	00		 mov	 ecx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+132
  00147	89 4d e4	 mov	 DWORD PTR tv149[ebp], ecx
  0014a	eb 12		 jmp	 SHORT $LN15@FindEdgeOf
$LN14@FindEdgeOf:
  0014c	8b 55 08	 mov	 edx, DWORD PTR _pInfo$[ebp]
  0014f	8b 42 50	 mov	 eax, DWORD PTR [edx+80]
  00152	83 e8 01	 sub	 eax, 1
  00155	2b 05 88 00 00
	00		 sub	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+136
  0015b	89 45 e4	 mov	 DWORD PTR tv149[ebp], eax
$LN15@FindEdgeOf:
  0015e	8b 4d e4	 mov	 ecx, DWORD PTR tv149[ebp]
  00161	89 4d fc	 mov	 DWORD PTR _y$[ebp], ecx

; 395  :             break;

  00164	eb 05		 jmp	 SHORT $LN7@FindEdgeOf
$LN2@FindEdgeOf:

; 396  :         }
; 397  :     }

  00166	e9 0c ff ff ff	 jmp	 $LN8@FindEdgeOf
$LN7@FindEdgeOf:

; 398  : 
; 399  :     return y;

  0016b	8b 45 fc	 mov	 eax, DWORD PTR _y$[ebp]

; 400  : }

  0016e	8b e5		 mov	 esp, ebp
  00170	5d		 pop	 ebp
  00171	c3		 ret	 0
?FindEdgeOfImage@@YAHPAUTDeinterlaceInfo@@H@Z ENDP	; FindEdgeOfImage
_TEXT	ENDS
PUBLIC	?SwitchToRatio@@YAXHH@Z				; SwitchToRatio
_ratio_used DD	032H DUP (?)
_ratio_time DD	032H DUP (?)
; Function compile flags: /Odtp
;	COMDAT ?SwitchToRatio@@YAXHH@Z
_TEXT	SEGMENT
_j$ = -16						; size = 4
_k$ = -12						; size = 4
_now$ = -8						; size = 4
_i$ = -4						; size = 4
_nMode$ = 8						; size = 4
_nRatio$ = 12						; size = 4
?SwitchToRatio@@YAXHH@Z PROC				; SwitchToRatio, COMDAT

; 102  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 10	 sub	 esp, 16			; 00000010H

; 103  :     int now = GetTickCount();

  00006	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__GetTickCount@0
  0000c	89 45 f8	 mov	 DWORD PTR _now$[ebp], eax

; 104  :     int i, j, k;
; 105  : 
; 106  :     // Search position of the old and new ratios in the table of AR statistics
; 107  :     j = -1; // j is the position of the old ratio

  0000f	c7 45 f0 ff ff
	ff ff		 mov	 DWORD PTR _j$[ebp], -1

; 108  :     k = -1; // k is the position of the new ratio

  00016	c7 45 f4 ff ff
	ff ff		 mov	 DWORD PTR _k$[ebp], -1

; 109  :     for (i=0 ; i<MAX_RATIO_STATISTICS ; i++)

  0001d	c7 45 fc 00 00
	00 00		 mov	 DWORD PTR _i$[ebp], 0
  00024	eb 09		 jmp	 SHORT $LN13@SwitchToRa
$LN12@SwitchToRa:
  00026	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  00029	83 c0 01	 add	 eax, 1
  0002c	89 45 fc	 mov	 DWORD PTR _i$[ebp], eax
$LN13@SwitchToRa:
  0002f	83 7d fc 14	 cmp	 DWORD PTR _i$[ebp], 20	; 00000014H
  00033	0f 8d a6 00 00
	00		 jge	 $LN11@SwitchToRa

; 110  :     {
; 111  :         if ((RatioStatistics[i].mode == AspectSettings.AspectMode) && (RatioStatistics[i].ratio == AspectSettings.SourceAspect))

  00039	8b 4d fc	 mov	 ecx, DWORD PTR _i$[ebp]
  0003c	c1 e1 04	 shl	 ecx, 4
  0003f	8b 91 00 00 00
	00		 mov	 edx, DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[ecx]
  00045	3b 15 08 00 00
	00		 cmp	 edx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+8
  0004b	75 22		 jne	 SHORT $LN10@SwitchToRa
  0004d	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  00050	c1 e0 04	 shl	 eax, 4
  00053	8b 88 04 00 00
	00		 mov	 ecx, DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[eax+4]
  00059	3b 0d 00 00 00
	00		 cmp	 ecx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A
  0005f	75 0e		 jne	 SHORT $LN10@SwitchToRa

; 112  :         {
; 113  :             j = i;

  00061	8b 55 fc	 mov	 edx, DWORD PTR _i$[ebp]
  00064	89 55 f0	 mov	 DWORD PTR _j$[ebp], edx

; 114  :             if (k != -1)

  00067	83 7d f4 ff	 cmp	 DWORD PTR _k$[ebp], -1
  0006b	74 02		 je	 SHORT $LN10@SwitchToRa

; 115  :             {
; 116  :                 break;

  0006d	eb 70		 jmp	 SHORT $LN11@SwitchToRa
$LN10@SwitchToRa:

; 117  :             }
; 118  :         }
; 119  :         if ((RatioStatistics[i].mode == nMode) && (RatioStatistics[i].ratio == nRatio))

  0006f	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  00072	c1 e0 04	 shl	 eax, 4
  00075	8b 88 00 00 00
	00		 mov	 ecx, DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[eax]
  0007b	3b 4d 08	 cmp	 ecx, DWORD PTR _nMode$[ebp]
  0007e	75 1f		 jne	 SHORT $LN8@SwitchToRa
  00080	8b 55 fc	 mov	 edx, DWORD PTR _i$[ebp]
  00083	c1 e2 04	 shl	 edx, 4
  00086	8b 82 04 00 00
	00		 mov	 eax, DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[edx+4]
  0008c	3b 45 0c	 cmp	 eax, DWORD PTR _nRatio$[ebp]
  0008f	75 0e		 jne	 SHORT $LN8@SwitchToRa

; 120  :         {
; 121  :             k = i;

  00091	8b 4d fc	 mov	 ecx, DWORD PTR _i$[ebp]
  00094	89 4d f4	 mov	 DWORD PTR _k$[ebp], ecx

; 122  :             if (j != -1)

  00097	83 7d f0 ff	 cmp	 DWORD PTR _j$[ebp], -1
  0009b	74 02		 je	 SHORT $LN8@SwitchToRa

; 123  :             {
; 124  :                 break;

  0009d	eb 40		 jmp	 SHORT $LN11@SwitchToRa
$LN8@SwitchToRa:

; 125  :             }
; 126  :         }
; 127  :         if (RatioStatistics[i].switch_count == 0 && k == -1)

  0009f	8b 55 fc	 mov	 edx, DWORD PTR _i$[ebp]
  000a2	c1 e2 04	 shl	 edx, 4
  000a5	83 ba 08 00 00
	00 00		 cmp	 DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[edx+8], 0
  000ac	75 2c		 jne	 SHORT $LN6@SwitchToRa
  000ae	83 7d f4 ff	 cmp	 DWORD PTR _k$[ebp], -1
  000b2	75 26		 jne	 SHORT $LN6@SwitchToRa

; 128  :         {
; 129  :             k = i;

  000b4	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  000b7	89 45 f4	 mov	 DWORD PTR _k$[ebp], eax

; 130  :             RatioStatistics[i].mode = nMode;

  000ba	8b 4d fc	 mov	 ecx, DWORD PTR _i$[ebp]
  000bd	c1 e1 04	 shl	 ecx, 4
  000c0	8b 55 08	 mov	 edx, DWORD PTR _nMode$[ebp]
  000c3	89 91 00 00 00
	00		 mov	 DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[ecx], edx

; 131  :             RatioStatistics[i].ratio = nRatio;

  000c9	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  000cc	c1 e0 04	 shl	 eax, 4
  000cf	8b 4d 0c	 mov	 ecx, DWORD PTR _nRatio$[ebp]
  000d2	89 88 04 00 00
	00		 mov	 DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[eax+4], ecx

; 132  :             break;

  000d8	eb 05		 jmp	 SHORT $LN11@SwitchToRa
$LN6@SwitchToRa:

; 133  :         }
; 134  :     }

  000da	e9 47 ff ff ff	 jmp	 $LN12@SwitchToRa
$LN11@SwitchToRa:

; 135  : 
; 136  :     // Update the ticks for the old ratio
; 137  :     if (j != -1)

  000df	83 7d f0 ff	 cmp	 DWORD PTR _j$[ebp], -1
  000e3	74 21		 je	 SHORT $LN5@SwitchToRa

; 138  :     {
; 139  :         RatioStatistics[j].ticks += now - nARLastTicks;

  000e5	8b 55 f0	 mov	 edx, DWORD PTR _j$[ebp]
  000e8	c1 e2 04	 shl	 edx, 4
  000eb	8b 45 f8	 mov	 eax, DWORD PTR _now$[ebp]
  000ee	2b 05 00 00 00
	00		 sub	 eax, DWORD PTR ?nARLastTicks@@3HA ; nARLastTicks
  000f4	03 82 0c 00 00
	00		 add	 eax, DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[edx+12]
  000fa	8b 4d f0	 mov	 ecx, DWORD PTR _j$[ebp]
  000fd	c1 e1 04	 shl	 ecx, 4
  00100	89 81 0c 00 00
	00		 mov	 DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[ecx+12], eax
$LN5@SwitchToRa:

; 140  :     }
; 141  : 
; 142  :     // Update anamorphic/nonanamorphic status
; 143  :     AspectSettings.AspectMode = nMode;

  00106	8b 55 08	 mov	 edx, DWORD PTR _nMode$[ebp]
  00109	89 15 08 00 00
	00		 mov	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+8, edx

; 144  : 
; 145  :     // Update aspect ratio only if a positive one is specified
; 146  :     if (nRatio > 0)

  0010f	83 7d 0c 00	 cmp	 DWORD PTR _nRatio$[ebp], 0
  00113	7e 5c		 jle	 SHORT $LN4@SwitchToRa

; 147  :     {
; 148  :         // If the most recent ratio switch just happened, don't remember it since it
; 149  :         // was probably a transient ratio due to improperly locking onto a dark scene.
; 150  :         if (now - ratio_time[0] > AspectSettings.ShortRatioIgnoreMs)

  00115	8b 45 f8	 mov	 eax, DWORD PTR _now$[ebp]
  00118	2b 05 00 00 00
	00		 sub	 eax, DWORD PTR _ratio_time
  0011e	3b 05 40 00 00
	00		 cmp	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+64
  00124	7e 2e		 jle	 SHORT $LN3@SwitchToRa

; 151  :         {
; 152  :             memmove(&ratio_used[1], &ratio_used[0], sizeof(ratio_used[0]) * (RATIO_HISTORY_CHANGES - 1));

  00126	68 c4 00 00 00	 push	 196			; 000000c4H
  0012b	68 00 00 00 00	 push	 OFFSET _ratio_used
  00130	68 04 00 00 00	 push	 OFFSET _ratio_used+4
  00135	e8 00 00 00 00	 call	 _memmove
  0013a	83 c4 0c	 add	 esp, 12			; 0000000cH

; 153  :             memmove(&ratio_time[1], &ratio_time[0], sizeof(ratio_time[0]) * (RATIO_HISTORY_CHANGES - 1));

  0013d	68 c4 00 00 00	 push	 196			; 000000c4H
  00142	68 00 00 00 00	 push	 OFFSET _ratio_time
  00147	68 04 00 00 00	 push	 OFFSET _ratio_time+4
  0014c	e8 00 00 00 00	 call	 _memmove
  00151	83 c4 0c	 add	 esp, 12			; 0000000cH
$LN3@SwitchToRa:

; 154  :         }
; 155  : 
; 156  :         ratio_used[0] = nRatio;

  00154	8b 4d 0c	 mov	 ecx, DWORD PTR _nRatio$[ebp]
  00157	89 0d 00 00 00
	00		 mov	 DWORD PTR _ratio_used, ecx

; 157  :         ratio_time[0] = GetTickCount();

  0015d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__GetTickCount@0
  00163	a3 00 00 00 00	 mov	 DWORD PTR _ratio_time, eax

; 158  :         AspectSettings.SourceAspect = nRatio;

  00168	8b 55 0c	 mov	 edx, DWORD PTR _nRatio$[ebp]
  0016b	89 15 00 00 00
	00		 mov	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A, edx
$LN4@SwitchToRa:

; 159  :     }
; 160  : 
; 161  :     LOG(1, _T("Switching to ratio %d (%d)"), AspectSettings.SourceAspect, AspectSettings.AspectMode);

  00171	a1 08 00 00 00	 mov	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+8
  00176	50		 push	 eax
  00177	8b 0d 00 00 00
	00		 mov	 ecx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A
  0017d	51		 push	 ecx
  0017e	68 00 00 00 00	 push	 OFFSET ??_C@_1DG@KJENAICD@?$AAS?$AAw?$AAi?$AAt?$AAc?$AAh?$AAi?$AAn?$AAg?$AA?5?$AAt?$AAo?$AA?5?$AAr?$AAa?$AAt?$AAi?$AAo?$AA?5?$AA?$CF?$AAd?$AA?5?$AA?$CI?$AA?$CF?$AAd?$AA?$CJ?$AA?$AA@
  00183	6a 01		 push	 1
  00185	e8 00 00 00 00	 call	 ?LOG@@YAXHPB_WZZ	; LOG
  0018a	83 c4 10	 add	 esp, 16			; 00000010H

; 162  : 
; 163  :     // Update the statistics for the new ratio
; 164  :     if (k != -1)

  0018d	83 7d f4 ff	 cmp	 DWORD PTR _k$[ebp], -1
  00191	74 1b		 je	 SHORT $LN2@SwitchToRa

; 165  :     {
; 166  :         RatioStatistics[k].switch_count++;

  00193	8b 55 f4	 mov	 edx, DWORD PTR _k$[ebp]
  00196	c1 e2 04	 shl	 edx, 4
  00199	8b 82 08 00 00
	00		 mov	 eax, DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[edx+8]
  0019f	83 c0 01	 add	 eax, 1
  001a2	8b 4d f4	 mov	 ecx, DWORD PTR _k$[ebp]
  001a5	c1 e1 04	 shl	 ecx, 4
  001a8	89 81 08 00 00
	00		 mov	 DWORD PTR ?RatioStatistics@@3PAUTRatioStatistics@@A[ecx+8], eax
$LN2@SwitchToRa:

; 167  :     }
; 168  :     nARLastTicks = now;

  001ae	8b 55 f8	 mov	 edx, DWORD PTR _now$[ebp]
  001b1	89 15 00 00 00
	00		 mov	 DWORD PTR ?nARLastTicks@@3HA, edx ; nARLastTicks

; 169  :     nNbRatioSwitch++;

  001b7	a1 00 00 00 00	 mov	 eax, DWORD PTR ?nNbRatioSwitch@@3HA ; nNbRatioSwitch
  001bc	83 c0 01	 add	 eax, 1
  001bf	a3 00 00 00 00	 mov	 DWORD PTR ?nNbRatioSwitch@@3HA, eax ; nNbRatioSwitch

; 170  : 
; 171  :     // Laurent 23/06/2002
; 172  :     // Don't know really why, but these 4 lines are needed
; 173  :     // to have something working well in all cases
; 174  :     WorkoutOverlaySize(TRUE);

  001c4	6a 01		 push	 1
  001c6	6a 01		 push	 1
  001c8	e8 00 00 00 00	 call	 ?WorkoutOverlaySize@@YAXHH@Z ; WorkoutOverlaySize
  001cd	83 c4 08	 add	 esp, 8

; 175  :     if (!bIsFullScreen && AspectSettings.AutoResizeWindow)

  001d0	83 3d 00 00 00
	00 00		 cmp	 DWORD PTR ?bIsFullScreen@@3HA, 0 ; bIsFullScreen
  001d7	75 15		 jne	 SHORT $LN14@SwitchToRa
  001d9	83 3d d4 00 00
	00 00		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+212, 0
  001e0	74 0c		 je	 SHORT $LN14@SwitchToRa

; 176  :     {
; 177  :         WorkoutOverlaySize(FALSE);

  001e2	6a 01		 push	 1
  001e4	6a 00		 push	 0
  001e6	e8 00 00 00 00	 call	 ?WorkoutOverlaySize@@YAXHH@Z ; WorkoutOverlaySize
  001eb	83 c4 08	 add	 esp, 8
$LN14@SwitchToRa:

; 178  :     }
; 179  : }

  001ee	8b e5		 mov	 esp, ebp
  001f0	5d		 pop	 ebp
  001f1	c3		 ret	 0
?SwitchToRatio@@YAXHH@Z ENDP				; SwitchToRatio
PUBLIC	?FindAspectRatio@@YAHPAUTDeinterlaceInfo@@@Z	; FindAspectRatio
; Function compile flags: /Odtp
;	COMDAT ?FindAspectRatio@@YAHPAUTDeinterlaceInfo@@@Z
_TEXT	SEGMENT
tv155 = -40						; size = 4
tv164 = -36						; size = 8
tv150 = -28						; size = 4
tv80 = -24						; size = 4
_imageHeight$ = -20					; size = 4
_topBorder$ = -16					; size = 4
_border$ = -12						; size = 4
_bottomBorder$ = -8					; size = 4
_ratio$ = -4						; size = 4
_pInfo$ = 8						; size = 4
?FindAspectRatio@@YAHPAUTDeinterlaceInfo@@@Z PROC	; FindAspectRatio, COMDAT

; 406  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 28	 sub	 esp, 40			; 00000028H
  00006	56		 push	 esi

; 407  :     int ratio;
; 408  :     int topBorder, bottomBorder, border;
; 409  :     int imageHeight = pInfo->FrameHeight - AspectSettings.InitialTopOverscan - AspectSettings.InitialBottomOverscan;

  00007	8b 45 08	 mov	 eax, DWORD PTR _pInfo$[ebp]
  0000a	8b 48 50	 mov	 ecx, DWORD PTR [eax+80]
  0000d	2b 0d 84 00 00
	00		 sub	 ecx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+132
  00013	2b 0d 88 00 00
	00		 sub	 ecx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+136
  00019	89 4d ec	 mov	 DWORD PTR _imageHeight$[ebp], ecx

; 410  : 
; 411  :     // If the aspect Mode is set to _T("use source"), revert to assuming that the
; 412  :     // source frame is 4:3.  We have to assume *some* source-frame aspect ratio
; 413  :     // here or there aren't enough inputs to derive the material aspect ratio.
; 414  :     if (AspectSettings.AspectMode == 0)

  0001c	83 3d 08 00 00
	00 00		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+8, 0
  00023	75 0a		 jne	 SHORT $LN3@FindAspect

; 415  :         AspectSettings.AspectMode = 1;

  00025	c7 05 08 00 00
	00 01 00 00 00	 mov	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+8, 1
$LN3@FindAspect:

; 416  : 
; 417  :     // Find the top of the image relative to the m_Overscan area.  Overscan has to
; 418  :     // be discarded from the computations since it can't really be regarded as
; 419  :     // part of the picture.
; 420  :     topBorder = FindEdgeOfImage(pInfo, 1) - AspectSettings.InitialTopOverscan;

  0002f	6a 01		 push	 1
  00031	8b 55 08	 mov	 edx, DWORD PTR _pInfo$[ebp]
  00034	52		 push	 edx
  00035	e8 00 00 00 00	 call	 ?FindEdgeOfImage@@YAHPAUTDeinterlaceInfo@@H@Z ; FindEdgeOfImage
  0003a	83 c4 08	 add	 esp, 8
  0003d	2b 05 84 00 00
	00		 sub	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+132
  00043	89 45 f0	 mov	 DWORD PTR _topBorder$[ebp], eax

; 421  : 
; 422  :     // Now find the size of the border at the bottom of the image.
; 423  :     bottomBorder = pInfo->FrameHeight - 1 - FindEdgeOfImage(pInfo, -1) - AspectSettings.InitialBottomOverscan;

  00046	8b 45 08	 mov	 eax, DWORD PTR _pInfo$[ebp]
  00049	8b 70 50	 mov	 esi, DWORD PTR [eax+80]
  0004c	83 ee 01	 sub	 esi, 1
  0004f	6a ff		 push	 -1
  00051	8b 4d 08	 mov	 ecx, DWORD PTR _pInfo$[ebp]
  00054	51		 push	 ecx
  00055	e8 00 00 00 00	 call	 ?FindEdgeOfImage@@YAHPAUTDeinterlaceInfo@@H@Z ; FindEdgeOfImage
  0005a	83 c4 08	 add	 esp, 8
  0005d	2b f0		 sub	 esi, eax
  0005f	2b 35 88 00 00
	00		 sub	 esi, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+136
  00065	89 75 f8	 mov	 DWORD PTR _bottomBorder$[ebp], esi

; 424  : 
; 425  :     // The border size is the smaller of the two.
; 426  :     border = (topBorder < bottomBorder) ? topBorder : bottomBorder;

  00068	8b 55 f0	 mov	 edx, DWORD PTR _topBorder$[ebp]
  0006b	3b 55 f8	 cmp	 edx, DWORD PTR _bottomBorder$[ebp]
  0006e	7d 08		 jge	 SHORT $LN6@FindAspect
  00070	8b 45 f0	 mov	 eax, DWORD PTR _topBorder$[ebp]
  00073	89 45 e8	 mov	 DWORD PTR tv80[ebp], eax
  00076	eb 06		 jmp	 SHORT $LN7@FindAspect
$LN6@FindAspect:
  00078	8b 4d f8	 mov	 ecx, DWORD PTR _bottomBorder$[ebp]
  0007b	89 4d e8	 mov	 DWORD PTR tv80[ebp], ecx
$LN7@FindAspect:
  0007e	8b 55 e8	 mov	 edx, DWORD PTR tv80[ebp]
  00081	89 55 f4	 mov	 DWORD PTR _border$[ebp], edx

; 427  : 
; 428  :     // Test to check if all the frame is detected as a big black bar
; 429  :     if ((imageHeight - border * 2) <= (AspectSettings.InitialTopOverscan + AspectSettings.InitialBottomOverscan))

  00084	8b 45 f4	 mov	 eax, DWORD PTR _border$[ebp]
  00087	d1 e0		 shl	 eax, 1
  00089	8b 4d ec	 mov	 ecx, DWORD PTR _imageHeight$[ebp]
  0008c	2b c8		 sub	 ecx, eax
  0008e	8b 15 84 00 00
	00		 mov	 edx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+132
  00094	03 15 88 00 00
	00		 add	 edx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+136
  0009a	3b ca		 cmp	 ecx, edx
  0009c	7f 0a		 jg	 SHORT $LN2@FindAspect

; 430  :     {
; 431  :         ratio = AspectSettings.SourceAspect;

  0009e	a1 00 00 00 00	 mov	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A
  000a3	89 45 fc	 mov	 DWORD PTR _ratio$[ebp], eax

; 432  :     }
; 433  :     else

  000a6	eb 34		 jmp	 SHORT $LN1@FindAspect
$LN2@FindAspect:

; 434  :     {
; 435  :         // Now the material aspect ratio is simply
; 436  :         //
; 437  :         //  effective width / (total image height - number of black lines at top and bottom)
; 438  :         //
; 439  :         // We compute effective width from height using the source-frame aspect ratio, since
; 440  :         // this will change depending on whether or not the image is anamorphic.
; 441  :         ratio = (int)((imageHeight * 1000) * GetActualSourceFrameAspect() / (imageHeight - border * 2));

  000a8	8b 4d ec	 mov	 ecx, DWORD PTR _imageHeight$[ebp]
  000ab	69 c9 e8 03 00
	00		 imul	 ecx, 1000		; 000003e8H
  000b1	89 4d e4	 mov	 DWORD PTR tv150[ebp], ecx
  000b4	db 45 e4	 fild	 DWORD PTR tv150[ebp]
  000b7	dd 5d dc	 fstp	 QWORD PTR tv164[ebp]
  000ba	e8 00 00 00 00	 call	 ?GetActualSourceFrameAspect@@YANXZ ; GetActualSourceFrameAspect
  000bf	dc 4d dc	 fmul	 QWORD PTR tv164[ebp]
  000c2	8b 55 f4	 mov	 edx, DWORD PTR _border$[ebp]
  000c5	d1 e2		 shl	 edx, 1
  000c7	8b 45 ec	 mov	 eax, DWORD PTR _imageHeight$[ebp]
  000ca	2b c2		 sub	 eax, edx
  000cc	89 45 d8	 mov	 DWORD PTR tv155[ebp], eax
  000cf	db 45 d8	 fild	 DWORD PTR tv155[ebp]
  000d2	de f9		 fdivp	 ST(1), ST(0)
  000d4	e8 00 00 00 00	 call	 __ftol2_sse
  000d9	89 45 fc	 mov	 DWORD PTR _ratio$[ebp], eax
$LN1@FindAspect:

; 442  :     }
; 443  :     LOG(2, _T("top %d bot %d bord %d rat %d"), topBorder, bottomBorder, border, ratio);

  000dc	8b 4d fc	 mov	 ecx, DWORD PTR _ratio$[ebp]
  000df	51		 push	 ecx
  000e0	8b 55 f4	 mov	 edx, DWORD PTR _border$[ebp]
  000e3	52		 push	 edx
  000e4	8b 45 f8	 mov	 eax, DWORD PTR _bottomBorder$[ebp]
  000e7	50		 push	 eax
  000e8	8b 4d f0	 mov	 ecx, DWORD PTR _topBorder$[ebp]
  000eb	51		 push	 ecx
  000ec	68 00 00 00 00	 push	 OFFSET ??_C@_1DK@EKJPJJJB@?$AAt?$AAo?$AAp?$AA?5?$AA?$CF?$AAd?$AA?5?$AAb?$AAo?$AAt?$AA?5?$AA?$CF?$AAd?$AA?5?$AAb?$AAo?$AAr?$AAd?$AA?5?$AA?$CF?$AAd?$AA?5?$AAr?$AAa?$AAt?$AA?5?$AA?$CF?$AAd?$AA?$AA@
  000f1	6a 02		 push	 2
  000f3	e8 00 00 00 00	 call	 ?LOG@@YAXHPB_WZZ	; LOG
  000f8	83 c4 18	 add	 esp, 24			; 00000018H

; 444  : 
; 445  :     return ratio;

  000fb	8b 45 fc	 mov	 eax, DWORD PTR _ratio$[ebp]

; 446  : }

  000fe	5e		 pop	 esi
  000ff	8b e5		 mov	 esp, ebp
  00101	5d		 pop	 ebp
  00102	c3		 ret	 0
?FindAspectRatio@@YAHPAUTDeinterlaceInfo@@@Z ENDP	; FindAspectRatio
PUBLIC	?AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z	; AdjustAspectRatio
_min_ratio_found DD 0258H DUP (?)
; Function compile flags: /Odtp
;	COMDAT ?AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z
_TEXT	SEGMENT
tv218 = -44						; size = 4
tv158 = -40						; size = 4
_maxRatio$ = -36					; size = 4
_tick_count$ = -32					; size = 4
_WssSourceRatio$ = -28					; size = 4
_haveSeenSmallerRatio$ = -24				; size = 4
_newMode$ = -20						; size = 4
_haveSeenThisRatio$ = -16				; size = 4
_newRatio$ = -12					; size = 4
_tickCutoff$ = -8					; size = 4
_i$ = -4						; size = 4
_SourceAspectAdjust$ = 8				; size = 4
_pInfo$ = 12						; size = 4
?AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z PROC	; AdjustAspectRatio, COMDAT

; 452  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 2c	 sub	 esp, 44			; 0000002cH
  00006	56		 push	 esi

; 453  :     static int lastNewRatio = 0;
; 454  :     static int newRatioFrameCount = 0;
; 455  :     static int newRatioFrameCount2 = 0;
; 456  :     static long LastSourceAspectAdjust = -1;
; 457  :     int newRatio, newMode;
; 458  :     int tick_count = GetTickCount();

  00007	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__GetTickCount@0
  0000d	89 45 e0	 mov	 DWORD PTR _tick_count$[ebp], eax

; 459  :     int tickCutoff = tick_count - (AspectSettings.AspectHistoryTime * 1000);

  00010	a1 34 00 00 00	 mov	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+52
  00015	69 c0 e8 03 00
	00		 imul	 eax, 1000		; 000003e8H
  0001b	8b 4d e0	 mov	 ecx, DWORD PTR _tick_count$[ebp]
  0001e	2b c8		 sub	 ecx, eax
  00020	89 4d f8	 mov	 DWORD PTR _tickCutoff$[ebp], ecx

; 460  :     int i;
; 461  :     int haveSeenThisRatio, haveSeenSmallerRatio;
; 462  :     int WssSourceRatio;
; 463  :     int maxRatio;
; 464  : 
; 465  :     // first see if we have go any filters changing the aspect ratio
; 466  :     if(LastSourceAspectAdjust != SourceAspectAdjust)

  00023	8b 15 00 00 00
	00		 mov	 edx, DWORD PTR ?LastSourceAspectAdjust@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4JA
  00029	3b 55 08	 cmp	 edx, DWORD PTR _SourceAspectAdjust$[ebp]
  0002c	74 22		 je	 SHORT $LN49@AdjustAspe

; 467  :     {
; 468  :         AspectSettings.SourceAspectAdjust = SourceAspectAdjust;

  0002e	8b 45 08	 mov	 eax, DWORD PTR _SourceAspectAdjust$[ebp]
  00031	a3 f0 00 00 00	 mov	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+240, eax

; 469  :         WorkoutOverlaySize(FALSE, TRUE);

  00036	6a 01		 push	 1
  00038	6a 00		 push	 0
  0003a	e8 00 00 00 00	 call	 ?WorkoutOverlaySize@@YAXHH@Z ; WorkoutOverlaySize
  0003f	83 c4 08	 add	 esp, 8

; 470  :         LastSourceAspectAdjust = SourceAspectAdjust;

  00042	8b 4d 08	 mov	 ecx, DWORD PTR _SourceAspectAdjust$[ebp]
  00045	89 0d 00 00 00
	00		 mov	 DWORD PTR ?LastSourceAspectAdjust@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4JA, ecx

; 471  :         return;

  0004b	e9 f2 03 00 00	 jmp	 $LN50@AdjustAspe
$LN49@AdjustAspe:

; 472  :     }
; 473  : 
; 474  :     /** ADDED by Mark Rejhon: Eliminates the _T("tiny slit") problem in starry
; 475  :         scenes such as those in Star Wars or start of Toy Story 2,
; 476  :         at least during full screen Mode.
; 477  :         \todo Would be nice to access 'AdjustedWindowAspect' in WorkoutOverlaySize()
; 478  :         so that I can also do this for windowed Mode too.
; 479  :     */
; 480  :     if (AspectSettings.DetectAspectNow || AspectSettings.AutoDetectAspect)

  00050	83 3d d8 00 00
	00 00		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+216, 0
  00057	75 0d		 jne	 SHORT $LN47@AdjustAspe
  00059	83 3d 28 00 00
	00 00		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+40, 0
  00060	0f 84 e5 00 00
	00		 je	 $LN48@AdjustAspe
$LN47@AdjustAspe:

; 481  :     {
; 482  :         if(pInfo->PictureHistory[0] == NULL || pInfo->PictureHistory[1] == NULL)

  00066	8b 55 0c	 mov	 edx, DWORD PTR _pInfo$[ebp]
  00069	83 7a 04 00	 cmp	 DWORD PTR [edx+4], 0
  0006d	74 09		 je	 SHORT $LN45@AdjustAspe
  0006f	8b 45 0c	 mov	 eax, DWORD PTR _pInfo$[ebp]
  00072	83 78 08 00	 cmp	 DWORD PTR [eax+8], 0
  00076	75 05		 jne	 SHORT $LN46@AdjustAspe
$LN45@AdjustAspe:

; 483  :         {
; 484  :             return;

  00078	e9 c5 03 00 00	 jmp	 $LN50@AdjustAspe
$LN46@AdjustAspe:

; 485  :         }
; 486  : 
; 487  :         if (AspectSettings.AutoDetectAspect == 2)

  0007d	83 3d 28 00 00
	00 02		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+40, 2
  00084	75 36		 jne	 SHORT $LN44@AdjustAspe

; 488  :         {
; 489  :             if (!WSS_GetRecommendedAR(&newMode, &newRatio))

  00086	8d 4d f4	 lea	 ecx, DWORD PTR _newRatio$[ebp]
  00089	51		 push	 ecx
  0008a	8d 55 ec	 lea	 edx, DWORD PTR _newMode$[ebp]
  0008d	52		 push	 edx
  0008e	e8 00 00 00 00	 call	 ?WSS_GetRecommendedAR@@YAHPAH0@Z ; WSS_GetRecommendedAR
  00093	83 c4 08	 add	 esp, 8
  00096	85 c0		 test	 eax, eax
  00098	75 1a		 jne	 SHORT $LN43@AdjustAspe

; 490  :             {
; 491  :                 newRatio = AspectSettings.DefaultSourceAspect;

  0009a	a1 00 01 00 00	 mov	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+256
  0009f	89 45 f4	 mov	 DWORD PTR _newRatio$[ebp], eax

; 492  :                 newMode = AspectSettings.DefaultAspectMode;

  000a2	8b 0d 04 01 00
	00		 mov	 ecx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+260
  000a8	89 4d ec	 mov	 DWORD PTR _newMode$[ebp], ecx

; 493  :                 WssSourceRatio = -1;

  000ab	c7 45 e4 ff ff
	ff ff		 mov	 DWORD PTR _WssSourceRatio$[ebp], -1

; 494  :             }
; 495  :             else

  000b2	eb 06		 jmp	 SHORT $LN42@AdjustAspe
$LN43@AdjustAspe:

; 496  :             {
; 497  :                 WssSourceRatio = newRatio;

  000b4	8b 55 f4	 mov	 edx, DWORD PTR _newRatio$[ebp]
  000b7	89 55 e4	 mov	 DWORD PTR _WssSourceRatio$[ebp], edx
$LN42@AdjustAspe:

; 498  :             }
; 499  :         }
; 500  :         else

  000ba	eb 4b		 jmp	 SHORT $LN41@AdjustAspe
$LN44@AdjustAspe:

; 501  :         {
; 502  :             newRatio = FindAspectRatio(pInfo);

  000bc	8b 45 0c	 mov	 eax, DWORD PTR _pInfo$[ebp]
  000bf	50		 push	 eax
  000c0	e8 00 00 00 00	 call	 ?FindAspectRatio@@YAHPAUTDeinterlaceInfo@@@Z ; FindAspectRatio
  000c5	83 c4 04	 add	 esp, 4
  000c8	89 45 f4	 mov	 DWORD PTR _newRatio$[ebp], eax

; 503  : 
; 504  :             // Get aspect ratio from WSS data
; 505  :             // (WssSourceRatio = -1 if ratio is not defined in WSS data)
; 506  :             if (!AspectSettings.bUseWSS || !WSS_GetRecommendedAR(&newMode, &WssSourceRatio))

  000cb	83 3d fc 00 00
	00 00		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+252, 0
  000d2	74 14		 je	 SHORT $LN39@AdjustAspe
  000d4	8d 4d e4	 lea	 ecx, DWORD PTR _WssSourceRatio$[ebp]
  000d7	51		 push	 ecx
  000d8	8d 55 ec	 lea	 edx, DWORD PTR _newMode$[ebp]
  000db	52		 push	 edx
  000dc	e8 00 00 00 00	 call	 ?WSS_GetRecommendedAR@@YAHPAH0@Z ; WSS_GetRecommendedAR
  000e1	83 c4 08	 add	 esp, 8
  000e4	85 c0		 test	 eax, eax
  000e6	75 11		 jne	 SHORT $LN40@AdjustAspe
$LN39@AdjustAspe:

; 507  :             {
; 508  :                 newMode = AspectSettings.AspectMode;

  000e8	a1 08 00 00 00	 mov	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+8
  000ed	89 45 ec	 mov	 DWORD PTR _newMode$[ebp], eax

; 509  :                 WssSourceRatio = -1;

  000f0	c7 45 e4 ff ff
	ff ff		 mov	 DWORD PTR _WssSourceRatio$[ebp], -1
  000f7	eb 0e		 jmp	 SHORT $LN41@AdjustAspe
$LN40@AdjustAspe:

; 510  :             }
; 511  :             // The ratio must be at least the ratio defined in WSS data
; 512  :             else if (newRatio < WssSourceRatio)

  000f9	8b 4d f4	 mov	 ecx, DWORD PTR _newRatio$[ebp]
  000fc	3b 4d e4	 cmp	 ecx, DWORD PTR _WssSourceRatio$[ebp]
  000ff	7d 06		 jge	 SHORT $LN41@AdjustAspe

; 513  :             {
; 514  :                 newRatio = WssSourceRatio;

  00101	8b 55 e4	 mov	 edx, DWORD PTR _WssSourceRatio$[ebp]
  00104	89 55 f4	 mov	 DWORD PTR _newRatio$[ebp], edx
$LN41@AdjustAspe:

; 515  :             }
; 516  :         }
; 517  : 
; 518  :         if (bIsFullScreen && AspectSettings.TargetAspect && !AspectSettings.bAllowGreaterThanScreen)

  00107	83 3d 00 00 00
	00 00		 cmp	 DWORD PTR ?bIsFullScreen@@3HA, 0 ; bIsFullScreen
  0010e	74 3b		 je	 SHORT $LN48@AdjustAspe
  00110	83 3d 04 00 00
	00 00		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+4, 0
  00117	74 32		 je	 SHORT $LN48@AdjustAspe
  00119	83 3d 1c 00 00
	00 00		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+28, 0
  00120	75 29		 jne	 SHORT $LN48@AdjustAspe

; 519  :         {
; 520  :             if (AspectSettings.TargetAspect > WssSourceRatio)

  00122	a1 04 00 00 00	 mov	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+4
  00127	3b 45 e4	 cmp	 eax, DWORD PTR _WssSourceRatio$[ebp]
  0012a	7e 0b		 jle	 SHORT $LN35@AdjustAspe

; 521  :             {
; 522  :                 maxRatio = AspectSettings.TargetAspect;

  0012c	8b 0d 04 00 00
	00		 mov	 ecx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+4
  00132	89 4d dc	 mov	 DWORD PTR _maxRatio$[ebp], ecx

; 523  :             }
; 524  :             else

  00135	eb 06		 jmp	 SHORT $LN34@AdjustAspe
$LN35@AdjustAspe:

; 525  :             {
; 526  :                 maxRatio = WssSourceRatio;

  00137	8b 55 e4	 mov	 edx, DWORD PTR _WssSourceRatio$[ebp]
  0013a	89 55 dc	 mov	 DWORD PTR _maxRatio$[ebp], edx
$LN34@AdjustAspe:

; 527  :             }
; 528  :             if (newRatio > maxRatio)

  0013d	8b 45 f4	 mov	 eax, DWORD PTR _newRatio$[ebp]
  00140	3b 45 dc	 cmp	 eax, DWORD PTR _maxRatio$[ebp]
  00143	7e 06		 jle	 SHORT $LN48@AdjustAspe

; 529  :             {
; 530  :                 newRatio = maxRatio;

  00145	8b 4d dc	 mov	 ecx, DWORD PTR _maxRatio$[ebp]
  00148	89 4d f4	 mov	 DWORD PTR _newRatio$[ebp], ecx
$LN48@AdjustAspe:

; 531  :             }
; 532  :         }
; 533  :     }
; 534  : 
; 535  :     // If the user told us to detect the current ratio, do it.
; 536  :     if (AspectSettings.DetectAspectNow)

  0014b	83 3d d8 00 00
	00 00		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+216, 0
  00152	74 38		 je	 SHORT $LN32@AdjustAspe

; 537  :     {
; 538  :         SwitchToRatio(newMode, newRatio);

  00154	8b 55 f4	 mov	 edx, DWORD PTR _newRatio$[ebp]
  00157	52		 push	 edx
  00158	8b 45 ec	 mov	 eax, DWORD PTR _newMode$[ebp]
  0015b	50		 push	 eax
  0015c	e8 00 00 00 00	 call	 ?SwitchToRatio@@YAXHH@Z	; SwitchToRatio
  00161	83 c4 08	 add	 esp, 8

; 539  :         newRatioFrameCount = 0;

  00164	c7 05 00 00 00
	00 00 00 00 00	 mov	 DWORD PTR ?newRatioFrameCount@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA, 0

; 540  :         newRatioFrameCount2 = 0;

  0016e	c7 05 00 00 00
	00 00 00 00 00	 mov	 DWORD PTR ?newRatioFrameCount2@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA, 0

; 541  :         AspectSettings.DetectAspectNow = FALSE;

  00178	c7 05 d8 00 00
	00 00 00 00 00	 mov	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+216, 0
  00182	e9 bb 02 00 00	 jmp	 $LN50@AdjustAspe

; 542  :         return;

  00187	e9 b6 02 00 00	 jmp	 $LN50@AdjustAspe
$LN32@AdjustAspe:

; 543  :     }
; 544  :     else if (AspectSettings.AutoDetectAspect == 2)

  0018c	83 3d 28 00 00
	00 02		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+40, 2
  00193	75 30		 jne	 SHORT $LN30@AdjustAspe

; 545  :     {
; 546  :         if (newMode != AspectSettings.AspectMode || newRatio != AspectSettings.SourceAspect)

  00195	8b 4d ec	 mov	 ecx, DWORD PTR _newMode$[ebp]
  00198	3b 0d 08 00 00
	00		 cmp	 ecx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+8
  0019e	75 0b		 jne	 SHORT $LN28@AdjustAspe
  001a0	8b 55 f4	 mov	 edx, DWORD PTR _newRatio$[ebp]
  001a3	3b 15 00 00 00
	00		 cmp	 edx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A
  001a9	74 15		 je	 SHORT $LN29@AdjustAspe
$LN28@AdjustAspe:

; 547  :         {
; 548  :             SwitchToRatio(newMode, newRatio);

  001ab	8b 45 f4	 mov	 eax, DWORD PTR _newRatio$[ebp]
  001ae	50		 push	 eax
  001af	8b 4d ec	 mov	 ecx, DWORD PTR _newMode$[ebp]
  001b2	51		 push	 ecx
  001b3	e8 00 00 00 00	 call	 ?SwitchToRatio@@YAXHH@Z	; SwitchToRatio
  001b8	83 c4 08	 add	 esp, 8

; 549  :             return;

  001bb	e9 82 02 00 00	 jmp	 $LN50@AdjustAspe
$LN29@AdjustAspe:

; 550  :         }
; 551  :     }

  001c0	e9 7d 02 00 00	 jmp	 $LN50@AdjustAspe
$LN30@AdjustAspe:

; 552  :     else if (AspectSettings.AutoDetectAspect == 1)

  001c5	83 3d 28 00 00
	00 01		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+40, 1
  001cc	0f 85 70 02 00
	00		 jne	 $LN50@AdjustAspe

; 553  :     {
; 554  :         // If we've just crossed a 1-second boundary, scroll the aspect ratio
; 555  :         // histories.  If not, update the max ratio found in the current second.
; 556  :         if (tick_count / 1000 != min_ratio_tick_count / 1000)

  001d2	8b 45 e0	 mov	 eax, DWORD PTR _tick_count$[ebp]
  001d5	99		 cdq
  001d6	b9 e8 03 00 00	 mov	 ecx, 1000		; 000003e8H
  001db	f7 f9		 idiv	 ecx
  001dd	8b c8		 mov	 ecx, eax
  001df	a1 00 00 00 00	 mov	 eax, DWORD PTR _min_ratio_tick_count
  001e4	99		 cdq
  001e5	be e8 03 00 00	 mov	 esi, 1000		; 000003e8H
  001ea	f7 fe		 idiv	 esi
  001ec	3b c8		 cmp	 ecx, eax
  001ee	74 2a		 je	 SHORT $LN25@AdjustAspe

; 557  :         {
; 558  :             min_ratio_tick_count = tick_count;

  001f0	8b 55 e0	 mov	 edx, DWORD PTR _tick_count$[ebp]
  001f3	89 15 00 00 00
	00		 mov	 DWORD PTR _min_ratio_tick_count, edx

; 559  :             memmove(&min_ratio_found[1], &min_ratio_found[0], sizeof(min_ratio_found[0]) * (RATIO_HISTORY_SECONDS - 1));

  001f9	68 5c 09 00 00	 push	 2396			; 0000095cH
  001fe	68 00 00 00 00	 push	 OFFSET _min_ratio_found
  00203	68 04 00 00 00	 push	 OFFSET _min_ratio_found+4
  00208	e8 00 00 00 00	 call	 _memmove
  0020d	83 c4 0c	 add	 esp, 12			; 0000000cH

; 560  :             min_ratio_found[0] = newRatio;

  00210	8b 45 f4	 mov	 eax, DWORD PTR _newRatio$[ebp]
  00213	a3 00 00 00 00	 mov	 DWORD PTR _min_ratio_found, eax
  00218	eb 14		 jmp	 SHORT $LN24@AdjustAspe
$LN25@AdjustAspe:

; 561  :         }
; 562  :         else if (newRatio < min_ratio_found[0])

  0021a	8b 4d f4	 mov	 ecx, DWORD PTR _newRatio$[ebp]
  0021d	3b 0d 00 00 00
	00		 cmp	 ecx, DWORD PTR _min_ratio_found
  00223	7d 09		 jge	 SHORT $LN24@AdjustAspe

; 563  :         {
; 564  :             min_ratio_found[0] = newRatio;

  00225	8b 55 f4	 mov	 edx, DWORD PTR _newRatio$[ebp]
  00228	89 15 00 00 00
	00		 mov	 DWORD PTR _min_ratio_found, edx
$LN24@AdjustAspe:

; 565  :         }
; 566  : 
; 567  :         // If the Mode (anamorphic/non anamorphic) changes, switch to the new
; 568  :         // Mode and ratio immediately
; 569  :         if (newMode != AspectSettings.AspectMode)

  0022e	8b 45 ec	 mov	 eax, DWORD PTR _newMode$[ebp]
  00231	3b 05 08 00 00
	00		 cmp	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+8
  00237	74 29		 je	 SHORT $LN22@AdjustAspe

; 570  :         {
; 571  :             SwitchToRatio(newMode, newRatio);

  00239	8b 4d f4	 mov	 ecx, DWORD PTR _newRatio$[ebp]
  0023c	51		 push	 ecx
  0023d	8b 55 ec	 mov	 edx, DWORD PTR _newMode$[ebp]
  00240	52		 push	 edx
  00241	e8 00 00 00 00	 call	 ?SwitchToRatio@@YAXHH@Z	; SwitchToRatio
  00246	83 c4 08	 add	 esp, 8

; 572  :             newRatioFrameCount = 0;

  00249	c7 05 00 00 00
	00 00 00 00 00	 mov	 DWORD PTR ?newRatioFrameCount@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA, 0

; 573  :             newRatioFrameCount2 = 0;

  00253	c7 05 00 00 00
	00 00 00 00 00	 mov	 DWORD PTR ?newRatioFrameCount2@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA, 0
  0025d	e9 e0 01 00 00	 jmp	 $LN50@AdjustAspe
$LN22@AdjustAspe:

; 574  :         }
; 575  :         // If the new ratio is less than the current one -- less letterboxed --
; 576  :         // switch to the new ratio only after ZoomOutFrameCount consecutive times
; 577  :         // the detected ratio is lower than the current one.
; 578  :         // This may avoid unneeded switch to lower ratio when the ratio is lower
; 579  :         // only during few fields.
; 580  :         // ZoomOutFrameCount must be low (only few frames) to avoid cutting the
; 581  :         // image off for a long time.
; 582  :         else if (newRatio < AspectSettings.SourceAspect)

  00262	8b 45 f4	 mov	 eax, DWORD PTR _newRatio$[ebp]
  00265	3b 05 00 00 00
	00		 cmp	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A
  0026b	7d 46		 jge	 SHORT $LN20@AdjustAspe

; 583  :         {
; 584  :             newRatioFrameCount2++;

  0026d	8b 0d 00 00 00
	00		 mov	 ecx, DWORD PTR ?newRatioFrameCount2@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA
  00273	83 c1 01	 add	 ecx, 1
  00276	89 0d 00 00 00
	00		 mov	 DWORD PTR ?newRatioFrameCount2@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA, ecx

; 585  :             if (newRatioFrameCount2 >= AspectSettings.ZoomOutFrameCount)

  0027c	8b 15 00 00 00
	00		 mov	 edx, DWORD PTR ?newRatioFrameCount2@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA
  00282	3b 15 30 00 00
	00		 cmp	 edx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+48
  00288	7c 24		 jl	 SHORT $LN19@AdjustAspe

; 586  :             {
; 587  :                 SwitchToRatio(newMode, newRatio);

  0028a	8b 45 f4	 mov	 eax, DWORD PTR _newRatio$[ebp]
  0028d	50		 push	 eax
  0028e	8b 4d ec	 mov	 ecx, DWORD PTR _newMode$[ebp]
  00291	51		 push	 ecx
  00292	e8 00 00 00 00	 call	 ?SwitchToRatio@@YAXHH@Z	; SwitchToRatio
  00297	83 c4 08	 add	 esp, 8

; 588  :                 newRatioFrameCount = 0;

  0029a	c7 05 00 00 00
	00 00 00 00 00	 mov	 DWORD PTR ?newRatioFrameCount@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA, 0

; 589  :                 newRatioFrameCount2 = 0;

  002a4	c7 05 00 00 00
	00 00 00 00 00	 mov	 DWORD PTR ?newRatioFrameCount2@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA, 0
$LN19@AdjustAspe:

; 590  :             }
; 591  :         }

  002ae	e9 8f 01 00 00	 jmp	 $LN50@AdjustAspe
$LN20@AdjustAspe:

; 592  :         else if (ABS(newRatio - AspectSettings.SourceAspect) > AspectSettings.AspectEqualFudgeFactor && newRatio == lastNewRatio)

  002b3	8b 55 f4	 mov	 edx, DWORD PTR _newRatio$[ebp]
  002b6	2b 15 00 00 00
	00		 sub	 edx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A
  002bc	79 10		 jns	 SHORT $LN52@AdjustAspe
  002be	8b 45 f4	 mov	 eax, DWORD PTR _newRatio$[ebp]
  002c1	2b 05 00 00 00
	00		 sub	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A
  002c7	f7 d8		 neg	 eax
  002c9	89 45 d8	 mov	 DWORD PTR tv158[ebp], eax
  002cc	eb 0c		 jmp	 SHORT $LN53@AdjustAspe
$LN52@AdjustAspe:
  002ce	8b 4d f4	 mov	 ecx, DWORD PTR _newRatio$[ebp]
  002d1	2b 0d 00 00 00
	00		 sub	 ecx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A
  002d7	89 4d d8	 mov	 DWORD PTR tv158[ebp], ecx
$LN53@AdjustAspe:
  002da	8b 55 d8	 mov	 edx, DWORD PTR tv158[ebp]
  002dd	3b 15 3c 00 00
	00		 cmp	 edx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+60
  002e3	0f 8e 32 01 00
	00		 jle	 $LN17@AdjustAspe
  002e9	8b 45 f4	 mov	 eax, DWORD PTR _newRatio$[ebp]
  002ec	3b 05 00 00 00
	00		 cmp	 eax, DWORD PTR ?lastNewRatio@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA
  002f2	0f 85 23 01 00
	00		 jne	 $LN17@AdjustAspe

; 593  :         {
; 594  :             newRatioFrameCount2 = 0;

  002f8	c7 05 00 00 00
	00 00 00 00 00	 mov	 DWORD PTR ?newRatioFrameCount2@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA, 0

; 595  : 
; 596  :             // Require the same aspect ratio for some number of frames, or no
; 597  :             // narrower aspect ratio found for the last AspectConsistencyTime seconds,
; 598  :             // before zooming in.
; 599  :             haveSeenSmallerRatio = 0;

  00302	c7 45 e8 00 00
	00 00		 mov	 DWORD PTR _haveSeenSmallerRatio$[ebp], 0

; 600  :             for (i = 1; i < AspectSettings.AspectConsistencyTime; i++)

  00309	c7 45 fc 01 00
	00 00		 mov	 DWORD PTR _i$[ebp], 1
  00310	eb 09		 jmp	 SHORT $LN16@AdjustAspe
$LN15@AdjustAspe:
  00312	8b 4d fc	 mov	 ecx, DWORD PTR _i$[ebp]
  00315	83 c1 01	 add	 ecx, 1
  00318	89 4d fc	 mov	 DWORD PTR _i$[ebp], ecx
$LN16@AdjustAspe:
  0031b	8b 55 fc	 mov	 edx, DWORD PTR _i$[ebp]
  0031e	3b 15 38 00 00
	00		 cmp	 edx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+56
  00324	7d 1a		 jge	 SHORT $LN14@AdjustAspe

; 601  :                 if (newRatio > min_ratio_found[i])

  00326	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  00329	8b 4d f4	 mov	 ecx, DWORD PTR _newRatio$[ebp]
  0032c	3b 0c 85 00 00
	00 00		 cmp	 ecx, DWORD PTR _min_ratio_found[eax*4]
  00333	7e 09		 jle	 SHORT $LN13@AdjustAspe

; 602  :                 {
; 603  :                     haveSeenSmallerRatio = 1;

  00335	c7 45 e8 01 00
	00 00		 mov	 DWORD PTR _haveSeenSmallerRatio$[ebp], 1

; 604  :                     break;

  0033c	eb 02		 jmp	 SHORT $LN14@AdjustAspe
$LN13@AdjustAspe:

; 605  :                 }

  0033e	eb d2		 jmp	 SHORT $LN15@AdjustAspe
$LN14@AdjustAspe:

; 606  : 
; 607  :             if (! haveSeenSmallerRatio || ++newRatioFrameCount >= AspectSettings.ZoomInFrameCount)

  00340	83 7d e8 00	 cmp	 DWORD PTR _haveSeenSmallerRatio$[ebp], 0
  00344	74 20		 je	 SHORT $LN11@AdjustAspe
  00346	8b 15 00 00 00
	00		 mov	 edx, DWORD PTR ?newRatioFrameCount@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA
  0034c	83 c2 01	 add	 edx, 1
  0034f	89 15 00 00 00
	00		 mov	 DWORD PTR ?newRatioFrameCount@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA, edx
  00355	a1 00 00 00 00	 mov	 eax, DWORD PTR ?newRatioFrameCount@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA
  0035a	3b 05 2c 00 00
	00		 cmp	 eax, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+44
  00360	0f 8c b3 00 00
	00		 jl	 $LN12@AdjustAspe
$LN11@AdjustAspe:

; 608  :             {
; 609  :                 // If we're looking at aspect ratio histories, the new ratio must be
; 610  :                 // equal (or very close) to one we've _used_ in the recent past, or
; 611  :                 // there must have been no smaller ratio _found_ in the recent past.
; 612  :                 // That is, don't zoom in more than we've zoomed in recently unless
; 613  :                 // we'd previously zoomed to the same ratio.  This helps prevent
; 614  :                 // temporary zooms into letterboxed material during dark scenes, while
; 615  :                 // allowing the code to quickly switch in and out of zoomed Mode when
; 616  :                 // full-frame commercials come on.
; 617  :                 haveSeenThisRatio = 0;

  00366	c7 45 f0 00 00
	00 00		 mov	 DWORD PTR _haveSeenThisRatio$[ebp], 0

; 618  :                 if (AspectSettings.AspectHistoryTime > 0)

  0036d	83 3d 34 00 00
	00 00		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+52, 0
  00374	7e 70		 jle	 SHORT $LN10@AdjustAspe

; 619  :                 {
; 620  :                     for (i = 1; i < RATIO_HISTORY_CHANGES && ratio_time[i] > tickCutoff; i++)

  00376	c7 45 fc 01 00
	00 00		 mov	 DWORD PTR _i$[ebp], 1
  0037d	eb 09		 jmp	 SHORT $LN9@AdjustAspe
$LN8@AdjustAspe:
  0037f	8b 4d fc	 mov	 ecx, DWORD PTR _i$[ebp]
  00382	83 c1 01	 add	 ecx, 1
  00385	89 4d fc	 mov	 DWORD PTR _i$[ebp], ecx
$LN9@AdjustAspe:
  00388	83 7d fc 32	 cmp	 DWORD PTR _i$[ebp], 50	; 00000032H
  0038c	7d 58		 jge	 SHORT $LN10@AdjustAspe
  0038e	8b 55 fc	 mov	 edx, DWORD PTR _i$[ebp]
  00391	8b 04 95 00 00
	00 00		 mov	 eax, DWORD PTR _ratio_time[edx*4]
  00398	3b 45 f8	 cmp	 eax, DWORD PTR _tickCutoff$[ebp]
  0039b	7e 49		 jle	 SHORT $LN10@AdjustAspe

; 621  :                         if (ABS(newRatio - ratio_used[i]) <= AspectSettings.AspectEqualFudgeFactor)

  0039d	8b 4d fc	 mov	 ecx, DWORD PTR _i$[ebp]
  003a0	8b 55 f4	 mov	 edx, DWORD PTR _newRatio$[ebp]
  003a3	2b 14 8d 00 00
	00 00		 sub	 edx, DWORD PTR _ratio_used[ecx*4]
  003aa	79 14		 jns	 SHORT $LN54@AdjustAspe
  003ac	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  003af	8b 4d f4	 mov	 ecx, DWORD PTR _newRatio$[ebp]
  003b2	2b 0c 85 00 00
	00 00		 sub	 ecx, DWORD PTR _ratio_used[eax*4]
  003b9	f7 d9		 neg	 ecx
  003bb	89 4d d4	 mov	 DWORD PTR tv218[ebp], ecx
  003be	eb 10		 jmp	 SHORT $LN55@AdjustAspe
$LN54@AdjustAspe:
  003c0	8b 55 fc	 mov	 edx, DWORD PTR _i$[ebp]
  003c3	8b 45 f4	 mov	 eax, DWORD PTR _newRatio$[ebp]
  003c6	2b 04 95 00 00
	00 00		 sub	 eax, DWORD PTR _ratio_used[edx*4]
  003cd	89 45 d4	 mov	 DWORD PTR tv218[ebp], eax
$LN55@AdjustAspe:
  003d0	8b 4d d4	 mov	 ecx, DWORD PTR tv218[ebp]
  003d3	3b 0d 3c 00 00
	00		 cmp	 ecx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+60
  003d9	7f 09		 jg	 SHORT $LN6@AdjustAspe

; 622  :                         {
; 623  :                             haveSeenThisRatio = 1;

  003db	c7 45 f0 01 00
	00 00		 mov	 DWORD PTR _haveSeenThisRatio$[ebp], 1

; 624  :                             break;

  003e2	eb 02		 jmp	 SHORT $LN10@AdjustAspe
$LN6@AdjustAspe:

; 625  :                         }
; 626  :                 }

  003e4	eb 99		 jmp	 SHORT $LN8@AdjustAspe
$LN10@AdjustAspe:

; 627  : 
; 628  :                 if (AspectSettings.AspectConsistencyTime <= 0 ||
; 629  :                     (haveSeenThisRatio && newRatioFrameCount >= AspectSettings.ZoomInFrameCount) ||
; 630  :                     ! haveSeenSmallerRatio)

  003e6	83 3d 38 00 00
	00 00		 cmp	 DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+56, 0
  003ed	7e 1a		 jle	 SHORT $LN4@AdjustAspe
  003ef	83 7d f0 00	 cmp	 DWORD PTR _haveSeenThisRatio$[ebp], 0
  003f3	74 0e		 je	 SHORT $LN3@AdjustAspe
  003f5	8b 15 00 00 00
	00		 mov	 edx, DWORD PTR ?newRatioFrameCount@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA
  003fb	3b 15 2c 00 00
	00		 cmp	 edx, DWORD PTR ?AspectSettings@@3UTAspectSettings@@A+44
  00401	7d 06		 jge	 SHORT $LN4@AdjustAspe
$LN3@AdjustAspe:
  00403	83 7d e8 00	 cmp	 DWORD PTR _haveSeenSmallerRatio$[ebp], 0
  00407	75 10		 jne	 SHORT $LN12@AdjustAspe
$LN4@AdjustAspe:

; 631  :                 {
; 632  :                     SwitchToRatio(newMode, newRatio);

  00409	8b 45 f4	 mov	 eax, DWORD PTR _newRatio$[ebp]
  0040c	50		 push	 eax
  0040d	8b 4d ec	 mov	 ecx, DWORD PTR _newMode$[ebp]
  00410	51		 push	 ecx
  00411	e8 00 00 00 00	 call	 ?SwitchToRatio@@YAXHH@Z	; SwitchToRatio
  00416	83 c4 08	 add	 esp, 8
$LN12@AdjustAspe:

; 633  :                 }
; 634  :             }
; 635  :         }
; 636  :         else

  00419	eb 27		 jmp	 SHORT $LN50@AdjustAspe
$LN17@AdjustAspe:

; 637  :         {
; 638  :             newRatioFrameCount2 = 0;

  0041b	c7 05 00 00 00
	00 00 00 00 00	 mov	 DWORD PTR ?newRatioFrameCount2@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA, 0

; 639  : 
; 640  :             // If this is a wider ratio than the previous one, require it to stick
; 641  :             // around for the full frame Count.
; 642  :             if (lastNewRatio < newRatio)

  00425	8b 15 00 00 00
	00		 mov	 edx, DWORD PTR ?lastNewRatio@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA
  0042b	3b 55 f4	 cmp	 edx, DWORD PTR _newRatio$[ebp]
  0042e	7d 0a		 jge	 SHORT $LN1@AdjustAspe

; 643  :             {
; 644  :                 newRatioFrameCount = 0;

  00430	c7 05 00 00 00
	00 00 00 00 00	 mov	 DWORD PTR ?newRatioFrameCount@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA, 0
$LN1@AdjustAspe:

; 645  :             }
; 646  : 
; 647  :             lastNewRatio = newRatio;

  0043a	8b 45 f4	 mov	 eax, DWORD PTR _newRatio$[ebp]
  0043d	a3 00 00 00 00	 mov	 DWORD PTR ?lastNewRatio@?1??AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z@4HA, eax
$LN50@AdjustAspe:

; 648  :         }
; 649  :     }
; 650  : }

  00442	5e		 pop	 esi
  00443	8b e5		 mov	 esp, ebp
  00445	5d		 pop	 ebp
  00446	c3		 ret	 0
?AdjustAspectRatio@@YAXJPAUTDeinterlaceInfo@@@Z ENDP	; AdjustAspectRatio
END
