Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SG dual view



Hi all,

This is killing me, I have been working on it the entire day, without any result. (except for a nervous breakdown)

THE APPLICATION:
I'm building a small carbon application to test video fx. It's based on the SG calls. To be more specific:
- It uses the default component, in Record mode (without creating a movie) for quick "previewing".
- It has an SGDataProc, which first calls DecompressSequenceBeginS twice (once to preflight the decompress sequence, and once for the draw sequence). After that it calls DecompressSequenceFrameWhen twice (same story).
- By the way, it has an IB interface.
This gives me a nice view of what my iSight is seeing. But...

THE PROBLEM:
Just previewing is not what I want. I used an algorithm in the actual app (this small app is just a testing app) to get access to every pixel, after that give a pointer to the data, and draw it. This went without a preview, so you only saw the transformed data.
In this small app, I want to be able to see both original and transformed data. So quick thinking was just to copy the pixels, and add an extra DecompressSequenceFrameWhen to draw it next to the original view. This obviously didn't work, probably because of borders and stuff (I did get very unsure about things after today).
So I thought, this is only an app for testing, to hell with efficiency then. Thus I added an extra sequence (Two DecompressSequenceBeginS and two DecompressSequenceFrameWhen, just like the original sequence)

This gave me a memory access error (the abort code 11 thing)! And I just did exactly the same functions as in the actual app, but then twice :s

I totally don't know what goes wrong (but that might also be because it seems now that I totally don't know what I'm doing anyhow)

THE SOLUTION:
???

A bit of code to clear this story up a little:

FIRST OF ALL A THE DecompressSequenceBeginS THINGIES FOR THE ORIGINAL VIEW:
(those numbers behind slashes were for personal documentation... order in chaos)

ImageDescriptionHandle imageDesc = (ImageDescriptionHandle)NewHandle(0);
// 12
err = SGGetChannelSampleDescription(c, (Handle)imageDesc);


Rect SourceRect = {0, 0};
MatrixRecord ScaleMatrix;


SourceRect.right = (**imageDesc).width;
SourceRect.bottom = (**imageDesc).height;
// 13
RectMatrix(&ScaleMatrix, &SourceRect, &(inVideoData->DrawBounds));

// 14
err = DecompressSequenceBeginS( &(inVideoData->DecompressSeqID),
imageDesc,
NULL,
NULL,
inVideoData->pGWorld,
NULL,
NULL,
&ScaleMatrix,
srcCopy,
(RgnHandle) NULL,
codecFlagUseImageBuffer,
codecMaxQuality,
anyCodec);
// 15
DisposeHandle((Handle)imageDesc);

//////////

ImageDescriptionHandle pixelDesc = NULL;
// 16
err = MakeImageDescriptionForPixMap(inVideoData->hPixMap, &pixelDesc);

// 17
err = DecompressSequenceBeginS( &(inVideoData->DrawSeqID),
pixelDesc,
NULL,
NULL,
GetWindowPort(inVideoData->wVideoWindow),
NULL,
&(inVideoData->DisplayBounds),
NULL,
srcCopy,
(RgnHandle) NULL,
0,
codecMaxQuality,
anyCodec);

// 18
DisposeHandle((Handle)pixelDesc);


SAME GOES EXACTLY FOR THE TRANSFORMED SEQUENCE, BUT THEN WITH SEPARATE VALUES. IT ALSO HAS A SEPARATE GWORLD OFCOURSE. (IS THAT "OFCOURSE" ?)
THE BOUNDARIES ARE WELL ALIGNED.

SECOND IS THE CONTENT OF THE SGDATAPROC (ONLY FOR THE TRANSFORMED VIEW:

inVideoData->FXFrame = (ARGBPixelRecord*)NewPtrClear(inVideoData->FXDrawSize);

THIS WOULD GIVE ME AN ARRAY TO STORE EVERY PIXEL AS AN ARGB RECORD IN FXFRAME (ARRAY).

err = DecompressSequenceFrameWhen( inVideoData->FXDecompressSeqID,
p,
len,
inFlags,
&outFlags,
NULL,
NULL);



if(inVideoData->FXFrame){
long i, numPixels = inVideoData->FXDrawSize/sizeof(ARGBPixelRecord);
0; i<numPixels; i++)
inVideoData->FXFrame[i] = ((ARGBPixelRecord*)inVideoData->FXpBaseAddr)[i];
}

err = DecompressSequenceFrameWhen( inVideoData->FXDrawSeqID,
(Ptr)inVideoData->FXFrame,
inVideoData->FXDrawSize,
inFlags,
&outFlags,
NULL,
NULL);

BETWEEN THESE FUNCTIONS THE FUNCTION TO COPY THE PIXELS TO THE FXFRAME BUFFER IN ORDER TO WORK WITH IT FREELY.

This at it's own (so a single sequence) works fine. But when I add the second, the whole thing collapses.

My appologies for the long mail, but this is a real pain in the ass for me.
Any help would be greatly appreciated!


Kind regards

Toine Heuvelmans
Student Audio Design (third year)
email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.