asalamon74 / pktriggercord

Remote control for Pentax DSLR cameras
http://pktriggercord.melda.info
GNU Lesser General Public License v3.0
103 stars 38 forks source link

Increase output to file speed #9

Closed nanowish closed 8 years ago

nanowish commented 8 years ago

Hello,

currently output to file (/get from buffer) in jpeg take between 4 and 7 seconds (with my K-5) and seem too long than write to SDcard when I take picture directly from APN. Any tips for increase write speed ? tested write in tmpfs, ssd, sdcard, connecting to USB2.0, USB3.0 ... the bottleneck seem to be from APN buffer to computer. When triggercord write the file can't do more.

tested with: pktriggercord-cli --model=K-5 -i 200 -t 1/2 -r 10 --flash_mode=Manual-RedEye --aperture=4.0 --reconnect -o fwritetest -f

pktriggercord-cli --model=K-5 -i 200 -t 1/2 --flash_mode=Manual-RedEye --aperture=4.0 --reconnect -o fwritetest -f

pktriggercord-cli --model=K-5 -i 200 -t 1/120 --flash_mode=Manual-RedEye --aperture=4.0 --reconnect -o fwritetest -f

pktriggercord-cli --model=K-5 -i 200 -t 1/160 --aperture=4.0 --reconnect -o fwritetest -f

pktriggercord-cli --model=K-5 -i 200 -t 1/160 --aperture=4.0 -o fwritetest -f

pktriggercord-cli -v
pktriggercord-cli 0.84.00

APN setup with this tests

root@orangepipc:/media# pktriggercord-cli --status
pktriggercord-cli: K-5 Connected...
current iso                     : 200
current shutter speed           : 5/10
camera max shutter speed        : 1/180
current aperture                : 4.0
lens max aperture               : 29.0
lens min aperture               : 4.0
set shutter speed               : 5/10
set aperture                    : 4.0
fixed iso                       : 200
auto iso                        : 200-1600
jpeg quality                    : 1
jpeg resolution                 : 10M
jpeg image tone                 : Bright
jpeg saturation                 : 4
jpeg contrast                   : 5
jpeg sharpness                  : 5
jpeg hue                        : 4
zoom                            : 28.13 mm
focus                           : -10
color space                     : AdobeRGB
image format                    : JPEG
raw format                      : DNG
light meter flags               : 16
ec                              : 1.00
custom ev steps                 : 1/3
custom sensitivity steps        : 0
exposure mode                   : 6 (NONE)
user mode flag                  : 3
ae metering mode                : Multi
af mode                         : AF.S
af point select                 : Auto-5
selected af point               : 0
focused af point                : 0
drive mode                      : Single
auto bracket mode               : off
auto bracket picture count      : 0
auto bracket ev                 : 0.30
shake reduction                 : on
white balance mode              : Flash
white balance adjust            : 0
flash mode                      : Manual-RedEye
flash exposure compensation     : 0.00
manual mode ev                  : -1.00
lens                            : smc PENTAX-DA L 18-55mm F3.5-5.6
battery                         : 6.25V 5.99V 6.99V 3.89V

Thank for your work and this software :+1:

asalamon74 commented 8 years ago

4-7 seconds for a jpeg? How long does it take to download a dng?

nanowish commented 8 years ago

Yes for a jpeg.

DNG take more time:

time pktriggercord-cli -r 12 --model=K-5 -i 200 -t 1/160 --aperture=4.0 -o fwritetestdng.dng -f --file_format=DNG
pktriggercord-cli: K-5 Connected...

real    0m11.010s
user    0m0.010s
sys     0m0.360s

file fwritetestdng.dng-0000.dng
fwritetestdng.dng-0000.dng: TIFF image data, big-endian, direntries=38, height=0, bps=0, compression=none, PhotometricIntepretation=RGB, manufacturer=PENTAX             , model=PENTAX K-5         , orientation=upper-left, width=0

