Autor Beitrag
bbfan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164



BeitragVerfasst: Do 03.05.07 12:14 
Hallo!

Beim Grappen eines WebCam Streams kommen bei mir die Daten schon vcRGB Format rüber.
Daher funktioniert das hier nicht mehr:

ausblenden Delphi-Quelltext
1:
ConvertCodecToRGB(FCodec, VideoHDR^.lpData, @FBuf2,PicWidth, PicHeight);					



ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
function ConvertCodecToRGB(Codec: TVideoCodec; Src, Dst: Pointer; AWidth, AHeight: Integer): Boolean;
begin
  Result := True;
  case Codec of
    vcYUY2  : YUY2toRGB (Src, Dst, AWidth, AHeight);
    vcUYVY  : UYVYtoRGB (Src, Dst, AWidth, AHeight);
    vcBTYUV : BTYUVtoRGB(Src, Dst, AWidth, AHeight);
    vcYVU9  : YVU9toRGB(Src, Dst, AWidth, AHeight);
    vcYUV12 : YUV12toRGB(Src, Dst, AWidth, AHeight);
    vcY8    : Y8toRGB (Src, Dst, AWidth, AHeight);
    vcY211  : Y211toRGB(Src, Dst, AWidth, AHeight);
  else
    Result := False;
  end;
end;


Wie kann ich die SRC direkt in die DST kopieren?
bbfan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164



BeitragVerfasst: Do 03.05.07 12:45 
LÖSUNG:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
     if FCodec <> vcRGB then
      begin
        ConvertCodecToRGB(FCodec, VideoHDR^.lpData, @FBuf2,PicWidth, PicHeight);
        for I := 1 to PicHeight do FBuf1[I] := FBuf2[PicHeight -(I-1)];
        FBitmap.PixelFormat := pf32Bit;
        SetBitmapBits(FBitmap.Handle,PicWidth*PicHeight*SizeOf(DWord),@FBuf1);
      end else
       begin
        FBitmap.PixelFormat := pf24Bit;
        SetBitmapBits(FBitmap.Handle,VideoHDR^.dwBufferLength,VideoHDR^.lpData);
       end;



Entscheident ist, dass ein RGB Format mit 24bit dargestellt werden muss und ein YUV2RGB konvertiertes Bild in 32bit.