AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

HEX und String (Bit 6 auslesen)

Ein Thema von Amnon82 · begonnen am 18. Mär 2006 · letzter Beitrag vom 2. Mai 2006
Antwort Antwort
Seite 1 von 2  1 2      
Benutzerbild von Amnon82
Amnon82

Registriert seit: 5. Jan 2005
186 Beiträge
 
FreePascal / Lazarus
 
#1

HEX und String (Bit 6 auslesen)

  Alt 18. Mär 2006, 21:31
Ich hab ein Problem.

Ich code grad an einem kleinen Tool um D2V-Dateien in Delphi zu prasen.

Hier mal die relevanten Auszüge aus dem D2V-Handbuch:

Zitat:
Following is a typical data section (real ones will typically be much longer):
d00 6 0 0 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 384035 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 768034 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 1152609 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 1537064 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0

Therefore, the second line in the typical data section given above would break down as follows:

info matrix file position vob cell flags
d00 6 0 384035 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0

The info field is a 12-bit hex number bit-mapped as follows:

bit 11 1 (Always 1 to signal start of data line)
bit 10 1 (This line's pictures are part of a closed GOP)
0 (Open GOP)
bit 9 1 (This line's pictures are part of a progressive sequence)
0 (Otherwise)
bit 8 1 (This I picture starts a new GOP)
0 (Otherwise)
bits 7-0 0 (Reserved)

The sequence of Flags fields contains per-picture data corresponding to the pictures in display order, that is, the Flags fields are re-ordered into display order. End Of Stream is signaled with a Flags field value of ff. Each per-picture Flags field is an 8-bit hex number bit-mapped as follows:

bit 7 1 (Picture is decodable without the previous GOP)
0 (Otherwise)
bit 6 Progressive_Frame Flag (See notes below)
0 (Interlaced)
1 (Progressive)
bits 5-4 Picture_Coding_Type Flag
00 (Reserved)
01 (I-Frame)
10 (P-Frame)
11 (B-Frame)
bits 3-2 00 (Reserved)
01 (Reserved)
10 (Reserved)
11 (Reserved)
bit 1 TFF Flag
bit 0 RFF Flag
Ich möchte nun gerne den Wert für Bit 6 herausfinden:

bit 6 Progressive_Frame Flag (See notes below)
0 (Interlaced)
1 (Progressive)

Nur wie?

D2VParse Thread @ doom9.org
  Mit Zitat antworten Zitat
Benutzerbild von jfheins
jfheins

Registriert seit: 10. Jun 2004
Ort: Garching (TUM)
4.579 Beiträge
 
#2

Re: HEX und String (Bit 6 auslesen)

  Alt 18. Mär 2006, 21:56
Delphi-Quellcode:
if (value and $00100000) <> 0 then
// Bit gesetzt
  Mit Zitat antworten Zitat
Dax
(Gast)

n/a Beiträge
 
#3

Re: HEX und String (Bit 6 auslesen)

  Alt 18. Mär 2006, 22:01
Bit 6? Julius? War Bit 6 in Hex nicht $40?

Edit: so wie ich das sehe meinst du Bit 1 von Nibble 6
  Mit Zitat antworten Zitat
Benutzerbild von Amnon82
Amnon82

Registriert seit: 5. Jan 2005
186 Beiträge
 
FreePascal / Lazarus
 
#4

Re: HEX und String (Bit 6 auslesen)

  Alt 18. Mär 2006, 22:16
Delphi-Quellcode:
if pos(uppercase(' '),uppercase(listbox1.items[i])) > 0 then
if (strtoint(listbox1.items[i]) and $00100000) <> 0 then checkbox1.checked:=true else checkbox1.checked:=false;
... bringt mich nicht weiter, da Delphi jedes Zeichen einzeln sieht.

Wie komme ich z.B. auf b0? b0 ist doch HEX oder? Mit Copy?

Tempstring > Copy > Value und dann den Code ...
  Mit Zitat antworten Zitat
Benutzerbild von Amnon82
Amnon82

Registriert seit: 5. Jan 2005
186 Beiträge
 
FreePascal / Lazarus
 
#5

Re: HEX und String (Bit 6 auslesen)

  Alt 18. Mär 2006, 22:44
Mit folgenden Codes kann ich nun die Werte in grün auslesen:

d00 1 0 2048 1 1 92 b2 a2 b2 b2 a2 b2 b2 a2 b2 b2 a2

Delphi-Quellcode:
function GetTok(const Str: string; const Idx: Integer; const Sep: Char): string;
var
  StrLen: Integer;
  StrIdx: Integer;
  ResLen: Integer;
  TokIdx: Integer;
begin
  Result := '';
  if Idx > 0 then
  begin
    StrLen := Length(Str);
    SetLength(Result, StrLen);
    ResLen := 0;
    TokIdx := 0;
    for StrIdx := 1 to StrLen do
    begin
      if (Str[StrIdx] <> Sep) and ((StrIdx = 1) or (Str[StrIdx-1] = Sep)) then
        Inc(TokIdx);
      if TokIdx > Idx then
        Break
      else if (TokIdx = Idx) and (Str[StrIdx] <> Sep) then
      begin
        Inc(ResLen);
        Result[ResLen] := Str[StrIdx];
      end;
    end;
    SetLength(Result, ResLen);
  end;
end;
Delphi-Quellcode:
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, ' ');
//Showmessage(value);
if (strtoint(value) and $00100000) <> 0 then checkbox1.checked:=true else checkbox1.checked:=false;
end;
end;
nur value währe kein gültiger integer:

if (strtoint(value) and $00100000) <> 0 then checkbox1.checked:=true else checkbox1.checked:=false;
  Mit Zitat antworten Zitat
Benutzerbild von jfheins
jfheins

Registriert seit: 10. Jun 2004
Ort: Garching (TUM)
4.579 Beiträge
 
#6

Re: HEX und String (Bit 6 auslesen)

  Alt 18. Mär 2006, 22:51
Zitat von Dax:
Bit 6? Julius? War Bit 6 in Hex nicht $40?

Edit: so wie ich das sehe meinst du Bit 1 von Nibble 6
Verdammt, warum kann man nicht in Binär coden ?

Aber Bit 6 ist imho $20 und nicht $40 (Bit 7 ...)

Btw.: Was ist ein Nibble ?
  Mit Zitat antworten Zitat
Dax
(Gast)

n/a Beiträge
 
#7

Re: HEX und String (Bit 6 auslesen)

  Alt 18. Mär 2006, 23:10
Zitat von jfheins:
Aber Bit 6 ist imho $20 und nicht $40 (Bit 7 ...)
Jetzt auf einmal kannstes, oder wie?

Zitat von jfheins:
Btw.: Was ist ein Nibble ?
Ein Nibble ist ein Halbbyte, steht im Wiki
  Mit Zitat antworten Zitat
Benutzerbild von Amnon82
Amnon82

Registriert seit: 5. Jan 2005
186 Beiträge
 
FreePascal / Lazarus
 
#8

Re: HEX und String (Bit 6 auslesen)

  Alt 19. Mär 2006, 08:13
Ich will euch ja nicht unterbrechen , aber könnte mir einer von Euch "Gurus" ein Beispiel posten?
Es könnte ja sein, dass ich mit meinem Ansatz total falsch liege ...

Delphi-Quellcode:
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, ' ');
//Showmessage(value);
i2:=strtoint(Inttohex(strtoint('x'+value),2));
showmessage(inttostr(i2));
if (i2 and $20) <> 0 then checkbox1.checked:=true else checkbox1.checked:=false;
end;
end;
... damit kommt immer noch ne Fehlermeldung alla 'b2' ist ein gülter Integer Wert.
  Mit Zitat antworten Zitat
Benutzerbild von Amnon82
Amnon82

Registriert seit: 5. Jan 2005
186 Beiträge
 
FreePascal / Lazarus
 
#9

Re: HEX und String (Bit 6 auslesen)

  Alt 19. Mär 2006, 08:42
Dann müsste das ja die Lösung sein:

Delphi-Quellcode:
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, ' ');
Showmessage(value+'-'+inttostr($20));
//i2:=strtoint(Inttohex(strtoint('x'+value),2));
//showmessage(inttostr(i2));
//if (i2 and $20) <> 0 then
if value = inttostr($20) then thirtytwo:=thirtytwo+1;
if thirtytwo > 0 then
checkbox1.checked:=true else checkbox1.checked:=false;
end;
end;
Da ja mein zu prasender Text so aussieht:

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
  Mit Zitat antworten Zitat
Benutzerbild von Amnon82
Amnon82

Registriert seit: 5. Jan 2005
186 Beiträge
 
FreePascal / Lazarus
 
#10

Re: HEX und String (Bit 6 auslesen)

  Alt 19. Mär 2006, 20:12
Hmm, stimmt jetzt doch nicht, da folgender Code auch progressiv ist:

Code:
d00 1 0 2048 1 1 d2 f2 f2 e2 f2 f2 e2 f2 f2 e2 f2 e2
900 1 0 65536 1 1 72 72 d2 f2 f2 e2 f2 f2 e2 f2 f2 e2
900 1 0 176128 1 1 72 72 d2 f2 f2 e2 f2 f2 e2 f2 f2 e2
900 1 0 284672 1 1 72 72 d2 f2 f2 e2 f2 f2 e2 f2 f2 e2
900 1 0 391168 1 1 72 72 d2 f2 f2 e2 f2 f2 e2 f2 f2 e2
900 1 0 505856 1 1 72 72 d2 f2 f2 e2 f2 f2 e2 f2 f2 e2
900 1 0 630784 1 1 72 72 d2 f2 f2 e2 f2 f2 e2 f2 f2 e2
900 1 0 794624 1 1 72 d2 f2 f2 e2 e2 f2 f2 e2 f2 f2 e2
900 1 0 1011712 1 1 72 72 d2 f2 f2 e2 f2 e2 f2 f2 e2 e2
900 1 0 1280000 1 1 72 72 d2 f2 e2 f2 f2 e2 e2 f2 f2 e2
900 1 0 1585152 1 1 72 d2 f2 f2 e2 e2 f2 f2 e2 f2 f2 e2
900 1 0 1943552 1 1 72 72 d2 f2 f2 e2 f2 f2 e2 f2 f2 e2
900 1 0 2318336 1 1 72 72 d2 e2 f2 f2 e2 f2 e2 f2 f2 e2
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 2  1 2      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:17 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz