We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

cleverca22
Posts: 9593
Joined: Sat Aug 18, 2012 2:33 pm

mplayer gpu decode support

Sat Nov 23, 2013 3:06 am

ive been working on adding gpu decode to mplayer, and almost have it working
but omx isnt accepting the codec config in ffmpeg's extradata, even though its the identical data to what omxplayer is using

http://ext.earthtools.ca/download/rpi/s ... 1-22.patch
http://ext.earthtools.ca/download/rpi/g ... 1-22.patch

just checkout mplayer, apply the svn patch to it, start the compile and let it grab ffmpeg, then apply the git patch to ffmpeg
after you ./configure --enable-rpi it should be able to attempt gpu decode with -vo rpi -vc ffh264rpi

the current problem is that the codec config data isnt right, and it just comes up as a blank image, sometimes locking the entire system up

right now, its setup to tunnel the video_decode directly to video_render, but it could be modified to function as -vc ffh264rpi -vo xv (or -vo fbdev), and then all mplayer filters would work normally

all the code is based on vdpau, omxplayer, or stuff i wrote from scratch

cleverca22
Posts: 9593
Joined: Sat Aug 18, 2012 2:33 pm

Re: mplayer gpu decode support

Tue Nov 26, 2013 1:02 am

Code: Select all

Thread 4 (Thread 0xb4f86440 (LWP 21906)):
#0  0xb6d64700 in sem_wait@@GLIBC_2.4 () from /lib/arm-linux-gnueabihf/libpthread.so.0
#1  0xb6e4df9c in vcos_semaphore_wait (sem=0x10b037c) at /home/dc4/userland/build/inc/interface/vcos/vcos_platform.h:257
#2  _vcos_thread_sem_wait () at /home/dc4/userland/build/inc/interface/vcos/vcos_platform.h:603
#3  vcos_generic_event_flags_get (flags=0x10b0268, bitmask=2, op=5, suspend=4294967295, retrieved_bits=0xb4f8571c) at /home/dc4/userland/interface/vcos/generic/vcos_generic_event_flags.c:223
#4  0x006c1450 in vcos_event_flags_get (retrieved_events=0xb4f8571c, suspend=4294967295, op=5, requested_events=2, flags=0x10b0268) at /opt/vc/include/interface/vcos/generic/vcos_generic_event_flags.h:118
#5  ilclient_get_output_buffer (comp=0x10b0250, portIndex=131, block=1) at libavcodec/ilclient.c:1313
#6  0x00508704 in rpi_h264_end_frame (avctx=0xfbd790) at libavcodec/rpi_h264.c:88
is it possible to write the slice data for a single frame to video_decode, then read a frame out of it right away?, or you you have to buffer several frames before it outputs?

edit1: ah wait, i forgot to ilclient_enable_port_buffers on port 131, recompile time...
edit2: nope, still nothing
edit3: ah, enable works now, it returns a 0 byte buffer, hmmm

cleverca22
Posts: 9593
Joined: Sat Aug 18, 2012 2:33 pm

Re: mplayer gpu decode support

Fri Dec 13, 2013 7:00 am

ok, i now have full YUV420 frames coming out of the gpu
but due to various factors, its peaking at 10 to 14 fps at 1080p
just not usable at those resolutions, will have to try the EGL stuff

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 35194
Joined: Sat Jul 30, 2011 7:41 pm

Re: mplayer gpu decode support

Fri Dec 13, 2013 8:44 am

cleverca22 wrote:ok, i now have full YUV420 frames coming out of the gpu
but due to various factors, its peaking at 10 to 14 fps at 1080p
just not usable at those resolutions, will have to try the EGL stuff
What factors do you mean? I would expect you should be able to get 1080p30 out of the GPU - or are the problems further down the pipeline.
Software guy, working in the applications team.

cleverca22
Posts: 9593
Joined: Sat Aug 18, 2012 2:33 pm

Re: mplayer gpu decode support

Sun Dec 15, 2013 4:49 pm

i think its ffmpeg trying to copy the whole video frame too many times

need to look at passing arround EGL surface handles, rather then full frames

also, -vo sdl and -vo x11(worst) have identical performance
something in the sdl output module isnt using hardware
and -vo fbdev is just as bad, since it doesnt accept yuv420,it has to colorspace convert in sw
but the key part, is that -vo null cant even get 30 fps, so no vo module is going to be able to perform well enough at 1080

cleverca22
Posts: 9593
Joined: Sat Aug 18, 2012 2:33 pm

Re: mplayer gpu decode support

Tue Dec 17, 2013 3:08 am

i'm also having problems getting the codec to parse intact still

if i hexdump the packets in COMXVideo::Decode i get:

Code: Select all

buffer size 1311747 0.000000
00000000  00 00 02 53 06 05 ff ff 4f dc 45 e9 bd e6 d9 48 ...S....O.E....H
00000010  b7 96 2c d8 20 d9 23 ee ef 78 32 36 34 20 2d 20 ..,. .#..x264 -
buffer size 973108 0.041700
00000000  00 0e d9 30 41 9a 01 00 b2 0a e5 2f a8 27 6e 1d ...0A....../.'n.
00000010  1f 58 2f 1d b9 00 45 fe f8 9c 28 8b 9e e1 37 7b .X/...E...(...7{
buffer size 979120 0.083400
00000000  00 0e f0 ac 41 9a 02 01 28 82 b9 4b 9f 87 1a 01 ....A...(..K....
00000010  86 af 12 b2 1b fc 05 2f 8a 69 5f ff 31 ae 98 ad ......./.i_.1...
buffer size 1033135 0.125100 
00000000  00 0f c3 ab 41 9a 03 01 ac 82 b9 4b b5 73 21 30 ....A......K.s!0
00000010  61 d6 d2 ac 4f 98 05 6c f6 be f9 e5 90 0c c4 c0 a...O..l........
and here is a hexdump of the packets ffmpeg sends into my hwaccel module:

Code: Select all

buffer size 1311144
00000000  65 88 80 20 00 0a e5 2f db 2c 2d af 26 38 bb b8 e.. .../.,-.&8..
00000010  fb aa 26 4c 54 76 05 e7 8f d7 8f e7 39 5b 61 62 ..&LTv......9[ab
00000020  7c 71 30 5a 05 cf 04 6d 52 1a f7 d3 b7 51 7f 68 |q0Z...mR....Q.h
00000030  c4 45 e7 1c b6 f4 1e 35 b8 39 73 d2 95 00 8d 09 .E.....5.9s.....
buffer size 973104
00000000  41 9a 01 00 b2 0a e5 2f a8 27 6e 1d 1f 58 2f 1d A....../.'n..X/.
00000010  b9 00 45 fe f8 9c 28 8b 9e e1 37 7b 84 86 3c 68 ..E...(...7{..<h
00000020  46 71 a7 05 ab ed a3 f5 c8 4e 41 29 00 42 ff e9 Fq.......NA).B..
00000030  29 6f b9 6b 3d 02 8a cd 86 5b be c6 12 66 09 26 )o.k=....[...f.&
buffer size 979116
00000000  41 9a 02 01 28 82 b9 4b 9f 87 1a 01 86 af 12 b2 A...(..K........
00000010  1b fc 05 2f 8a 69 5f ff 31 ae 98 ad ae 81 bf fd .../.i_.1.......
00000020  63 26 74 5c dc 97 37 01 1b 6d 6e d8 4b f9 c2 d1 c&t\..7..mn.K...
00000030  67 18 de cd 36 d3 b5 28 c4 f5 21 12 37 51 4a 54 g...6..(..!.7QJT
Movie-Aspect is 1.79:1 - prescaling to correct movie aspect.
VO: [null] 1920x1072 => 1920x1072 Planar YV12
buffer size 1033131% ??% ??,?% 0 0
00000000  41 9a 03 01 ac 82 b9 4b b5 73 21 30 61 d6 d2 ac A......K.s!0a...
00000010  4f 98 05 6c f6 be f9 e5 90 0c c4 c0 46 12 d4 4b O..l........F..K
00000020  5e c1 a7 0a ac 09 27 00 3b f7 c7 0e 81 db fd 42 ^.....'.;......B
00000030  2e e6 c1 41 39 4a ed 27 f1 b9 55 ef 69 c5 86 23 ...A9J.'..U.i..#
ah wait, it looks like a 4 byte size prefix on every block, let me try writing some code for that...

skontel
Posts: 1
Joined: Mon Sep 21, 2015 7:22 am

Re: mplayer gpu decode support

Mon Sep 21, 2015 7:40 am

I know it's an old thread, but I can't find if this ever went anywhere or not.

I have an RPi2 on the way, and 'mplayer' is the first thing I want to run on it, so I'm really curious about this.

Thanks...

gkreidl
Posts: 6345
Joined: Thu Jan 26, 2012 1:07 pm

Re: mplayer gpu decode support

Mon Sep 21, 2015 9:35 am

No, you have to use either omxplayer (command line), omxplayerGUI (desktop, from my kweb package) or kodi (which also uses omxplayer for best video playback).
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Return to “OpenMAX”