CHDK PTP interface - page 72 - General Discussion and Assistance - CHDK Forum supplierdeeply

CHDK PTP interface

  • 1244 Replies
  • 524109 Views
*

Offline srsa_4c

  • ******
  • 4451
Re: CHDK PTP interface
« Reply #710 on: 28 / February / 2012, 19:01:14 »
Advertisements
Some observations, also on A430 ( with correct vid_get_bitmap_active_buffer() and vid_get_bitmap_active_buffer() ).
For me, it appears that when I select a target fps that cannot be reached, the chdkptp ui controls seem to freeze (start to lag, text no longer updates). Clicks on gui elements take effect after some (many seconds) delay when this happens. The camera hasn't crashed since I put the additional functions into lib.c (may be a coincidence).
Below values apply for still image (record) or play mode. Client runs on linux.
transferred    max fps    T/P avg kB/s    Xfer last msec    Xfer last kB/s   
viewfinder3 (barely)~755~310~810
ui overlay4 (5 is unstable)~337~159~530
both2~670~415~835

Camera buttons on the gui have no effect until record mode is activated (but once that happens, they also work in play mode). After reconnecting to a running camera with a previously activated record mode the gui cam buttons also work.
« Last Edit: 28 / February / 2012, 19:49:37 by srsa_4c »

Re: CHDK PTP interface
« Reply #711 on: 28 / February / 2012, 20:12:28 »
The camera hasn't crashed since I put the additional functions into lib.c (may be a coincidence).

Do you mean you actually got the Viewport stream up and running on A430 ?  :blink:
If that's the case, may I ask you for a copy of your lib.c ? Pretty please ?  :-*


*

Offline srsa_4c

  • ******
  • 4451
Re: CHDK PTP interface
« Reply #712 on: 28 / February / 2012, 20:21:41 »
It's all related to the bitmap overlay:
Code: [Select]
void *vid_get_bitmap_active_buffer()
{
    return (void*)(*(int*)0x5EAC); // sub_ffd0cae8 DisplayPhysicalScreenWithYUVPalette
}

void *vid_get_bitmap_active_palette() {
    return (void *)0x714a8; // found also in sub_ffd0cae8
}

int vid_get_palette_type() { return 1; }
int vid_get_palette_size() { return 16*4; }

Re: CHDK PTP interface
« Reply #713 on: 28 / February / 2012, 20:29:41 »
Well, I'll be damned !

here's what I used :
Code: [Select]
// PTP display stuff
int vid_get_palette_type() { return 1; }
int vid_get_palette_size() { return 16*4; }

void *vid_get_bitmap_active_palette() {
    return (void *)0x714A8; // GetPaletteFromPhysicalScreen
}

void *vid_get_bitmap_active_buffer()
{
    return (void*)(*(int*)0x5EAC); // loc_FF90CB50 DisplayPhysicalScreenWithYUVPalette for a430 with ROMSTART = 0xFF800000
}

same offsets...and nothing. No viewport stream without having the camera crashing.

I'll attach my complete inoperative lib.c, for reference's sake. It's a 100b sub, by the way.


*

Offline srsa_4c

  • ******
  • 4451
Re: CHDK PTP interface
« Reply #714 on: 28 / February / 2012, 20:41:21 »
@asmodyne

Are you using the latest reyalp-ptp-live branch with the latest chdkptp (I mean latest svn)?
If your only change was the code in your post, it should be the same as mine.

But it's not.
You only need those (the ones I and also you posted) additional lines in platform/a430/sub/100b/lib.c
vid_get_viewport_fb_d() also needs to be changed or else (as the comment says) playback mode with a movie selected will cause chdkptp's viewfinder transfer to fail.
Diff against reyalp-ptp-live
Code: [Select]
Index: platform/a430/sub/100b/lib.c
===================================================================
--- platform/a430/sub/100b/lib.c (revision 1701)
+++ platform/a430/sub/100b/lib.c (working copy)
@@ -46,7 +46,8 @@
 
 void *vid_get_viewport_fb_d()
 {
-    return (void*)(*(int*)0x71AB0); // @ffd0f29c
+    int x=(*(int*)0x71AB0); // @ffd0f29c
+    return (void*) (x ? x : vid_get_viewport_fb()) ;
 }
 
 long vid_get_viewport_height()
@@ -59,3 +60,15 @@
 {
     return (char*)0x7C588;
 }
+
+void *vid_get_bitmap_active_buffer()
+{
+    return (void*)(*(int*)0x5EAC); // sub_ffd0cae8 DisplayPhysicalScreenWithYUVPalette
+}
+
+void *vid_get_bitmap_active_palette() {
+    return (void *)0x714a8; // found also in sub_ffd0cae8
+}
+
+int vid_get_palette_type() { return 1; }
+int vid_get_palette_size() { return 16*4; }
« Last Edit: 28 / February / 2012, 21:25:45 by srsa_4c »

*

Offline reyalp

  • ******
  • 14118
Re: CHDK PTP interface
« Reply #715 on: 28 / February / 2012, 22:00:51 »
For me, it appears that when I select a target fps that cannot be reached, the chdkptp ui controls seem to freeze (start to lag, text no longer updates).
Yes, this is known. chdkptp is currently dumb, it just runs a timer to read usb and update the live view. This seems to behave particularly badly on linux when the code takes >= the timer interval.
Quote
Camera buttons on the gui have no effect until record mode is activated (but once that happens, they also work in play mode). After reconnecting to a running camera with a previously activated record mode the gui cam buttons also work.
This is normal. On newer (dryos ?) cameras you can use the magic post_levent_to_ui(4484) to unlock. For old cams, I believe switching to rec is the only known method.

I should make chdkptp send the unlock event for cams that support it, somehow.

edit:
I think your transfer rates are as expected for a usb 1 device.
« Last Edit: 28 / February / 2012, 22:04:27 by reyalp »
Don't forget what the H stands for.

Re: CHDK PTP interface
« Reply #716 on: 29 / February / 2012, 10:45:48 »
@srsa_4c

from your diff code :
Code: [Select]
long vid_get_viewport_height()
@@ -59,3 +60,15 @@
 {
     return (char*)0x7C588;
 }

What the actual... ??? What ?  :blink:
So, we're truncating the 32bits reference 0x7C588 to a s8 or (s16*) referenece and return it as a s32 ? Is that it ?  :blink:


Would you mean :
Code: [Select]
long vid_get_viewport_height()
@@ -59,3 +60,15 @@
 {
     return (long)0x7C588;
}

« Last Edit: 29 / February / 2012, 11:07:36 by asmodyne »

*

Offline srsa_4c

  • ******
  • 4451
Re: CHDK PTP interface
« Reply #717 on: 29 / February / 2012, 10:59:36 »
@asmodyne
That was a unified diff. It has since been committed. Get a fresh svn copy, then see that lib.c  :)
« Last Edit: 29 / February / 2012, 11:03:18 by srsa_4c »


Re: CHDK PTP interface
« Reply #718 on: 29 / February / 2012, 11:08:50 »
@asmodyne
That was a unified diff. It has since been committed. Get a fresh svn copy, then see that lib.c  :)

eeeeyup. I'll do that.  ;)

PS : I'm SORRY srsa_4c !  :'( My apologies, if I ever lead readers to think this weird code could have been yours.
« Last Edit: 29 / February / 2012, 12:05:18 by asmodyne »

Re: CHDK PTP interface
« Reply #719 on: 29 / February / 2012, 12:18:28 »
Soo, it seems that the live view works without problem. My "sugacube:D said the average framerate hit 2.98 fps with ChdkPtp only asking for Viewport feed. I think we hit the A430's maximum usb bandwith here (it was the only device on the host's controller).

@reyalp

Next thing, I'll bring myself to undersand the mechanics of the view stream structure (if I want to decode it).
It's in your ChdkPtp/lua sources,  izznit ?
I'll try to implement a proper way to pass the data container's payload directly to a pixel shader (to get an easy-to-use bitmap output).
Will I use DirectX or OpenGL, I still cannot say. I'm a tadbit inclined to use SharpGL though  (i.e openGL).
Anyway, manipulating the live view frames stream is the GPU's job, IMO.
We'll see this weekend.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal