New API request for Picasso96 PIP

AmigaOS users can make feature requests in this forum.
Post Reply
User avatar
samo79
Posts: 574
Joined: Fri Jun 17, 2011 11:13 pm
Location: Italy

New API request for Picasso96 PIP

Post by samo79 »

Some time ago I was curious to know why in general videos generated by Hollywood's programs was so slow with the oldest graphics card that we almost use on our machines (R100/R200) so i discover that the reason is the lacks of a proper overlay in Picasso96

As you can see the Hollywood author suggest some (new) implementation to add in Picasso96 (but maybe now directly in graphics.library as Picasso96 turned obsolete?) in order to activate a proper overlay support in Hollywood and so support it correctly also under AmigaOS4 + oldest gfx cards

http://www.hollywood-mal.com/forums/vie ... =10&t=1155


Direct quotation from the Hollywood author:
Hmm, I don't think the Picasso96 PIP APIs are sufficient to achieve what I
want. I'd need the following:

PIP window must be embedded in my main window. This means that clipping
must be done in case the PIP window exceeds the boundaries of my main
window. Consider the following case:

Main window is 800x600
PIP window is 352x288

Now the user moves the PIP window to offset (-100|-100) via Hollywood API
SetVideoPosition(vh, -100, -100) or something. This means that 100 columns
on the left and 100 rows on the top side of the PIP window must be cut off now,
and the factual size of the PIP window is now only 252x188 pixels, although I'm
still feeding 352x288 sized YUV data of course.

The same applies when the user moves the PIP window to offset (700|500).
This would mean that 252 columns on the right side and 188 rows on the bottom
side have to be cut off. The effective size of the PIP window will be 100x100
pixels now.

AFAICS, it's not possible to have Picasso96 API doing this automatically. Instead,
I'd have to do the YUV clipping on my own, then recreate the whole shebang using
the clipped coordinates. This will of course look very quirky when the user is
doing certain things, i.e. he could attach a playing video to the mouse pointer.
As long as no clipping needs to be done, the video will move very smoothly but
as soon as the user starts to move the mouse cursor in a way that the video is
only partly visible, it will get very flickery because the PIP window has to be
destroyed and recreated constantly. Not very good.

What I'd need is a new tag for p96PIP_OpenTagList() that allows me to set a
clipping rectangle. The PIP window should then only fetch YUV data that is
within this clipping rectangle. With such a new tag, translating a PIP window
by (-100|-100) outside of my main window's boundaries, could easily be achieved
by doing something like this:

struct Rect32 rc;

rc.MinX = 100;
rc.MinY = 100;
rc.MaxX = 351;
rc.MaxY = 287;

p96PIP_OpenTags(
P96PIP_SourceWidth, 352,
P96PIP_SourceHeight, 288,
P96PIP_ClipRect, &rc, // PROPOSAL!
P96PIP_Left, 0,
P96PIP_Top, 0,
P96PIP_Width, 252,
P96PIP_Height, 188,
TAG_DONE
...);

CyberGraphX 5 can do all this but I don't see any possibility to do it with
Picasso96 (prove me wrong). So for now, I'll keep the OS4 backend in
software drawing mode until the APIs are more flexible...
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: New API request for Picasso96 PIP

Post by salass00 »

There are already these tags supported in p96PIP_OpenTags(), p96PIP_SetTags() and p96PIP_GetTags():
P96PIP_ClipLeft
P96PIP_ClipTop
P96PIP_ClipWidth
P96PIP_ClipHeight
Has he tried them?
User avatar
samo79
Posts: 574
Joined: Fri Jun 17, 2011 11:13 pm
Location: Italy

Re: New API request for Picasso96 PIP

Post by samo79 »

@salass00

Ok good, however don't know if those are enough..
I just reported this thread to him
User avatar
samo79
Posts: 574
Joined: Fri Jun 17, 2011 11:13 pm
Location: Italy

Re: New API request for Picasso96 PIP

Post by samo79 »

@salass00

Aniway is there (somewhere) any documentation for these P96PIP_ClipXXX tags ?
Apparently he tried but with no luck (Pegasos2 + Radeon 9250)
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: New API request for Picasso96 PIP

Post by salass00 »

@samo79
Aniway is there (somewhere) any documentation for these P96PIP_ClipXXX tags ?
No, they are just mentioned in the Picasso96 include file AFAIK.

Looking at the graphics.library source code again the P96PIP_AllowCropping tag needs to be set to TRUE (defaults to FALSE) for the clip values to have any effect at all.
softwarefailure
Posts: 112
Joined: Fri Feb 14, 2014 10:29 pm

Re: New API request for Picasso96 PIP

Post by softwarefailure »

Yes, I set P96PIP_AllowCropping to TRUE but still can't get it to work. Here's a small demo for you to take a look at to see if I'm doing anything wrong:

Code: Select all

#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

#include <exec/exec.h>
#include <graphics/composite.h>
#include <graphics/gfx.h>
#include <graphics/rpattr.h>
#include <intuition/intuition.h>
#include <intuition/IntuitionBase.h>
#include <intuition/screens.h>

#include <proto/cybergraphics.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/graphics.h>
#include <proto/intuition.h>
#include <proto/picasso96api.h>

struct Library *IntuitionBase = NULL;
struct IntuitionIFace *IIntuition = NULL;

struct Library *GfxBase = NULL;
struct GraphicsIFace *IGraphics = NULL;

struct Library *P96Base = NULL;
struct P96IFace *IP96 = NULL;

static struct Screen *myscr;

static void drawit(struct Window *win)
{
	struct BitMap *bm;
	ULONG lock;
	struct RenderInfo ri;
	int x, y;
	UWORD *ptr;

	p96PIP_GetTags(win, P96PIP_SourceBitMap, (ULONG) &bm, TAG_DONE);

	if(!bm) return;

	if(!(lock = p96LockBitMap(bm, (void *) &ri, sizeof(struct RenderInfo)))) return;

	ptr = (UWORD *) ri.Memory;

	for(y = 0; y < 480; y++) {
		for(x = 0; x < 640; x++) {
			*ptr++ = (x >= 320) ? 0xff00 : 0xff;
		}
		ptr = (UWORD *) (((UBYTE *) ri.Memory) + y * ri.BytesPerRow);
	}

	p96UnlockBitMap(bm, lock);
}

int main(int argc, char *argv[])
{
	struct Window *win;
 	ULONG ilock;
	struct IntuiMessage *msg;
	int quit = 0;

	IntuitionBase = OpenLibrary("intuition.library", 53);
	IIntuition = (struct IntuitionIFace *) GetInterface(IntuitionBase, "main", 1, NULL);

	GfxBase = (struct Library *) OpenLibrary("graphics.library", 0);
	IGraphics = (struct GraphicsIFace *) GetInterface(GfxBase, "main", 1, NULL);

	P96Base = OpenLibrary("Picasso96API.library", 0);
	IP96 = (struct P96IFace *) GetInterface(P96Base, "main", 1, NULL);

	ilock = LockIBase(0);
	myscr = ((struct IntuitionBase *) IntuitionBase)->ActiveScreen;
	UnlockIBase(ilock);

	win = p96PIP_OpenTags(P96PIP_SourceFormat, RGBFB_R5G6B5,
		P96PIP_SourceWidth, 640,
		P96PIP_SourceHeight, 480,
		P96PIP_ClipLeft, 320,
		P96PIP_ClipWidth, 320,
		P96PIP_AllowCropping, TRUE,
		WA_InnerWidth, 320,
		WA_CustomScreen, (ULONG) myscr,
		WA_Left, 100,
		WA_Top, 100,
		WA_SimpleRefresh, TRUE,
		WA_CloseGadget, TRUE,
		WA_DepthGadget, TRUE,
		WA_DragBar, TRUE,
		WA_Borderless, FALSE,
		WA_SizeGadget, FALSE,
		WA_Activate, TRUE,
		WA_StayTop, TRUE,
		WA_IDCMP, IDCMP_CLOSEWINDOW,
		TAG_DONE);

	while(!quit) {

		while((msg = (struct IntuiMessage *) GetMsg(win->UserPort)) != NULL) {

			if(msg->Class == IDCMP_CLOSEWINDOW) quit = 1;

			ReplyMsg((struct Message *) msg);
		}

		drawit(win);

		WaitTOF();
	}

	p96PIP_Close(win);

	DropInterface((struct Interface *) IIntuition);
	CloseLibrary(IntuitionBase);

	DropInterface((struct Interface *) IGraphics);
	CloseLibrary(GfxBase);

	DropInterface((struct Interface *) IP96);
	CloseLibrary(P96Base);

	return 0;
} 
What I want to do in this demo is this: I want to feed 640x480 pixel data to the hardware overlay but only the right half should be visible. The left half is drawn in blue, the right half is drawn in yellow. The blue half shouldn't be visible at all. That's why I set P96PIP_ClipLeft to 320 and P96PIP_ClipWidth to 320. But it doesn't have any effect. The hardware overlay simply scales the pixel buffer down to 320x480 but it's not clipped.

Let me know if I'm doing something wrong here and also check out my other question about P96 PIP windows here:
http://forum.hyperion-entertainment.biz ... =26&t=3275

Tks
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: New API request for Picasso96 PIP

Post by salass00 »

@softwarefailure

Have you tried specifying all four tags?

The tag values are simply being passed on to the graphics driver as is AFAICT (if one is left its value will be 0) so I can't really say much about their use without having access to the driver source code.
softwarefailure
Posts: 112
Joined: Fri Feb 14, 2014 10:29 pm

Re: New API request for Picasso96 PIP

Post by softwarefailure »

I've now tried all 4 tags but it doesn't make a difference. It looks like they're just plainly ignored. At least here on PegasosII Radeon 9250. I don't know about other gfx boards. But since you are a core developer you should be able to find out if these tags actually work anywhere or whether they're just dummies... if you don't have access to the driver sources then please ask somebody who has access and get back to me please :)
User avatar
samo79
Posts: 574
Joined: Fri Jun 17, 2011 11:13 pm
Location: Italy

Re: New API request for Picasso96 PIP

Post by samo79 »

Any news on this :)
Post Reply