View Full Version : D2VParse v9 by Amnon82
Amnon82
18th March 2006, 21:27
http://img86.imageshack.us/img86/6984/d2vparsev75ry.png
D2VParse parses a d2v-file and show you the results.
Version 9:
* Enhanced garfield routine added
* Source included
* Download v9 (http://home.arcor.de/autoq2_amsoft/files/delphi/source/d2vparse_v9.zip)
ToDo:
* Batch mode
Rockas
18th March 2006, 22:31
It's a shame that there is not tool like DGIndex for AVI files, don't you think? :D
Amnon82
18th March 2006, 22:37
Yes ;)
I'm hanging with the PFF detection. Maybe neuron or somebody else can explain me how to find out the value of Bit6. >> DGIndex Manual (http://neuron2.net/dgmpgdec/DGIndexManual.html#AppendixA)
Thread @ Delphipraxis.net (german) (http://www.delphipraxis.net/topic78360_hex+und+string+bit+6+auslesen.html)
Rockas
19th March 2006, 02:09
[OT]
ummm... I read the thread you posted (I don't understand a word of german lol) and I liked the looks of Delphi :) - seemed to me more understandable than C++
What tools do you use to code?
Do you know where I can find some guides for it?
Thank you
Guest
19th March 2006, 02:10
I'm hanging with the PFF detection. Maybe neuron or somebody else can explain me how to find out the value of Bit6. Are you asking how to do bit operations in Delphi?
Inc
19th March 2006, 03:33
Amnon that should be included in any Delphi tutorial.
You are using the Avisynth_C.pas right? There are a mega lot of functions which do look if bits are set. Hint: Colorspace functions.
That Delphipraxis-thread is funny as you dont have to use binary values:
nValue & (1 << nBitNumber) = true or false
Amnon82
19th March 2006, 09:18
I'm using Avisynth_C.pas. I know how much functions it has, but I wanted to learn how to do it with D2V only. I'm searching now for a tutorial for 'bit operations in Delphi'.
This must be then the right solution:
if pos(uppercase(' '),uppercase(listbox1.items[i])) > 0 then
begin
temp:=listbox1.Items[i];
for tempi := 7 to length(temp) do
begin
value:=GetTok(temp, tempi, ' ');
if value = inttostr($20) then thirtytwo:=thirtytwo+1;
if thirtytwo > 0 then
checkbox1.checked:=true else checkbox1.checked:=false;
end;
end;
We parsing this code:
d00 1 0 2048 1 1 92 b2 a2 b2 b2 a2 b2 b2 a2 b2 b2 a2
900 1 0 53248 1 1 32 32 92 b2 b2 a2 b2 b2 a2 b2 b2 a2
900 1 0 133120 1 1 32 32 92 b2 b2 a2 b2 b2 a2 b2 b2 a2
900 1 0 423936 1 1 32 32 92 b2 b2 a2 b2 b2 a2 b2 b2 a2
900 1 0 712704 1 1 32 32 92 b2 b2 a2 b2 b2 a2 b2 b2 a2
900 1 0 917504 1 1 32 32 92 b2 b2 a2 a2 b2 b2 a2
900 1 0 1273856 1 1 32 32 92 b2 b2 a2 b2 b2 a2 b2 b2 a2
900 1 0 1644544 1 1 32 32 92 b2 b2 a2 b2 b2 a2 b2 b2 a2
900 1 0 1910784 1 1 32 32 92 b2 b2 a2 b2 b2 a2 b2 b2 a2
900 1 0 2201600 1 1 32 32 92 b2 b2 a2 b2 b2 a2 b2 b2 a2
900 1 0 2516992 1 1 32 32 92 b2 b2 a2 b2 b2 a2 b2 b2 a2
900 1 0 2838528 1 1 32 32 92 b2 b2 a2 b2 b2 a2 b2 b2 a2
Bit6 in delphi is $20. $20 as integer is 32, right? So if 32 is in the code it is PFF, right?
Guest
19th March 2006, 17:45
Bit6 in delphi is $20. Bit numbering starts at 0, so bit 6 is $40.
$20 integer is 32, right? So if 32 is in the code it is PFF, right? $40 is 64. The way to test the bit is like this:
if val and $40 > 0 then
pff := 1
else
pff := 0;...where val is the flags byte that you are testing.
Amnon82
19th March 2006, 21:41
function HexToInt(s: string): Longword;
var
b: Byte;
c: Char;
begin
Result := 0;
s := UpperCase(s);
for b := 1 to Length(s) do
begin
Result := Result * 16;
c := s[b];
case c of
'0'..'9': Inc(Result, Ord(c) - Ord('0'));
'A'..'F': Inc(Result, Ord(c) - Ord('A') + 10);
else
raise EConvertError.Create('No Hex-Number');
end;
end;
end;
if pos(uppercase('Frame_Rate'),uppercase(listbox1.items[i])) > 0 then {nothing} else
if pos(uppercase(' '),uppercase(listbox1.items[i])) > 0 then
begin
temp:=listbox1.Items[i];
for tempi := 7 to length(temp) do
begin
value:=GetTok(temp, tempi, ' ');
if hextoint(value) and $40 > 0 then thirtytwo:=thirtytwo+1;
end;
end;
if thirtytwo > 0 then
checkbox1.checked:=true else checkbox1.checked:=false;
Thx. I've another question for you neuron.
Till now I'm using this code to get TFF and BFF:
if pos(uppercase('2'),uppercase(listbox1.items[i])) > 0 then two:=two+1;
if pos(uppercase('0'),uppercase(listbox1.items[i])) > 0 then two:=zero+1;
if two > zero then radiobutton1.checked:=true else radiobutton2.checked:=true;
Look there (http://forum.doom9.org/showpost.php?p=714618&postcount=7)
Guest
20th March 2006, 01:21
I've another question for you neuron. Umm, what is the question?
Rockas
20th March 2006, 01:34
@neuron2
don't you know any similar (to DGIndex) tool that deals with AVI?
What I mean by similar is a tool that gets the same info :D
Guest
20th March 2006, 01:36
@neuron2
don't you know any similar (to DGIndex) tool that deals with AVI?
What I mean by similar is a tool that gets the same info Way off topic for this thread, friend.
Amnon82
20th March 2006, 01:39
Upps, sorry. I ment with this
Till now I'm using this code to get TFF and BFF:
if pos(uppercase('2'),uppercase(listbox1.items[i])) > 0 then two:=two+1;
if pos(uppercase('0'),uppercase(listbox1.items[i])) > 0 then two:=zero+1;
if two > zero then radiobutton1.checked:=true else radiobutton2.checked:=true;
Look there (http://forum.doom9.org/showpost.php?p=714618&postcount=7)
... is this code right? I hope the bit operation code is also right.
Guest
20th March 2006, 04:19
... is this code right? I hope the bit operation code is also right. There's too much context missing for me to do more than make a few comments. Certainly, I can't see *any* bit operations in that last code fragment.
Why would you try to convert '0' and '2' to uppercase?
Seems to me that Pos() is just going to test if a '2' is present, i.e., in either the least significant or the most significant nibble of the flags byte. But it is only the least significant nibble of the flags byte that should be considered. You should use bit operations as I showed in an earlier post.
You are missing cases for '1' and '3'. A clip starting with a BFF repeat (1) is BFF. A clip starting with a TFF repeat (3) is TFF.
I'll just warn you that you have to be careful in interpreting the meaning of the TFF flag when pulldown is present. For example, a clip may start off as TFF (2). Then say a TFF repeat occurs (3). Now, strangely, the next frame will be flagged as BFF (0) even though it is continuing a TFF sequence!
And here's something else to think about... An MPEG2 clip can change field order anywhere at any time:
000000000002222222222222222...
It's OK as long as the display process skips or repeats a field so that a strict field alternation is preserved. But if you convert such a clip to AVI and do not correct that, you'll have a mess (that's why DGIndex has the 'Correct Field Order' option). Also, how would you report a clip like the one above, TFF or BFF?
My policy to avoid all these complications is to look at just the flags byte of the first encoded picture. If it is TFF, then the clip is called TFF.
Amnon82
20th March 2006, 11:59
Ok. For the PFF thing.
That was your code:
if val and $40 > 0 then
pff := 1
else
pff := 0;
This is my code for this:
if pos(uppercase('Frame_Rate'),uppercase(listbox1.items[i])) > 0 then {nothing} else
if pos(uppercase(' '),uppercase(listbox1.items[i])) > 0 then
begin
temp:=listbox1.Items[i];
for tempi := 7 to length(temp) do
begin
value:=GetTok(temp, tempi, ' ');
if hextoint(value) and $40 > 0 then thirtytwo:=thirtytwo+1;
end;
end;
if thirtytwo > 0 then
checkbox1.checked:=true else checkbox1.checked:=false;
First of all I check for ' ' in the strings. So I'll find this lines:
Frame_Rate=25000 (25/1)
d00 1 0 2048 1 1 92 b2 a2 b2 b2 a2 b2 b2 a2 b2 b2 a2
I skip the Frame_Rate line and go for the green values in the next line.
I cut them out (exp. b2) and convert them to hex using this code:
function HexToInt(s: string): Longword;
var
b: Byte;
c: Char;
begin
Result := 0;
s := UpperCase(s);
for b := 1 to Length(s) do
begin
Result := Result * 16;
c := s[b];
case c of
'0'..'9': Inc(Result, Ord(c) - Ord('0'));
'A'..'F': Inc(Result, Ord(c) - Ord('A') + 10);
else
raise EConvertError.Create('No Hex-Number');
end;
end;
end;
Then I'm checking if hextoint(value) and $40 > 0 and count the lines with it in it.
Linescount > 0 then it is PFF.
Did I miss something here or should I only check the first line here?
So the next code is the pos code. I'm only checking if 2 or 0 is present. This is wrong as I read your last post.
So I must check this:
if val and $[value for bit1] > 0 then
tff := 1
else
tff := 0;
Is there a list somewhere to find out what the bits in $values are?
This must be then the code:
if pos(uppercase('Frame_Rate'),uppercase(listbox1.items[i])) > 0 then {nothing} else
if pos(uppercase(' '),uppercase(listbox1.items[i])) > 0 then
begin
temp:=listbox1.Items[i];
for tempi := 7 to length(temp) do
begin
value:=GetTok(temp, tempi, ' ');
if hextoint(value) and $40 > 0 then thirtytwo:=thirtytwo+1;
if hextoint(value) and $02 > 0 then two:=two+1;
if thirtytwo > 0 then checkbox1.checked:=true else checkbox1.checked:=false;
if two > zero then radiobutton1.checked:=true else radiobutton2.checked:=true;
exit;
end;
end;
Bit0 = $01
Bit1 = Bit0*2 > $02
Bit2 = Bit1*2 > $04
Bit3 = Bit2*2 > $10
Bit5 = Bit4*2 > $20
Bit6 = Bit5*2 > $40
$40 = 64
$20 = 32
$10 = 16
$04 = 8
$02 = 4
$01 = 2
Amnon82
20th March 2006, 13:43
I released D2VParse 0.06 and logged the Bits:
Bit6 210 64
Bit1 210 2
Bit6 242 64
Bit1 242 2
Bit6 242 64
Bit1 242 2
Bit6 226 64
Bit1 226 2
Bit6 242 64
Bit1 242 2
Bit6 242 64
Bit1 242 2
Bit6 226 64
Bit1 226 2
Bit6 242 64
Bit1 242 2
Bit6 242 64
Bit1 242 2
Bit6 226 64
Bit1 226 2
Bit6 242 64
Bit1 242 2
Bit6 226 64
Bit1 226 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 0 64
Bit1 0 2
Bit6 114 64
Bit1 114 2
Am I now on the right way? I think I'm far away from it :(. Something is still wrong cos Bit6 and Bit1 are always the same ... or is it right now? It is the first time for me using bit operations. Do you know any tuts?
Take a look on the source ...
Rockas
20th March 2006, 17:18
@neuron2
Way off topic for this thread, friend.
I know... sorry... let's just say that I thought it was a nice way of "pulling you a leg" ;) :D
Amnon82
20th March 2006, 23:12
Marabu from Delphipraxis.net told me that this codes might help:
function HexToInt(s: string): Longword;
var
b: Byte;
c: Char;
begin
Result := 0;
s := UpperCase(s);
for b := 1 to Length(s) do
begin
Result := Result * 16;
c := s[b];
case c of
'0'..'9': Inc(Result, Ord(c) - Ord('0'));
'A'..'F': Inc(Result, Ord(c) - Ord('A') + 10);
else
raise EConvertError.Create('No Hex-Number');
end;
end;
end;
function TestBit(const c: Cardinal; const bit: Byte): Boolean;
begin
Result := Odd(c shr bit);
end;
function CheckLines(lines: TSTrings): Cardinal;
var
i, j: Integer;
bSkip: Boolean;
s: TStrings;
begin
Result := 0;
s := TStringList.Create;
bSkip := true;
for i := 0 to Pred(lines.Count) do
begin
if not bSkip then
begin
s.DelimitedText := lines[i];
for j := 6 to Pred(s.Count) do
Result := Result + Ord(TestBit(HexToInt(s[j]), 6))
end;
bSkip := bSkip xor (lines[i] = '')
end;
s.Free;
end;
procedure TDemoForm.CheckButtonClick(Sender: TObject);
var
thirtytwo: Cardinal;
begin
thirtytwo := CheckLines(Memo.Lines);
ShowMessage(IntToStr(thirtytwo));
end;
Seems that this line is the call for the bits:
Result := Result + Ord(TestBit(HexToInt(s[j]), 6))
6 should be Bit6, so I used a edit for choosing the value to test.
I added his routine to version 0.06a.
It is slower than my routine and the result is always zero.
Take also a look on the source.
Seems I'm running in the circle ;)
Trahald
9th April 2006, 20:45
are you going to support older d2v formats? (ie dvd2avi , dvd2avidg etc)
Amnon82
9th April 2006, 22:59
Maybe. You can also take a look on this (http://forum.doom9.org/showthread.php?t=109756)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.