-rw-r--r--   1 root root  12M Jun 15 17:22 fwritetestdng.dng-0000.dng

JPEG test:

time pktriggercord-cli -r 12 --model=K-5 -i 200 -t 1/160 --aperture=4.0 -o fwritetestjpeg.jpeg -f --file_format=JPEG
pktriggercord-cli: K-5 Connected...

real    0m7.920s
user    0m0.000s
sys     0m0.210s

-rw-r--r--   1 root root 6.9M Jun 15 17:23 fwritetestjpeg.jpeg-0000.jpg

root@orangepipc:~# file fwritetestjpeg.jpeg-0000.jpg
fwritetestjpeg.jpeg-0000.jpg: JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=17, manufacturer=PENTAX             , model=PENTAX K-5         , orientation=upper-left, xresolution=258, yresolution=266, resolutionunit=2, software=K-5 Ver 1.16           , datetime=2016:06:15 17:22:45], baseline, precision 8, 4928x3264, frames 3
nanowish commented 8 years ago

I added some informations.

Select buffer return many ERROR and takes 3-4 secondes:

Test:
root@belenos:/mnt/pictures# /usr/bin/pktriggercord-cli --model=K-5 -i 400 -t 1/80 -r 16 --flash_mode=Manual-RedEye --aperture=4.0 --reconnect -o testphoto -f --debug |& gawk '{ print strftime(), $0 }' | egrep -E "Select buffer 0,5,0,0|0: Addr: 0x0 Len:"

Fri Jun 17 23:13:57 CEST 2016       Select buffer 0,5,0,0
Fri Jun 17 23:14:01 CEST 2016   0: Addr: 0x0 Len: 0(0x00000000) B=1

Other test:
Fri Jun 17 23:14:14 CEST 2016       Select buffer 0,5,0,0
Fri Jun 17 23:14:17 CEST 2016   0: Addr: 0x0 Len: 0(0x00000000) B=1

Other test:
Fri Jun 17 23:14:25 CEST 2016       Select buffer 0,5,0,0
Fri Jun 17 23:14:29 CEST 2016   0: Addr: 0x0 Len: 0(0x00000000) B=1

Debug output of "Select buffer"

---------------------------
    p->status.bufmask = 1
        Select buffer 0,5,0,0
[C]         _ipslr_write_args(cmd_2 = 0x0, {0x0, 0x5, 0x0, 0x0})
[S]                  >>> [F0 4F 00 00  10 00 00 00]
[S]                  >>> [00 00 00 00  00 00 00 05  00 00 00 00  00 00 00 00]
[C]         command(fd=3, 2, 1, 10)
[S]                  >>> [F0 24 02 01  10 00 00 00]
[C]         get_status(0x3)
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 01]
[R]              => ERROR: 0x01
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [00 00 00 00  00 00 00 00]
[C]     ipslr_buffer_segment_info()
[C]         command(fd=3, 4, 0, 0)
[S]                  >>> [F0 24 04 00  00 00 00 00]
[C]         get_result(0x3)
[S]                  >>> [F0 26 00 00  00 00 00 00]
[S]                  <<< [10 00 00 00  00 00 01 00]
[R]              => [10 00 00 00]
[C]         read_result(0x3, size=16)
[S]                  >>> [F0 49 00 00  10 00 00 00]
[S]                  <<< [00 00 00 02  00 00 00 01  00 00 00 00  00 00 00 00]
[R]              => [00 00 00 02  00 00 00 01  00 00 00 00  00 00 00 00]
    0: Addr: 0x0 Len: 0(0x00000000) B=1
asalamon74 commented 8 years ago

My tests also shoes the select buffer takes quite a long time. The errors are not "real" errors. It only means that we have asked the camera to switch to the buffer, but the camera is not yet ready. If I don't wait till the switch is successful I cannot download the image later.

I've modified the poll interval so I check the result of the buffer switch more often. It increased the speed a bit (maybe 5%) I'm afraid I cannot increase the speed more.