Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-09-13 Thread James Almer
On 9/11/2017 5:21 AM, LongChair . wrote:
> 
> 
> Le 10/09/2017 à 19:13, James Almer a écrit :
>> On 9/9/2017 4:00 AM, LongChair . wrote:
>>> From: LongChair 
>>>
>>> This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
>>> Will return frames holding an AVDRMFrameDescriptor struct in buf[0] that 
>>> allows drm / dmabuf usage.
>>> Was tested on RK3288 (TinkerBoard) and RK3328.
>>>
>>> Changes from Previous patch :
>>> - Frame colorspace info is now filled.
>>> - Frame interlacing is now filled (Note : currently had a bug in mpp which 
>>> will be fixed soon by rockchip, will set the frame to progressive).
>>> - hw_frame_context returns none as format for the rockchip specific 10 bits.
>>> - Added support for MPEG4 codec
>>> - Added support for VP9 codec.
>>> - the ION format has been kept for MPP init (rather than DRM) as this is 
>>> the only one working right, using DRM format will cause assertions upon 
>>> close.
>>> - Other minor comments have been taken into account
>>> ---
>>>  Changelog  |   1 +
>>>  configure  |  16 ++
>>>  libavcodec/Makefile|   5 +
>>>  libavcodec/allcodecs.c |   5 +
>>>  libavcodec/rkmppdec.c  | 584 
>>> +
>>>  5 files changed, 611 insertions(+)
>>>  create mode 100644 libavcodec/rkmppdec.c
>>> +#define RKMPP_DEC(NAME, ID, BSFS) \
>>> +RKMPP_DEC_CLASS(NAME) \
>>> +AVCodec ff_##NAME##_rkmpp_decoder = { \
>>> +.name   = #NAME "_rkmpp", \
>>> +.long_name  = NULL_IF_CONFIG_SMALL(#NAME " (rkmpp)"), \
>>> +.type   = AVMEDIA_TYPE_VIDEO, \
>>> +.id = ID, \
>>> +.priv_data_size = sizeof(RKMPPDecodeContext), \
>>> +.init   = rkmpp_init_decoder, \
>>> +.close  = rkmpp_close_decoder, \
>>> +.receive_frame  = rkmpp_receive_frame, \
>>> +.flush  = rkmpp_flush, \
>>> +.priv_class = _##NAME##_dec_class, \
>>> +.capabilities   = AV_CODEC_CAP_DELAY, \
>> Add AV_CODEC_CAP_AVOID_PROBING as well.
> What would that flag change ?

Avoids using this decoder for probing. Read the flag's doxy in avcodec.h
for the rationale.

>>
>>> +.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS, \
>> It doesn't look like you're setting pkt_dts anywhere?
> True, I can remove that one.
>>
>>> +.pix_fmts   = (const enum AVPixelFormat[]) { 
>>> AV_PIX_FMT_DRM_PRIME, \
>>> + AV_PIX_FMT_NONE}, 
>>> \
>>> +.bsfs   = BSFS, \
>>> +};
>>> +
>>> +RKMPP_DEC(h264,  AV_CODEC_ID_H264,  "h264_mp4toannexb")
>>> +RKMPP_DEC(hevc,  AV_CODEC_ID_HEVC,  "hevc_mp4toannexb")
>>> +RKMPP_DEC(mpeg4, AV_CODEC_ID_MPEG4, NULL)
>>> +RKMPP_DEC(vp8,   AV_CODEC_ID_VP8,   NULL)
>>> +RKMPP_DEC(vp9,   AV_CODEC_ID_VP9,   NULL)
>>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-09-11 Thread LongChair .


Le 10/09/2017 à 19:13, James Almer a écrit :

On 9/9/2017 4:00 AM, LongChair . wrote:


From: LongChair 

This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
Will return frames holding an AVDRMFrameDescriptor struct in buf[0] that allows 
drm / dmabuf usage.
Was tested on RK3288 (TinkerBoard) and RK3328.

Changes from Previous patch :
- Frame colorspace info is now filled.
- Frame interlacing is now filled (Note : currently had a bug in mpp which will 
be fixed soon by rockchip, will set the frame to progressive).
- hw_frame_context returns none as format for the rockchip specific 10 bits.
- Added support for MPEG4 codec
- Added support for VP9 codec.
- the ION format has been kept for MPP init (rather than DRM) as this is the 
only one working right, using DRM format will cause assertions upon close.
- Other minor comments have been taken into account
---
 Changelog  |   1 +
 configure  |  16 ++
 libavcodec/Makefile|   5 +
 libavcodec/allcodecs.c |   5 +
 libavcodec/rkmppdec.c  | 584 +
 5 files changed, 611 insertions(+)
 create mode 100644 libavcodec/rkmppdec.c





+#define RKMPP_DEC(NAME, ID, BSFS) \
+RKMPP_DEC_CLASS(NAME) \
+AVCodec ff_##NAME##_rkmpp_decoder = { \
+.name   = #NAME "_rkmpp", \
+.long_name  = NULL_IF_CONFIG_SMALL(#NAME " (rkmpp)"), \
+.type   = AVMEDIA_TYPE_VIDEO, \
+.id = ID, \
+.priv_data_size = sizeof(RKMPPDecodeContext), \
+.init   = rkmpp_init_decoder, \
+.close  = rkmpp_close_decoder, \
+.receive_frame  = rkmpp_receive_frame, \
+.flush  = rkmpp_flush, \
+.priv_class = _##NAME##_dec_class, \
+.capabilities   = AV_CODEC_CAP_DELAY, \



Add AV_CODEC_CAP_AVOID_PROBING as well.

What would that flag change ?





+.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS, \



It doesn't look like you're setting pkt_dts anywhere?

True, I can remove that one.





+.pix_fmts   = (const enum AVPixelFormat[]) { AV_PIX_FMT_DRM_PRIME, 
\
+ AV_PIX_FMT_NONE}, \
+.bsfs   = BSFS, \
+};
+
+RKMPP_DEC(h264,  AV_CODEC_ID_H264,  "h264_mp4toannexb")
+RKMPP_DEC(hevc,  AV_CODEC_ID_HEVC,  "hevc_mp4toannexb")
+RKMPP_DEC(mpeg4, AV_CODEC_ID_MPEG4, NULL)
+RKMPP_DEC(vp8,   AV_CODEC_ID_VP8,   NULL)
+RKMPP_DEC(vp9,   AV_CODEC_ID_VP9,   NULL)




___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-09-10 Thread James Almer
On 9/9/2017 4:00 AM, LongChair . wrote:
> From: LongChair 
> 
> This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
> Will return frames holding an AVDRMFrameDescriptor struct in buf[0] that 
> allows drm / dmabuf usage.
> Was tested on RK3288 (TinkerBoard) and RK3328.
> 
> Changes from Previous patch :
> - Frame colorspace info is now filled.
> - Frame interlacing is now filled (Note : currently had a bug in mpp which 
> will be fixed soon by rockchip, will set the frame to progressive).
> - hw_frame_context returns none as format for the rockchip specific 10 bits.
> - Added support for MPEG4 codec
> - Added support for VP9 codec.
> - the ION format has been kept for MPP init (rather than DRM) as this is the 
> only one working right, using DRM format will cause assertions upon close.
> - Other minor comments have been taken into account
> ---
>  Changelog  |   1 +
>  configure  |  16 ++
>  libavcodec/Makefile|   5 +
>  libavcodec/allcodecs.c |   5 +
>  libavcodec/rkmppdec.c  | 584 
> +
>  5 files changed, 611 insertions(+)
>  create mode 100644 libavcodec/rkmppdec.c

> +#define RKMPP_DEC(NAME, ID, BSFS) \
> +RKMPP_DEC_CLASS(NAME) \
> +AVCodec ff_##NAME##_rkmpp_decoder = { \
> +.name   = #NAME "_rkmpp", \
> +.long_name  = NULL_IF_CONFIG_SMALL(#NAME " (rkmpp)"), \
> +.type   = AVMEDIA_TYPE_VIDEO, \
> +.id = ID, \
> +.priv_data_size = sizeof(RKMPPDecodeContext), \
> +.init   = rkmpp_init_decoder, \
> +.close  = rkmpp_close_decoder, \
> +.receive_frame  = rkmpp_receive_frame, \
> +.flush  = rkmpp_flush, \
> +.priv_class = _##NAME##_dec_class, \
> +.capabilities   = AV_CODEC_CAP_DELAY, \

Add AV_CODEC_CAP_AVOID_PROBING as well.

> +.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS, \

It doesn't look like you're setting pkt_dts anywhere?

> +.pix_fmts   = (const enum AVPixelFormat[]) { 
> AV_PIX_FMT_DRM_PRIME, \
> + AV_PIX_FMT_NONE}, \
> +.bsfs   = BSFS, \
> +};
> +
> +RKMPP_DEC(h264,  AV_CODEC_ID_H264,  "h264_mp4toannexb")
> +RKMPP_DEC(hevc,  AV_CODEC_ID_HEVC,  "hevc_mp4toannexb")
> +RKMPP_DEC(mpeg4, AV_CODEC_ID_MPEG4, NULL)
> +RKMPP_DEC(vp8,   AV_CODEC_ID_VP8,   NULL)
> +RKMPP_DEC(vp9,   AV_CODEC_ID_VP9,   NULL)
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-09-09 Thread Mark Thompson
On 09/09/17 08:00, LongChair . wrote:
> From: LongChair 
> 
> This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
> Will return frames holding an AVDRMFrameDescriptor struct in buf[0] that 
> allows drm / dmabuf usage.
> Was tested on RK3288 (TinkerBoard) and RK3328.
> 
> Changes from Previous patch :
> - Frame colorspace info is now filled.
> - Frame interlacing is now filled (Note : currently had a bug in mpp which 
> will be fixed soon by rockchip, will set the frame to progressive).
> - hw_frame_context returns none as format for the rockchip specific 10 bits.
> - Added support for MPEG4 codec
> - Added support for VP9 codec.
> - the ION format has been kept for MPP init (rather than DRM) as this is the 
> only one working right, using DRM format will cause assertions upon close.
> - Other minor comments have been taken into account
> ---

Patch looks pretty good now (some minor issues below); mainly I've been testing 
it.


Is VP9 supported by the RK3288?  Trying to use it (both 8- and 10-bit) I get:

[ 5110.660270] rk-vcodec ff9a.vpu-service: can not find -22 buffer in list
[ 5110.666094] rk-vcodec ff9a.vpu-service: reg 28 fd 4 ion map iommu failed
[ 5110.673203] rk-vcodec ff9a.vpu-service: can not find -22 buffer in list
[ 5110.679026] rk_vcodec: reg_init:1242: error: translate reg address failed, 
dumping regs
[ 5110.683991] Unhandled fault: page domain fault (0x01b) at 0x81817360
[ 5110.688851] pgd = ec7e4000
[ 5110.693709] [81817360] *pgd=2a81c831, *pte=3a4f675f, *ppte=3a4f6c7f
... lots of dump ...
[ 5111.257947] Process mpp_dec_parser (pid: 14424, stack limit = 0xdd85a218)
... lots of dump ...
[ 5111.362078] [] (reg_init) from [] 
(vpu_service_ioctl+0x298/0x744)
[ 5111.367023] [] (vpu_service_ioctl) from [] 
(do_vfs_ioctl+0x5b0/0x690)
[ 5111.371974] [] (do_vfs_ioctl) from [] 
(SyS_ioctl+0x5c/0x84)
[ 5111.376956] [] (SyS_ioctl) from [] 
(ret_fast_syscall+0x0/0x3c)
[ 5111.381917] Code: e51b3108 e1a02006 e51b00e0 e1a01007 (e7933106) 
[ 5111.386917] ---[ end trace 866a2bbc379f58ce ]---
[ 5115.649373] rk-vcodec ff9a.vpu-service: closed

The ffmpeg process then has to be killed.

If VP9 isn't supported, can we determine that somehow and not try to decode at 
all?

I can't get MPEG-4 part 2 to work either.  I get a lot of timeouts, then maybe 
a lot of green frames?  (Tried a few files.)

H.264, H.265 and VP8 still work for me.


The output for H.264 (didn't look at others carefully here) seems to be missing 
some frames.  For example, if I decode , there 
should be 17 frames in the output, but h264_rkmpp only gives me 4.

Running:

./ffmpeg_g -y -c:v h264_rkmpp -i ~/test/NL1_Sony_D.jsv -an -vf 
hwdownload,format=nv12,format=yuv420p out_hw.yuv
./ffmpeg_g -y -i ~/test/NL1_Sony_D.jsv -an out_sw.yuv

$ ls -l out_*
-rw-r--r-- 1 linaro linaro 152064 Sep  9 12:45 out_hw.yuv
-rw-r--r-- 1 linaro linaro 646272 Sep  9 12:44 out_sw.yuv

The missing frames seem to be the ones at the beginning of the stream:

$ cmp out_sw.yuv out_hw.yuv 
out_sw.yuv out_hw.yuv differ: byte 1, line 1
$ cmp out_sw.yuv out_hw.yuv 494208 0
$ 

>  Changelog  |   1 +
>  configure  |  16 ++
>  libavcodec/Makefile|   5 +
>  libavcodec/allcodecs.c |   5 +
>  libavcodec/rkmppdec.c  | 584 
> +
>  5 files changed, 611 insertions(+)
>  create mode 100644 libavcodec/rkmppdec.c
> 
> diff --git a/Changelog b/Changelog
> index 189a803..ccf78b2 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -44,6 +44,7 @@ version :
>  - drop deprecated qtkit input device (use avfoundation instead)
>  - despill video filter
>  - haas audio filter
> +- Rockchip MPP hardware decoding
>  
>  version 3.3:
>  - CrystalHD decoder moved to new decode API
> diff --git a/configure b/configure
> index 3ba27c5..cbff908 100755
> --- a/configure
> +++ b/configure
> @@ -314,6 +314,7 @@ External library support:
>--disable-nvenc  disable Nvidia video encoding code [autodetect]
>--enable-omx enable OpenMAX IL code [no]
>--enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
> +  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
>--disable-vaapi  disable Video Acceleration API (mainly 
> Unix/Intel) code [autodetect]
>--disable-vdadisable Apple Video Decode Acceleration code 
> [autodetect]
>--disable-vdpau  disable Nvidia Video Decode and Presentation API 
> for Unix code [autodetect]
> @@ -1545,6 +1546,7 @@ EXTERNAL_LIBRARY_VERSION3_LIST="
>  libopencore_amrnb
>  libopencore_amrwb
>  libvo_amrwbenc
> +rkmpp
>  "
>  
>  EXTERNAL_LIBRARY_GPLV3_LIST="
> @@ -2774,6 +2776,8 @@ h264_qsv_decoder_deps="libmfx"
>  h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec 
> h264_qsv_hwaccel"
>  h264_qsv_encoder_deps="libmfx"
>  h264_qsv_encoder_select="qsvenc"
> +h264_rkmpp_decoder_deps="rkmpp"
> 

[FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-09-09 Thread LongChair .
From: LongChair 

This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
Will return frames holding an AVDRMFrameDescriptor struct in buf[0] that allows 
drm / dmabuf usage.
Was tested on RK3288 (TinkerBoard) and RK3328.

Changes from Previous patch :
- Frame colorspace info is now filled.
- Frame interlacing is now filled (Note : currently had a bug in mpp which will 
be fixed soon by rockchip, will set the frame to progressive).
- hw_frame_context returns none as format for the rockchip specific 10 bits.
- Added support for MPEG4 codec
- Added support for VP9 codec.
- the ION format has been kept for MPP init (rather than DRM) as this is the 
only one working right, using DRM format will cause assertions upon close.
- Other minor comments have been taken into account
---
 Changelog  |   1 +
 configure  |  16 ++
 libavcodec/Makefile|   5 +
 libavcodec/allcodecs.c |   5 +
 libavcodec/rkmppdec.c  | 584 +
 5 files changed, 611 insertions(+)
 create mode 100644 libavcodec/rkmppdec.c

diff --git a/Changelog b/Changelog
index 189a803..ccf78b2 100644
--- a/Changelog
+++ b/Changelog
@@ -44,6 +44,7 @@ version :
 - drop deprecated qtkit input device (use avfoundation instead)
 - despill video filter
 - haas audio filter
+- Rockchip MPP hardware decoding
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/configure b/configure
index 3ba27c5..cbff908 100755
--- a/configure
+++ b/configure
@@ -314,6 +314,7 @@ External library support:
   --disable-nvenc  disable Nvidia video encoding code [autodetect]
   --enable-omx enable OpenMAX IL code [no]
   --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
+  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
   --disable-vaapi  disable Video Acceleration API (mainly Unix/Intel) 
code [autodetect]
   --disable-vdadisable Apple Video Decode Acceleration code 
[autodetect]
   --disable-vdpau  disable Nvidia Video Decode and Presentation API 
for Unix code [autodetect]
@@ -1545,6 +1546,7 @@ EXTERNAL_LIBRARY_VERSION3_LIST="
 libopencore_amrnb
 libopencore_amrwb
 libvo_amrwbenc
+rkmpp
 "
 
 EXTERNAL_LIBRARY_GPLV3_LIST="
@@ -2774,6 +2776,8 @@ h264_qsv_decoder_deps="libmfx"
 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec 
h264_qsv_hwaccel"
 h264_qsv_encoder_deps="libmfx"
 h264_qsv_encoder_select="qsvenc"
+h264_rkmpp_decoder_deps="rkmpp"
+h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
 h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
 h264_vaapi_encoder_select="vaapi_encode golomb"
 h264_vda_decoder_deps="vda"
@@ -2789,6 +2793,8 @@ hevc_qsv_decoder_deps="libmfx"
 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec 
hevc_qsv_hwaccel"
 hevc_qsv_encoder_deps="libmfx"
 hevc_qsv_encoder_select="hevcparse qsvenc"
+hevc_rkmpp_decoder_deps="rkmpp"
+hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf"
 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
 hevc_vaapi_encoder_select="vaapi_encode golomb"
 mjpeg_cuvid_decoder_deps="cuda cuvid"
@@ -2812,6 +2818,7 @@ mpeg4_cuvid_decoder_deps="cuda cuvid"
 mpeg4_mediacodec_decoder_deps="mediacodec"
 mpeg4_mmal_decoder_deps="mmal"
 mpeg4_omx_encoder_deps="omx"
+mpeg4_rkmpp_decoder_deps="rkmpp"
 mpeg4_vdpau_decoder_deps="vdpau"
 mpeg4_vdpau_decoder_select="mpeg4_decoder"
 mpeg_vdpau_decoder_deps="vdpau"
@@ -2828,10 +2835,12 @@ vp8_cuvid_decoder_deps="cuda cuvid"
 vp8_mediacodec_decoder_deps="mediacodec"
 vp8_qsv_decoder_deps="libmfx"
 vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser"
+vp8_rkmpp_decoder_deps="rkmpp"
 vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
 vp8_vaapi_encoder_select="vaapi_encode"
 vp9_cuvid_decoder_deps="cuda cuvid"
 vp9_mediacodec_decoder_deps="mediacodec"
+vp9_rkmpp_decoder_deps="rkmpp"
 vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9"
 vp9_vaapi_encoder_select="vaapi_encode"
 wmv3_crystalhd_decoder_select="crystalhd"
@@ -6032,6 +6041,13 @@ enabled openssl   && { use_pkg_config openssl 
openssl/ssl.h OPENSSL_init
check_lib openssl openssl/ssl.h 
SSL_library_init -lssl32 -leay32 ||
check_lib openssl openssl/ssl.h 
SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
+enabled rkmpp && { { require_pkg_config rockchip_mpp 
rockchip/rk_mpi.h mpp_create ||
+ die "ERROR : Rockchip MPP was not found."; } 
&&
+   { check_func_headers rockchip/rk_mpi_cmd.h 
"MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" ||
+ die "ERROR: Rockchip MPP is outdated, please 
get a more recent one."; } &&
+   { enabled libdrm ||
+ die "ERROR: rkmpp requires 

Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-09-05 Thread wm4
On Tue, 5 Sep 2017 20:19:09 +0100
Mark Thompson  wrote:

> On 05/09/17 19:55, LongChair . wrote:> Le 05/09/2017 à 19:19, Mark Thompson a 
> écrit :
> >> On 05/09/17 12:44, LongChair . wrote:  
> >>> From: LongChair 
> >>>
> >>> This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
> >>> Will return frames holding an AVDRMFrameDescriptor struct in buf[0] that 
> >>> allows drm / dmabuf usage.
> >>> Was tested on RK3288 (TinkerBoard) and RK3328.
> >>> ---
> >>>   Changelog  |   1 +
> >>>   configure  |  15 +-
> >>>   libavcodec/Makefile|   3 +
> >>>   libavcodec/allcodecs.c |   3 +
> >>>   libavcodec/rkmppdec.c  | 567 
> >>> +
> >>>   5 files changed, 588 insertions(+), 1 deletion(-)
> >>>   create mode 100644 libavcodec/rkmppdec.c
> >>>
> >>> ...
> >>> @@ -6008,7 +6016,12 @@ enabled openssl   && { use_pkg_config 
> >>> openssl openssl/ssl.h OPENSSL_init
> >>>  check_lib openssl openssl/ssl.h 
> >>> SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
> >>>  die "ERROR: openssl not found"; }
> >>>   enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || 
> >>> disable qtkit_indev; }
> >>> -  
> 
> Oops, sorry, that wasn't very clear.  I meant leave this ^ blank line, and 
> put your check above it.  The form of it in the patch is fine.
> 
> >>> +enabled rkmpp && { { require_pkg_config rockchip_mpp 
> >>> rockchip/rk_mpi.h mpp_create ||
> >>> + die "ERROR : Rockchip MPP was not 
> >>> found."; }  &&
> >>> +   { check_func_headers 
> >>> rockchip/rk_mpi_cmd.h "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" ||
> >>> + die "ERROR: Rockchip MPP is outdated, 
> >>> please get a more recent one."; } &&
> >>> +   { enabled libdrm || die "ERROR: rkmpp 
> >>> requires --enable-libdrm"; }
> >>> + }  
> >> Keep the blank line after the list of normal checks and before the more 
> >> complex cases below.  
> > i Hope something like this makes it more readable :
> > 
> > enabled rkmpp && {
> > 
> > { require_pkg_config rockchip_mpp 
> > rockchip/rk_mpi.h mpp_create ||
> > 
> >   die "ERROR : Rockchip MPP was not 
> > found."; }
> > 
> >&&   { check_func_headers rockchip/rk_mpi_cmd.h 
> > "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" ||
> > 
> >   die "ERROR: Rockchip MPP is outdated, 
> > please get a more recent one."; }
> > 
> >&&   { enabled libdrm ||
> > 
> >   die "ERROR: rkmpp requires 
> > --enable-libdrm"; }
> > 
> >   }
> >   
> >> Also needs a rebase - qtkit_indev was removed.  
> > Will rebase  
> >>> ...
> >>> +
> >>> +// setup general frame fields
> >>> +frame->format   = AV_PIX_FMT_DRM_PRIME;
> >>> +frame->width= mpp_frame_get_width(mppframe);
> >>> +frame->height   = mpp_frame_get_height(mppframe);
> >>> +frame->pts  = mpp_frame_get_pts(mppframe);  
> >> Can you get other frame metadata here?  (SAR, all of the colour stuff?)  
> > well there are a few other functions that i didn't use that seem to be 
> > colorspace related here 
> > https://github.com/rockchip-linux/mpp/blob/30032ae303956788bd5b709c9bc70867b0ea95d6/inc/mpp_frame.h#L242-L253
> > I never looked into those yet, but if you feel like some would be 
> > helpful and important I could have another looks there.  
> >> Does anything sensible happen with interlaced streams?  
> > there are flags defined for this in the MPP headers, but i don't know if 
> > they are effectively used in MppFrame. Would need to check further.
> > https://github.com/rockchip-linux/mpp/blob/30032ae303956788bd5b709c9bc70867b0ea95d6/inc/mpp_frame.h#L28-L43
> >   
> 
> Yes, exactly those - all five of the colour-related functions.  (I see the 
> point made earlier that this file is oddly reminiscent of libavutil/pixfmt.h 
> (including the comments), so you can probably just put the values directly 
> into the AVFrame fields...)

Well, in both cases, they're probably just the bitstream values.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-09-05 Thread Mark Thompson
On 05/09/17 19:55, LongChair . wrote:> Le 05/09/2017 à 19:19, Mark Thompson a 
écrit :
>> On 05/09/17 12:44, LongChair . wrote:
>>> From: LongChair 
>>>
>>> This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
>>> Will return frames holding an AVDRMFrameDescriptor struct in buf[0] that 
>>> allows drm / dmabuf usage.
>>> Was tested on RK3288 (TinkerBoard) and RK3328.
>>> ---
>>>   Changelog  |   1 +
>>>   configure  |  15 +-
>>>   libavcodec/Makefile|   3 +
>>>   libavcodec/allcodecs.c |   3 +
>>>   libavcodec/rkmppdec.c  | 567 
>>> +
>>>   5 files changed, 588 insertions(+), 1 deletion(-)
>>>   create mode 100644 libavcodec/rkmppdec.c
>>>
>>> ...
>>> @@ -6008,7 +6016,12 @@ enabled openssl   && { use_pkg_config 
>>> openssl openssl/ssl.h OPENSSL_init
>>>  check_lib openssl openssl/ssl.h 
>>> SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
>>>  die "ERROR: openssl not found"; }
>>>   enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
>>> qtkit_indev; }
>>> -

Oops, sorry, that wasn't very clear.  I meant leave this ^ blank line, and put 
your check above it.  The form of it in the patch is fine.

>>> +enabled rkmpp && { { require_pkg_config rockchip_mpp 
>>> rockchip/rk_mpi.h mpp_create ||
>>> + die "ERROR : Rockchip MPP was not 
>>> found."; }  &&
>>> +   { check_func_headers rockchip/rk_mpi_cmd.h 
>>> "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" ||
>>> + die "ERROR: Rockchip MPP is outdated, 
>>> please get a more recent one."; } &&
>>> +   { enabled libdrm || die "ERROR: rkmpp 
>>> requires --enable-libdrm"; }
>>> + }
>> Keep the blank line after the list of normal checks and before the more 
>> complex cases below.
> i Hope something like this makes it more readable :
> 
> enabled rkmpp && {
> 
> { require_pkg_config rockchip_mpp 
> rockchip/rk_mpi.h mpp_create ||
> 
>   die "ERROR : Rockchip MPP was not found."; }
> 
>&&   { check_func_headers rockchip/rk_mpi_cmd.h 
> "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" ||
> 
>   die "ERROR: Rockchip MPP is outdated, 
> please get a more recent one."; }
> 
>&&   { enabled libdrm ||
> 
>   die "ERROR: rkmpp requires 
> --enable-libdrm"; }
> 
>   }
> 
>> Also needs a rebase - qtkit_indev was removed.
> Will rebase
>>> ...
>>> +
>>> +// setup general frame fields
>>> +frame->format   = AV_PIX_FMT_DRM_PRIME;
>>> +frame->width= mpp_frame_get_width(mppframe);
>>> +frame->height   = mpp_frame_get_height(mppframe);
>>> +frame->pts  = mpp_frame_get_pts(mppframe);
>> Can you get other frame metadata here?  (SAR, all of the colour stuff?)
> well there are a few other functions that i didn't use that seem to be 
> colorspace related here 
> https://github.com/rockchip-linux/mpp/blob/30032ae303956788bd5b709c9bc70867b0ea95d6/inc/mpp_frame.h#L242-L253
> I never looked into those yet, but if you feel like some would be 
> helpful and important I could have another looks there.
>> Does anything sensible happen with interlaced streams?
> there are flags defined for this in the MPP headers, but i don't know if 
> they are effectively used in MppFrame. Would need to check further.
> https://github.com/rockchip-linux/mpp/blob/30032ae303956788bd5b709c9bc70867b0ea95d6/inc/mpp_frame.h#L28-L43

Yes, exactly those - all five of the colour-related functions.  (I see the 
point made earlier that this file is oddly reminiscent of libavutil/pixfmt.h 
(including the comments), so you can probably just put the values directly into 
the AVFrame fields...)

>>> ...
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-09-05 Thread LongChair .


Le 05/09/2017 à 19:19, Mark Thompson a écrit :
> On 05/09/17 12:44, LongChair . wrote:
>> From: LongChair 
>>
>> This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
>> Will return frames holding an AVDRMFrameDescriptor struct in buf[0] that 
>> allows drm / dmabuf usage.
>> Was tested on RK3288 (TinkerBoard) and RK3328.
>> ---
>>   Changelog  |   1 +
>>   configure  |  15 +-
>>   libavcodec/Makefile|   3 +
>>   libavcodec/allcodecs.c |   3 +
>>   libavcodec/rkmppdec.c  | 567 
>> +
>>   5 files changed, 588 insertions(+), 1 deletion(-)
>>   create mode 100644 libavcodec/rkmppdec.c
>>
>> diff --git a/Changelog b/Changelog
>> index 1dfb8b5..622e5d0 100644
>> --- a/Changelog
>> +++ b/Changelog
>> @@ -35,6 +35,7 @@ version :
>>   - pseudocolor video filter
>>   - raw G.726 muxer and demuxer, left- and right-justified
>>   - NewTek NDI input/output device
>> +- Addition of Rockchip MPP hardware decoding
> Use the same style as other entries, so just state what has been added; i.e. 
> "- Rockchip MPP hardware decoder".
Ok no problem.
>>   version 3.3:
>>   - CrystalHD decoder moved to new decode API
>> diff --git a/configure b/configure
>> index ebd561d..1df5763 100755
>> --- a/configure
>> +++ b/configure
>> @@ -307,6 +307,7 @@ External library support:
>> --disable-nvenc  disable Nvidia video encoding code [autodetect]
>> --enable-omx enable OpenMAX IL code [no]
>> --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
>> +  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
>> --disable-vaapi  disable Video Acceleration API (mainly 
>> Unix/Intel) code [autodetect]
>> --disable-vdadisable Apple Video Decode Acceleration code 
>> [autodetect]
>> --disable-vdpau  disable Nvidia Video Decode and Presentation 
>> API for Unix code [autodetect]
>> @@ -1520,6 +1521,7 @@ EXTERNAL_LIBRARY_VERSION3_LIST="
>>   libopencore_amrnb
>>   libopencore_amrwb
>>   libvo_amrwbenc
>> +rkmpp
>>   "
>>   
>>   EXTERNAL_LIBRARY_GPLV3_LIST="
>> @@ -2757,6 +2759,8 @@ h264_qsv_decoder_deps="libmfx"
>>   h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec 
>> h264_qsv_hwaccel"
>>   h264_qsv_encoder_deps="libmfx"
>>   h264_qsv_encoder_select="qsvenc"
>> +h264_rkmpp_decoder_deps="rkmpp"
>> +h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
>>   h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
>>   h264_vaapi_encoder_select="vaapi_encode golomb"
>>   h264_vda_decoder_deps="vda"
>> @@ -2772,6 +2776,8 @@ hevc_qsv_decoder_deps="libmfx"
>>   hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec 
>> hevc_qsv_hwaccel"
>>   hevc_qsv_encoder_deps="libmfx"
>>   hevc_qsv_encoder_select="hevcparse qsvenc"
>> +hevc_rkmpp_decoder_deps="rkmpp"
>> +hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf"
>>   hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
>>   hevc_vaapi_encoder_select="vaapi_encode golomb"
>>   mjpeg_cuvid_decoder_deps="cuda cuvid"
>> @@ -2811,6 +2817,8 @@ vp8_cuvid_decoder_deps="cuda cuvid"
>>   vp8_mediacodec_decoder_deps="mediacodec"
>>   vp8_qsv_decoder_deps="libmfx"
>>   vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser"
>> +vp8_rkmpp_decoder_deps="rkmpp"
>> +vp8_rkmpp_decoder_select="rkmpp"
> I think this line isn't wanted?
Yeah, missed that one :)
>
>>   vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
>>   vp8_vaapi_encoder_select="vaapi_encode"
>>   vp9_cuvid_decoder_deps="cuda cuvid"
>> @@ -6008,7 +6016,12 @@ enabled openssl   && { use_pkg_config openssl 
>> openssl/ssl.h OPENSSL_init
>>  check_lib openssl openssl/ssl.h 
>> SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
>>  die "ERROR: openssl not found"; }
>>   enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
>> qtkit_indev; }
>> -
>> +enabled rkmpp && { { require_pkg_config rockchip_mpp 
>> rockchip/rk_mpi.h mpp_create ||
>> + die "ERROR : Rockchip MPP was not found."; 
>> }  &&
>> +   { check_func_headers rockchip/rk_mpi_cmd.h 
>> "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" ||
>> + die "ERROR: Rockchip MPP is outdated, 
>> please get a more recent one."; } &&
>> +   { enabled libdrm || die "ERROR: rkmpp 
>> requires --enable-libdrm"; }
>> + }
> Keep the blank line after the list of normal checks and before the more 
> complex cases below.
i Hope something like this makes it more readable :

enabled rkmpp && {

    { require_pkg_config rockchip_mpp 
rockchip/rk_mpi.h mpp_create ||

  die "ERROR : Rockchip MPP was not found."; }

   &&  

Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-09-05 Thread Mark Thompson
On 05/09/17 12:44, LongChair . wrote:
> From: LongChair 
> 
> This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
> Will return frames holding an AVDRMFrameDescriptor struct in buf[0] that 
> allows drm / dmabuf usage.
> Was tested on RK3288 (TinkerBoard) and RK3328.
> ---
>  Changelog  |   1 +
>  configure  |  15 +-
>  libavcodec/Makefile|   3 +
>  libavcodec/allcodecs.c |   3 +
>  libavcodec/rkmppdec.c  | 567 
> +
>  5 files changed, 588 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/rkmppdec.c
> 
> diff --git a/Changelog b/Changelog
> index 1dfb8b5..622e5d0 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -35,6 +35,7 @@ version :
>  - pseudocolor video filter
>  - raw G.726 muxer and demuxer, left- and right-justified
>  - NewTek NDI input/output device
> +- Addition of Rockchip MPP hardware decoding

Use the same style as other entries, so just state what has been added; i.e. "- 
Rockchip MPP hardware decoder".

>  version 3.3:
>  - CrystalHD decoder moved to new decode API
> diff --git a/configure b/configure
> index ebd561d..1df5763 100755
> --- a/configure
> +++ b/configure
> @@ -307,6 +307,7 @@ External library support:
>--disable-nvenc  disable Nvidia video encoding code [autodetect]
>--enable-omx enable OpenMAX IL code [no]
>--enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
> +  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
>--disable-vaapi  disable Video Acceleration API (mainly 
> Unix/Intel) code [autodetect]
>--disable-vdadisable Apple Video Decode Acceleration code 
> [autodetect]
>--disable-vdpau  disable Nvidia Video Decode and Presentation API 
> for Unix code [autodetect]
> @@ -1520,6 +1521,7 @@ EXTERNAL_LIBRARY_VERSION3_LIST="
>  libopencore_amrnb
>  libopencore_amrwb
>  libvo_amrwbenc
> +rkmpp
>  "
>  
>  EXTERNAL_LIBRARY_GPLV3_LIST="
> @@ -2757,6 +2759,8 @@ h264_qsv_decoder_deps="libmfx"
>  h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec 
> h264_qsv_hwaccel"
>  h264_qsv_encoder_deps="libmfx"
>  h264_qsv_encoder_select="qsvenc"
> +h264_rkmpp_decoder_deps="rkmpp"
> +h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
>  h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
>  h264_vaapi_encoder_select="vaapi_encode golomb"
>  h264_vda_decoder_deps="vda"
> @@ -2772,6 +2776,8 @@ hevc_qsv_decoder_deps="libmfx"
>  hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec 
> hevc_qsv_hwaccel"
>  hevc_qsv_encoder_deps="libmfx"
>  hevc_qsv_encoder_select="hevcparse qsvenc"
> +hevc_rkmpp_decoder_deps="rkmpp"
> +hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf"
>  hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
>  hevc_vaapi_encoder_select="vaapi_encode golomb"
>  mjpeg_cuvid_decoder_deps="cuda cuvid"
> @@ -2811,6 +2817,8 @@ vp8_cuvid_decoder_deps="cuda cuvid"
>  vp8_mediacodec_decoder_deps="mediacodec"
>  vp8_qsv_decoder_deps="libmfx"
>  vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser"
> +vp8_rkmpp_decoder_deps="rkmpp"
> +vp8_rkmpp_decoder_select="rkmpp"

I think this line isn't wanted?

>  vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
>  vp8_vaapi_encoder_select="vaapi_encode"
>  vp9_cuvid_decoder_deps="cuda cuvid"
> @@ -6008,7 +6016,12 @@ enabled openssl   && { use_pkg_config openssl 
> openssl/ssl.h OPENSSL_init
> check_lib openssl openssl/ssl.h 
> SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
> die "ERROR: openssl not found"; }
>  enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
> qtkit_indev; }
> -
> +enabled rkmpp && { { require_pkg_config rockchip_mpp 
> rockchip/rk_mpi.h mpp_create ||
> + die "ERROR : Rockchip MPP was not found."; 
> }  &&
> +   { check_func_headers rockchip/rk_mpi_cmd.h 
> "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" ||
> + die "ERROR: Rockchip MPP is outdated, 
> please get a more recent one."; } &&
> +   { enabled libdrm || die "ERROR: rkmpp 
> requires --enable-libdrm"; }
> + }

Keep the blank line after the list of normal checks and before the more complex 
cases below.

Also needs a rebase - qtkit_indev was removed.

>  if enabled gcrypt; then
>  GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
>  if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 982d7f5..b75912f 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -336,6 +336,7 @@ OBJS-$(CONFIG_H264_VDA_DECODER)+= vda_h264_dec.o
>  OBJS-$(CONFIG_H264_OMX_ENCODER)+= omx.o
>  OBJS-$(CONFIG_H264_QSV_DECODER)+= qsvdec_h2645.o
>  

[FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-09-05 Thread LongChair .
From: LongChair 

This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
Will return frames holding an AVDRMFrameDescriptor struct in buf[0] that allows 
drm / dmabuf usage.
Was tested on RK3288 (TinkerBoard) and RK3328.
---
 Changelog  |   1 +
 configure  |  15 +-
 libavcodec/Makefile|   3 +
 libavcodec/allcodecs.c |   3 +
 libavcodec/rkmppdec.c  | 567 +
 5 files changed, 588 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/rkmppdec.c

diff --git a/Changelog b/Changelog
index 1dfb8b5..622e5d0 100644
--- a/Changelog
+++ b/Changelog
@@ -35,6 +35,7 @@ version :
 - pseudocolor video filter
 - raw G.726 muxer and demuxer, left- and right-justified
 - NewTek NDI input/output device
+- Addition of Rockchip MPP hardware decoding
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/configure b/configure
index ebd561d..1df5763 100755
--- a/configure
+++ b/configure
@@ -307,6 +307,7 @@ External library support:
   --disable-nvenc  disable Nvidia video encoding code [autodetect]
   --enable-omx enable OpenMAX IL code [no]
   --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
+  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
   --disable-vaapi  disable Video Acceleration API (mainly Unix/Intel) 
code [autodetect]
   --disable-vdadisable Apple Video Decode Acceleration code 
[autodetect]
   --disable-vdpau  disable Nvidia Video Decode and Presentation API 
for Unix code [autodetect]
@@ -1520,6 +1521,7 @@ EXTERNAL_LIBRARY_VERSION3_LIST="
 libopencore_amrnb
 libopencore_amrwb
 libvo_amrwbenc
+rkmpp
 "
 
 EXTERNAL_LIBRARY_GPLV3_LIST="
@@ -2757,6 +2759,8 @@ h264_qsv_decoder_deps="libmfx"
 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec 
h264_qsv_hwaccel"
 h264_qsv_encoder_deps="libmfx"
 h264_qsv_encoder_select="qsvenc"
+h264_rkmpp_decoder_deps="rkmpp"
+h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
 h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
 h264_vaapi_encoder_select="vaapi_encode golomb"
 h264_vda_decoder_deps="vda"
@@ -2772,6 +2776,8 @@ hevc_qsv_decoder_deps="libmfx"
 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec 
hevc_qsv_hwaccel"
 hevc_qsv_encoder_deps="libmfx"
 hevc_qsv_encoder_select="hevcparse qsvenc"
+hevc_rkmpp_decoder_deps="rkmpp"
+hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf"
 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
 hevc_vaapi_encoder_select="vaapi_encode golomb"
 mjpeg_cuvid_decoder_deps="cuda cuvid"
@@ -2811,6 +2817,8 @@ vp8_cuvid_decoder_deps="cuda cuvid"
 vp8_mediacodec_decoder_deps="mediacodec"
 vp8_qsv_decoder_deps="libmfx"
 vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser"
+vp8_rkmpp_decoder_deps="rkmpp"
+vp8_rkmpp_decoder_select="rkmpp"
 vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
 vp8_vaapi_encoder_select="vaapi_encode"
 vp9_cuvid_decoder_deps="cuda cuvid"
@@ -6008,7 +6016,12 @@ enabled openssl   && { use_pkg_config openssl 
openssl/ssl.h OPENSSL_init
check_lib openssl openssl/ssl.h 
SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
 enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
qtkit_indev; }
-
+enabled rkmpp && { { require_pkg_config rockchip_mpp 
rockchip/rk_mpi.h mpp_create ||
+ die "ERROR : Rockchip MPP was not found."; }  
&&
+   { check_func_headers rockchip/rk_mpi_cmd.h 
"MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" ||
+ die "ERROR: Rockchip MPP is outdated, please 
get a more recent one."; } &&
+   { enabled libdrm || die "ERROR: rkmpp requires 
--enable-libdrm"; }
+ }
 if enabled gcrypt; then
 GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
 if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 982d7f5..b75912f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -336,6 +336,7 @@ OBJS-$(CONFIG_H264_VDA_DECODER)+= vda_h264_dec.o
 OBJS-$(CONFIG_H264_OMX_ENCODER)+= omx.o
 OBJS-$(CONFIG_H264_QSV_DECODER)+= qsvdec_h2645.o
 OBJS-$(CONFIG_H264_QSV_ENCODER)+= qsvenc_h264.o
+OBJS-$(CONFIG_H264_RKMPP_DECODER)  += rkmppdec.o
 OBJS-$(CONFIG_H264_VAAPI_ENCODER)  += vaapi_encode_h264.o 
vaapi_encode_h26x.o
 OBJS-$(CONFIG_H264_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
 OBJS-$(CONFIG_HAP_DECODER) += hapdec.o hap.o
@@ -350,6 +351,7 @@ OBJS-$(CONFIG_NVENC_HEVC_ENCODER)  += nvenc_hevc.o
 OBJS-$(CONFIG_HEVC_QSV_DECODER)+= qsvdec_h2645.o
 OBJS-$(CONFIG_HEVC_QSV_ENCODER)+= qsvenc_hevc.o hevc_ps_enc.o   \
 

Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-09-05 Thread LongChair .


Le 03/09/2017 à 14:51, Mark Thompson a écrit :
> On 01/09/17 16:45, LongChair . wrote:
>> From: LongChair 
>>
>> Add support for RockChip Media Process Platform This adds hardware decoding 
>> for h264 / HEVC / VP8 using MPP Rockchip API. Will return frames holding an 
>> AVDRMFrameDescriptor struct in buf[0] that allows drm / dmabuf usage. Was 
>> tested on RK3288 (...
> Some linebreaks in the commit message, please.
Yes will be fixed in next commit
>
>> ---
>>   Changelog  |   1 +
>>   configure  |  13 +-
>>   libavcodec/Makefile|   3 +
>>   libavcodec/allcodecs.c |   6 +
>>   libavcodec/rkmppdec.c  | 537 
>> +
>>   5 files changed, 559 insertions(+), 1 deletion(-)
>>   create mode 100644 libavcodec/rkmppdec.c
> This configures but doesn't build with the released version of the MPP 
> library that I had by default (1.3.1 from Debian/Linaro somehow?):
>
> """
> CC  libavcodec/rkmppdec.o
> src/libavcodec/rkmppdec.c: In function ‘ffrkmpp_receive_frame’:
> src/libavcodec/rkmppdec.c:455:51: error: ‘MPP_DEC_GET_FREE_PACKET_SLOT_COUNT’ 
> undeclared (first use in this function)
>   ret = decoder->mpi->control(decoder->ctx, 
> MPP_DEC_GET_FREE_PACKET_SLOT_COUNT, );
> 
> ^~
> """
>
> I think it needs an additional configure test to ensure that the version is 
> usable.  I installed some git version which calls itself 1.3.0 and it works, 
> so it may need to be a feature test rather than a version one...
Right, as there is no good version management in the rockchip MPP 
pkgconfig file, i'll add a check for MPP_DEC_GET_FREE_PACKET_SLOT_COUNT 
in the appropriate header because this is the one change that we had to 
upstream into MPP for ffmpeg
>
>> diff --git a/Changelog b/Changelog
>> index 1dfb8b5..c19c1d0 100644
>> --- a/Changelog
>> +++ b/Changelog
>> @@ -70,6 +70,7 @@ version 3.3:
>>   - Removed asyncts filter (use af_aresample instead)
>>   - Intel QSV-accelerated VP8 video decoding
>>   - VAAPI-accelerated deinterlacing
>> +- Addition of Rockchip MPP harware decoding
> This is in the wrong place, it should be in the "next" list rather than the 
> list for 3.3.
>
> Also, typo "harware".
Both Fixed.
>
>>   version 3.2:
>> diff --git a/configure b/configure
>> index ebd561d..62fbcca 100755
>> --- a/configure
>> +++ b/configure
>> @@ -307,6 +307,7 @@ External library support:
>> --disable-nvenc  disable Nvidia video encoding code [autodetect]
>> --enable-omx enable OpenMAX IL code [no]
>> --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
>> +  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
>> --disable-vaapi  disable Video Acceleration API (mainly 
>> Unix/Intel) code [autodetect]
>> --disable-vdadisable Apple Video Decode Acceleration code 
>> [autodetect]
>> --disable-vdpau  disable Nvidia Video Decode and Presentation 
>> API for Unix code [autodetect]
>> @@ -1614,6 +1615,7 @@ HWACCEL_LIBRARY_LIST="
>>   libmfx
>>   mmal
>>   omx
>> +rkmpp
>>   "
>>   
>>   DOCUMENT_LIST="
>> @@ -2627,6 +2629,7 @@ h264_dxva2_hwaccel_select="h264_decoder"
>>   h264_mediacodec_hwaccel_deps="mediacodec"
>>   h264_mmal_hwaccel_deps="mmal"
>>   h264_qsv_hwaccel_deps="libmfx"
>> +h264_rkmpp_hwaccel_deps="rkmpp">  h264_vaapi_hwaccel_deps="vaapi"
>>   h264_vaapi_hwaccel_select="h264_decoder"
>>   h264_vda_hwaccel_deps="vda"
>> @@ -2647,6 +2650,7 @@ hevc_d3d11va2_hwaccel_select="hevc_decoder"
>>   hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
>>   hevc_dxva2_hwaccel_select="hevc_decoder"
>>   hevc_qsv_hwaccel_deps="libmfx"
>> +hevc_rkmpp_hwaccel_deps="rkmpp"
>>   hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
>>   hevc_vaapi_hwaccel_select="hevc_decoder"
>>   hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
>> @@ -2714,6 +2718,7 @@ vp9_cuvid_hwaccel_deps="cuda cuvid"
>>   vp9_cuvid_hwaccel_select="vp9_cuvid_decoder"
>>   vp8_mediacodec_hwaccel_deps="mediacodec"
>>   vp8_qsv_hwaccel_deps="libmfx"
>> +vp8_rkmpp_hwaccel_deps="rkmpp"
>>   vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
>>   vp9_d3d11va_hwaccel_select="vp9_decoder"
>>   vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
>> @@ -2757,6 +2762,8 @@ h264_qsv_decoder_deps="libmfx"
>>   h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec 
>> h264_qsv_hwaccel"
>>   h264_qsv_encoder_deps="libmfx"
>>   h264_qsv_encoder_select="qsvenc"
>> +h264_rkmpp_decoder_deps="rkmpp"
>> +h264_rkmpp_decoder_select="h264_mp4toannexb_bsf rkmpp h264_rkmpp_hwaccel"
>>   h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
>>   h264_vaapi_encoder_select="vaapi_encode golomb"
>>   h264_vda_decoder_deps="vda"
>> @@ -2772,6 +2779,8 @@ hevc_qsv_decoder_deps="libmfx"
>>   hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser 

Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API. Will return frames holding an AVDRMFrameDescriptor

2017-09-04 Thread wm4
On Sun, 3 Sep 2017 14:27:06 +0100
Mark Thompson  wrote:

> On 03/09/17 13:36, LongChair . wrote:
> > Le 01/09/2017 à 21:13, Carl Eugen Hoyos a écrit :  
> >> This is Apache 2.0 (afaict) meaning it requires version 3 in case of 
> >> --enable-gpl.  
> > That is right, although it seems MPP clearly contains some ffmpeg 2.2 or 
> > something old code.
> > see : 
> > https://github.com/rockchip-linux/mpp/blob/release/inc/mpp_frame.h#L59  
> 
> These are standard values from ISO 11664-1; them being in common with ffmpeg 
> is unsurprising.
> 
> > and https://github.com/rockchip-linux/mpp/tree/release/mpp/codec/dec/h265  
> 
> Not sure what you're pointing at here.

There are some strong hints that the library contains FFmpeg LGPL code,
which makes it a LGPL violation. E.g.:

https://github.com/FFmpeg/FFmpeg/blob/3106cbd32118b121b5ae3dbf1e586a41c2f0793f/libavcodec/hevc.c#L164
https://github.com/rockchip-linux/mpp/blob/a8e6c27d0b23372b85d1ec172de764084db25ccf/mpp/codec/dec/h265/h265d_parser.c#L333

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API. Will return frames holding an AVDRMFrameDescriptor

2017-09-03 Thread Mark Thompson
On 03/09/17 13:36, LongChair . wrote:
> Le 01/09/2017 à 21:13, Carl Eugen Hoyos a écrit :
>> This is Apache 2.0 (afaict) meaning it requires version 3 in case of 
>> --enable-gpl.
> That is right, although it seems MPP clearly contains some ffmpeg 2.2 or 
> something old code.
> see : https://github.com/rockchip-linux/mpp/blob/release/inc/mpp_frame.h#L59

These are standard values from ISO 11664-1; them being in common with ffmpeg is 
unsurprising.

> and https://github.com/rockchip-linux/mpp/tree/release/mpp/codec/dec/h265

Not sure what you're pointing at here.

> which probbaly voids the Apache 2.0 and makes it GPL2 ..

ffmpeg is LGPL 2.1 or later, not GPL.

Neither LGPL 2.1 nor GPL 2 are compatible for distribution with Apache 2.0 (I 
think I was confused over this earlier, apologies if I said the wrong thing on 
IRC), so we invoke the "or later" part with --enable-version3 to use LGPL 3 
instead (or GPL 3 if --enable-gpl is also present), at which point the result 
should be distributable.  (Hopefully: IANAL, does not constitute legal advice, 
consult a lawyer yourself, etc.)

I think putting it in EXTERNAL_LIBRARY_VERSION3_LIST has the right effect.

- Mark
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-09-03 Thread Mark Thompson
On 01/09/17 16:45, LongChair . wrote:
> From: LongChair 
> 
> Add support for RockChip Media Process Platform This adds hardware decoding 
> for h264 / HEVC / VP8 using MPP Rockchip API. Will return frames holding an 
> AVDRMFrameDescriptor struct in buf[0] that allows drm / dmabuf usage. Was 
> tested on RK3288 (...

Some linebreaks in the commit message, please.

> ---
>  Changelog  |   1 +
>  configure  |  13 +-
>  libavcodec/Makefile|   3 +
>  libavcodec/allcodecs.c |   6 +
>  libavcodec/rkmppdec.c  | 537 
> +
>  5 files changed, 559 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/rkmppdec.c

This configures but doesn't build with the released version of the MPP library 
that I had by default (1.3.1 from Debian/Linaro somehow?):

"""
CC  libavcodec/rkmppdec.o
src/libavcodec/rkmppdec.c: In function ‘ffrkmpp_receive_frame’:
src/libavcodec/rkmppdec.c:455:51: error: ‘MPP_DEC_GET_FREE_PACKET_SLOT_COUNT’ 
undeclared (first use in this function)
 ret = decoder->mpi->control(decoder->ctx, 
MPP_DEC_GET_FREE_PACKET_SLOT_COUNT, );
   
^~
"""

I think it needs an additional configure test to ensure that the version is 
usable.  I installed some git version which calls itself 1.3.0 and it works, so 
it may need to be a feature test rather than a version one...

> diff --git a/Changelog b/Changelog
> index 1dfb8b5..c19c1d0 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -70,6 +70,7 @@ version 3.3:
>  - Removed asyncts filter (use af_aresample instead)
>  - Intel QSV-accelerated VP8 video decoding
>  - VAAPI-accelerated deinterlacing
> +- Addition of Rockchip MPP harware decoding

This is in the wrong place, it should be in the "next" list rather than the 
list for 3.3.

Also, typo "harware".

>  version 3.2:
> diff --git a/configure b/configure
> index ebd561d..62fbcca 100755
> --- a/configure
> +++ b/configure
> @@ -307,6 +307,7 @@ External library support:
>--disable-nvenc  disable Nvidia video encoding code [autodetect]
>--enable-omx enable OpenMAX IL code [no]
>--enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
> +  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
>--disable-vaapi  disable Video Acceleration API (mainly 
> Unix/Intel) code [autodetect]
>--disable-vdadisable Apple Video Decode Acceleration code 
> [autodetect]
>--disable-vdpau  disable Nvidia Video Decode and Presentation API 
> for Unix code [autodetect]
> @@ -1614,6 +1615,7 @@ HWACCEL_LIBRARY_LIST="
>  libmfx
>  mmal
>  omx
> +rkmpp
>  "
>  
>  DOCUMENT_LIST="
> @@ -2627,6 +2629,7 @@ h264_dxva2_hwaccel_select="h264_decoder"
>  h264_mediacodec_hwaccel_deps="mediacodec"
>  h264_mmal_hwaccel_deps="mmal"
>  h264_qsv_hwaccel_deps="libmfx"
> +h264_rkmpp_hwaccel_deps="rkmpp">  h264_vaapi_hwaccel_deps="vaapi"
>  h264_vaapi_hwaccel_select="h264_decoder"
>  h264_vda_hwaccel_deps="vda"
> @@ -2647,6 +2650,7 @@ hevc_d3d11va2_hwaccel_select="hevc_decoder"
>  hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
>  hevc_dxva2_hwaccel_select="hevc_decoder"
>  hevc_qsv_hwaccel_deps="libmfx"
> +hevc_rkmpp_hwaccel_deps="rkmpp"
>  hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
>  hevc_vaapi_hwaccel_select="hevc_decoder"
>  hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
> @@ -2714,6 +2718,7 @@ vp9_cuvid_hwaccel_deps="cuda cuvid"
>  vp9_cuvid_hwaccel_select="vp9_cuvid_decoder"
>  vp8_mediacodec_hwaccel_deps="mediacodec"
>  vp8_qsv_hwaccel_deps="libmfx"
> +vp8_rkmpp_hwaccel_deps="rkmpp"
>  vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
>  vp9_d3d11va_hwaccel_select="vp9_decoder"
>  vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
> @@ -2757,6 +2762,8 @@ h264_qsv_decoder_deps="libmfx"
>  h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec 
> h264_qsv_hwaccel"
>  h264_qsv_encoder_deps="libmfx"
>  h264_qsv_encoder_select="qsvenc"
> +h264_rkmpp_decoder_deps="rkmpp"
> +h264_rkmpp_decoder_select="h264_mp4toannexb_bsf rkmpp h264_rkmpp_hwaccel"
>  h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
>  h264_vaapi_encoder_select="vaapi_encode golomb"
>  h264_vda_decoder_deps="vda"
> @@ -2772,6 +2779,8 @@ hevc_qsv_decoder_deps="libmfx"
>  hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec 
> hevc_qsv_hwaccel"
>  hevc_qsv_encoder_deps="libmfx"
>  hevc_qsv_encoder_select="hevcparse qsvenc"
> +hevc_rkmpp_decoder_deps="rkmpp"
> +hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf rkmpp hevc_rkmpp_hwaccel"
>  hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
>  hevc_vaapi_encoder_select="vaapi_encode golomb"
>  mjpeg_cuvid_decoder_deps="cuda cuvid"
> @@ -2811,6 +2820,8 @@ vp8_cuvid_decoder_deps="cuda cuvid"
>  vp8_mediacodec_decoder_deps="mediacodec"
>  vp8_qsv_decoder_deps="libmfx"
>  

Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API. Will return frames holding an AVDRMFrameDescriptor

2017-09-03 Thread LongChair .


Le 01/09/2017 à 21:13, Carl Eugen Hoyos a écrit :
> This is Apache 2.0 (afaict) meaning it requires version 3 in case of 
> --enable-gpl.
That is right, although it seems MPP clearly contains some ffmpeg 2.2 or 
something old code.
see : https://github.com/rockchip-linux/mpp/blob/release/inc/mpp_frame.h#L59
and https://github.com/rockchip-linux/mpp/tree/release/mpp/codec/dec/h265

which probbaly voids the Apache 2.0 and makes it GPL2 ..
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API. Will return frames holding an AVDRMFrameDescriptor

2017-09-01 Thread Carl Eugen Hoyos
Hi!

> Am 01.09.2017 um 17:45 schrieb "LongChair ." :
> 
> From: LongChair 
> 
> ---
> Changelog  |   1 +
> configure  |  13 +-
> libavcodec/Makefile|   3 +
> libavcodec/allcodecs.c |   6 +
> libavcodec/rkmppdec.c  | 537 +
> 5 files changed, 559 insertions(+), 1 deletion(-)
> create mode 100644 libavcodec/rkmppdec.c
> 
> diff --git a/Changelog b/Changelog
> index 1dfb8b5..c19c1d0 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -70,6 +70,7 @@ version 3.3:
> - Removed asyncts filter (use af_aresample instead)
> - Intel QSV-accelerated VP8 video decoding
> - VAAPI-accelerated deinterlacing
> +- Addition of Rockchip MPP harware decoding
> 
> 
> version 3.2:
> diff --git a/configure b/configure
> index ebd561d..62fbcca 100755
> --- a/configure
> +++ b/configure
> @@ -307,6 +307,7 @@ External library support:
>   --disable-nvenc  disable Nvidia video encoding code [autodetect]
>   --enable-omx enable OpenMAX IL code [no]
>   --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
> +  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
>   --disable-vaapi  disable Video Acceleration API (mainly Unix/Intel) 
> code [autodetect]
>   --disable-vdadisable Apple Video Decode Acceleration code 
> [autodetect]
>   --disable-vdpau  disable Nvidia Video Decode and Presentation API 
> for Unix code [autodetect]
> @@ -1614,6 +1615,7 @@ HWACCEL_LIBRARY_LIST="
> libmfx
> mmal
> omx
> +rkmpp

This is Apache 2.0 (afaict) meaning it requires version 3 in case of 
--enable-gpl.

And please fix the commit message.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API. Will return frames holding an AVDRMFrameDescriptor stru

2017-09-01 Thread LongChair .
From: LongChair 

---
 Changelog  |   1 +
 configure  |  13 +-
 libavcodec/Makefile|   3 +
 libavcodec/allcodecs.c |   6 +
 libavcodec/rkmppdec.c  | 537 +
 5 files changed, 559 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/rkmppdec.c

diff --git a/Changelog b/Changelog
index 1dfb8b5..c19c1d0 100644
--- a/Changelog
+++ b/Changelog
@@ -70,6 +70,7 @@ version 3.3:
 - Removed asyncts filter (use af_aresample instead)
 - Intel QSV-accelerated VP8 video decoding
 - VAAPI-accelerated deinterlacing
+- Addition of Rockchip MPP harware decoding
 
 
 version 3.2:
diff --git a/configure b/configure
index ebd561d..62fbcca 100755
--- a/configure
+++ b/configure
@@ -307,6 +307,7 @@ External library support:
   --disable-nvenc  disable Nvidia video encoding code [autodetect]
   --enable-omx enable OpenMAX IL code [no]
   --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
+  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
   --disable-vaapi  disable Video Acceleration API (mainly Unix/Intel) 
code [autodetect]
   --disable-vdadisable Apple Video Decode Acceleration code 
[autodetect]
   --disable-vdpau  disable Nvidia Video Decode and Presentation API 
for Unix code [autodetect]
@@ -1614,6 +1615,7 @@ HWACCEL_LIBRARY_LIST="
 libmfx
 mmal
 omx
+rkmpp
 "
 
 DOCUMENT_LIST="
@@ -2627,6 +2629,7 @@ h264_dxva2_hwaccel_select="h264_decoder"
 h264_mediacodec_hwaccel_deps="mediacodec"
 h264_mmal_hwaccel_deps="mmal"
 h264_qsv_hwaccel_deps="libmfx"
+h264_rkmpp_hwaccel_deps="rkmpp"
 h264_vaapi_hwaccel_deps="vaapi"
 h264_vaapi_hwaccel_select="h264_decoder"
 h264_vda_hwaccel_deps="vda"
@@ -2647,6 +2650,7 @@ hevc_d3d11va2_hwaccel_select="hevc_decoder"
 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
 hevc_dxva2_hwaccel_select="hevc_decoder"
 hevc_qsv_hwaccel_deps="libmfx"
+hevc_rkmpp_hwaccel_deps="rkmpp"
 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
 hevc_vaapi_hwaccel_select="hevc_decoder"
 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
@@ -2714,6 +2718,7 @@ vp9_cuvid_hwaccel_deps="cuda cuvid"
 vp9_cuvid_hwaccel_select="vp9_cuvid_decoder"
 vp8_mediacodec_hwaccel_deps="mediacodec"
 vp8_qsv_hwaccel_deps="libmfx"
+vp8_rkmpp_hwaccel_deps="rkmpp"
 vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
 vp9_d3d11va_hwaccel_select="vp9_decoder"
 vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
@@ -2757,6 +2762,8 @@ h264_qsv_decoder_deps="libmfx"
 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec 
h264_qsv_hwaccel"
 h264_qsv_encoder_deps="libmfx"
 h264_qsv_encoder_select="qsvenc"
+h264_rkmpp_decoder_deps="rkmpp"
+h264_rkmpp_decoder_select="h264_mp4toannexb_bsf rkmpp h264_rkmpp_hwaccel"
 h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
 h264_vaapi_encoder_select="vaapi_encode golomb"
 h264_vda_decoder_deps="vda"
@@ -2772,6 +2779,8 @@ hevc_qsv_decoder_deps="libmfx"
 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec 
hevc_qsv_hwaccel"
 hevc_qsv_encoder_deps="libmfx"
 hevc_qsv_encoder_select="hevcparse qsvenc"
+hevc_rkmpp_decoder_deps="rkmpp"
+hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf rkmpp hevc_rkmpp_hwaccel"
 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
 hevc_vaapi_encoder_select="vaapi_encode golomb"
 mjpeg_cuvid_decoder_deps="cuda cuvid"
@@ -2811,6 +2820,8 @@ vp8_cuvid_decoder_deps="cuda cuvid"
 vp8_mediacodec_decoder_deps="mediacodec"
 vp8_qsv_decoder_deps="libmfx"
 vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser"
+vp8_rkmpp_decoder_deps="rkmpp"
+vp8_rkmpp_decoder_select="rkmpp vp8_rkmpp_hwaccel"
 vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
 vp8_vaapi_encoder_select="vaapi_encode"
 vp9_cuvid_decoder_deps="cuda cuvid"
@@ -6008,7 +6019,7 @@ enabled openssl   && { use_pkg_config openssl 
openssl/ssl.h OPENSSL_init
check_lib openssl openssl/ssl.h 
SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
 enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
qtkit_indev; }
-
+enabled rkmpp && { check_lib rkmpp rockchip/rk_mpi.h mpp_create 
"-lrockchip_mpp" || die "ERROR : Rockchip MPP was not found."; }
 if enabled gcrypt; then
 GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
 if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 982d7f5..b75912f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -336,6 +336,7 @@ OBJS-$(CONFIG_H264_VDA_DECODER)+= vda_h264_dec.o
 OBJS-$(CONFIG_H264_OMX_ENCODER)+= omx.o
 OBJS-$(CONFIG_H264_QSV_DECODER)+= qsvdec_h2645.o
 OBJS-$(CONFIG_H264_QSV_ENCODER)+= qsvenc_h264.o
+OBJS-$(CONFIG_H264_RKMPP_DECODER)  += rkmppdec.o
 

Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-07-04 Thread wm4
On Tue, 4 Jul 2017 10:59:17 +0800
Steven Liu  wrote:

> Hello? What about this support? This is a very interesting function :D

Currently it's discussed what the DRM hwframes API should look like.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-07-03 Thread Steven Liu
2017-06-13 19:02 GMT+08:00 wm4 :
> On Tue, 13 Jun 2017 11:17:35 +0100
> Mark Thompson  wrote:
>
>> > +vp8_rkmpp_hwaccel_deps="rkmpp"
>> >  vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
>> >  vp9_d3d11va_hwaccel_select="vp9_decoder"
>> >  vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
>>
>> Why do these hwaccels exist?  They don't appear to do anything, since you 
>> only have hardware surface output anyway.
>
> Well I guess you might have a point - as long as get_format isn't
> actually involved, they're technically not needed. And we've apparently
> always had hw decoders which can output both sw and hw surfaces, so
> this never came up (probably).
>
>
> I still think there's no harm in adding them.
>
>> > ...
>> > diff --git a/libavcodec/drmprime.h b/libavcodec/drmprime.h
>> > new file mode 100644
>> > index 000..44816db
>> > --- /dev/null
>> > +++ b/libavcodec/drmprime.h
>> > @@ -0,0 +1,17 @@
>> > +#ifndef AVCODEC_DRMPRIME_H
>> > +#define AVCODEC_DRMPRIME_H
>> > +
>> > +#include 
>> > +
>> > +#define AV_DRMPRIME_NUM_PLANES  4   // maximum number of planes
>> > +
>> > +typedef struct av_drmprime {
>> > +
>> > +int strides[AV_DRMPRIME_NUM_PLANES];// stride in byte of the 
>> > according plane
>> > +int offsets[AV_DRMPRIME_NUM_PLANES];// offset from start in byte 
>> > of the according plane
>> > +int fds[AV_DRMPRIME_NUM_PLANES];// file descriptor for the 
>> > plane, (0) if unused.
>> > +uint32_t format;// FOURC_CC drm format for 
>> > the image
>> > +
>> > +} av_drmprime;
>> > +
>> > +#endif // AVCODEC_DRMPRIME_H
>>
>> I'm not sure that a structure like this should be baked into the API/ABI now 
>> as a generic thing.  Are you confident that it is sufficient to represent 
>> any picture in a DRM object which might be used in future?  (Including 
>> things like tiling modes, field splitting, other craziness that GPU makers 
>> dream up?)
>
> This includes the DRM FourCC, which should take most craziness into
> account. The RockChip decoder itself does something pretty crazy (10
> bit _packed_ _planar_ format, wtf?), and it sort of fits in.
>
> I had similar concerns, and I think I basically requested that all
> standard eglCreateImageKHR() parameters for this to be included in this
> struct (which was done).
>
> It's true though that drivers could invent additional craziness as
> additional EGL attributes, or by adding new DRM API calls.
>
> It boils down to how the DRM kernel API handles these things, which I
> don't know. (Not like kernel devs would write docs - they'd possibly be
> forced to create something consistent!)
>
> Longchair replied with the EGL mapping as use case, but you can also
> map it as DRM framebuffer, which appears to happen around here:
>
> https://github.com/LongChair/mpv/blob/rockchip/video/out/opengl/hwdec_drmprime_drm.c#L102
>
>> Can you explain the cases you are using this in?  Are you intending to make 
>> other components with input / output in this format?
>>
>> With just this decoder in isolation, it would seem preferable to me to make 
>> a structure specific to the API for now (or use the existing one - is 
>> MppFrame sufficient?).  If later there are multiple implementations and need 
>> for a common structure like this then it will be clearer what the 
>> requirements are.  Compare VAAPI and QSV (possibly also CUDA, CUVID, VDPAU?) 
>> - they can expose DRM objects, but don't currently in the ffmpeg API because 
>> any consumers which want them in that form generally prefer the wrapping 
>> object including the relevant metadata anyway.
>
> So output those as MppFrames, and then map them as DRM frames? We'd
> have the same issues. Also, the API would be harder to use. The
> assumption is that native MppFrames are pretty useless anyway, other
> than for using them with the MPP decode API.
>
>> Also, zero is a valid file descriptor.
>
> Technically yes, not sure if we care about that case.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Hello? What about this support? This is a very interesting function :D
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-06-13 Thread wm4
On Tue, 13 Jun 2017 11:17:35 +0100
Mark Thompson  wrote:

> > +vp8_rkmpp_hwaccel_deps="rkmpp"
> >  vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
> >  vp9_d3d11va_hwaccel_select="vp9_decoder"
> >  vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"  
> 
> Why do these hwaccels exist?  They don't appear to do anything, since you 
> only have hardware surface output anyway.

Well I guess you might have a point - as long as get_format isn't
actually involved, they're technically not needed. And we've apparently
always had hw decoders which can output both sw and hw surfaces, so
this never came up (probably).


I still think there's no harm in adding them.

> > ...
> > diff --git a/libavcodec/drmprime.h b/libavcodec/drmprime.h
> > new file mode 100644
> > index 000..44816db
> > --- /dev/null
> > +++ b/libavcodec/drmprime.h
> > @@ -0,0 +1,17 @@
> > +#ifndef AVCODEC_DRMPRIME_H
> > +#define AVCODEC_DRMPRIME_H
> > +
> > +#include 
> > +
> > +#define AV_DRMPRIME_NUM_PLANES  4   // maximum number of planes
> > +
> > +typedef struct av_drmprime {
> > +
> > +int strides[AV_DRMPRIME_NUM_PLANES];// stride in byte of the 
> > according plane
> > +int offsets[AV_DRMPRIME_NUM_PLANES];// offset from start in byte 
> > of the according plane
> > +int fds[AV_DRMPRIME_NUM_PLANES];// file descriptor for the 
> > plane, (0) if unused.
> > +uint32_t format;// FOURC_CC drm format for the 
> > image
> > +
> > +} av_drmprime;
> > +
> > +#endif // AVCODEC_DRMPRIME_H  
> 
> I'm not sure that a structure like this should be baked into the API/ABI now 
> as a generic thing.  Are you confident that it is sufficient to represent any 
> picture in a DRM object which might be used in future?  (Including things 
> like tiling modes, field splitting, other craziness that GPU makers dream up?)

This includes the DRM FourCC, which should take most craziness into
account. The RockChip decoder itself does something pretty crazy (10
bit _packed_ _planar_ format, wtf?), and it sort of fits in.

I had similar concerns, and I think I basically requested that all
standard eglCreateImageKHR() parameters for this to be included in this
struct (which was done).

It's true though that drivers could invent additional craziness as
additional EGL attributes, or by adding new DRM API calls.

It boils down to how the DRM kernel API handles these things, which I
don't know. (Not like kernel devs would write docs - they'd possibly be
forced to create something consistent!)

Longchair replied with the EGL mapping as use case, but you can also
map it as DRM framebuffer, which appears to happen around here:

https://github.com/LongChair/mpv/blob/rockchip/video/out/opengl/hwdec_drmprime_drm.c#L102

> Can you explain the cases you are using this in?  Are you intending to make 
> other components with input / output in this format?
> 
> With just this decoder in isolation, it would seem preferable to me to make a 
> structure specific to the API for now (or use the existing one - is MppFrame 
> sufficient?).  If later there are multiple implementations and need for a 
> common structure like this then it will be clearer what the requirements are. 
>  Compare VAAPI and QSV (possibly also CUDA, CUVID, VDPAU?) - they can expose 
> DRM objects, but don't currently in the ffmpeg API because any consumers 
> which want them in that form generally prefer the wrapping object including 
> the relevant metadata anyway.

So output those as MppFrames, and then map them as DRM frames? We'd
have the same issues. Also, the API would be harder to use. The
assumption is that native MppFrames are pretty useless anyway, other
than for using them with the MPP decode API.

> Also, zero is a valid file descriptor.

Technically yes, not sure if we care about that case.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-06-13 Thread LongChair .
Hello,

The use case for this is mostly on embedded devices that can use drm to display 
video with zerocopy.
Most devices i have played with that can use such implementation will allow to 
create a drm overlay from that drmprime information with drmModeAddFB2:

Here is a sample usage for it 
https://github.com/LongChair/mpv/blob/rockchip/video/out/opengl/hwdec_drmprime_drm.c#L103-L137

Also that allows some other egl / dmabuf implementation :
https://github.com/LongChair/mpv/blob/rockchip/video/out/opengl/hwdec_drmprime_egl.c#L162-L215

The idea behind making this a non rockchip specific hwdec was that on embedded 
devices, most maufacturers are heading towards V4L2 harwadre decoding 
implementations. from what i have seen such v4L2 decoding coudl as well make 
sue of such a format, which would allow to have only one renderer that is hwdec 
agnostic for the rendering part.

Now of course, I am not 100% sure that this would fit all the possible 
implementations, If you feel like this should be rockchip specific, then i'll 
get back to it which was the version 1 of this patch.

Lionel.

Le 13/06/2017 à 12:17, Mark Thompson a écrit :

On 13/06/17 07:21, LongChair . wrote:


From: LongChair 

This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
Will return frames holding a av_drmprime struct in buf[3} that allows drm / 
dmabuf usage.
Was tested on RK3288 (TinkerBoard) and RK3328.

Additions from patch v1
 - Change AV_PIX_FMT_RKMPP to AV_PIX_FMT_DRMPRIME as any decoder able to output 
drmprime structures could use that pixel format.
---
 Changelog  |   1 +
 configure  |  12 ++
 libavcodec/Makefile|   5 +
 libavcodec/allcodecs.c |   6 +
 libavcodec/drmprime.h  |  17 ++
 libavcodec/rkmppdec.c  | 523 +
 libavutil/pixdesc.c|   4 +
 libavutil/pixfmt.h |   5 +
 8 files changed, 573 insertions(+)
 create mode 100644 libavcodec/drmprime.h
 create mode 100644 libavcodec/rkmppdec.c

diff --git a/Changelog b/Changelog
index 3533bdc..498e433 100644
--- a/Changelog
+++ b/Changelog
@@ -52,6 +52,7 @@ version 3.3:
 - Removed asyncts filter (use af_aresample instead)
 - Intel QSV-accelerated VP8 video decoding
 - VAAPI-accelerated deinterlacing
+- Addition of Rockchip MPP harware decoding


 version 3.2:
diff --git a/configure b/configure
index 4ec8f21..883fc84 100755
--- a/configure
+++ b/configure
@@ -304,6 +304,7 @@ External library support:
   --disable-nvenc  disable Nvidia video encoding code [autodetect]
   --enable-omx enable OpenMAX IL code [no]
   --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
+  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
   --disable-vaapi  disable Video Acceleration API (mainly Unix/Intel) 
code [autodetect]
   --disable-vdadisable Apple Video Decode Acceleration code 
[autodetect]
   --disable-vdpau  disable Nvidia Video Decode and Presentation API 
for Unix code [autodetect]
@@ -1607,6 +1608,7 @@ HWACCEL_LIBRARY_LIST="
 libmfx
 mmal
 omx
+rkmpp
 "

 DOCUMENT_LIST="
@@ -2616,6 +2618,7 @@ h264_dxva2_hwaccel_select="h264_decoder"
 h264_mediacodec_hwaccel_deps="mediacodec"
 h264_mmal_hwaccel_deps="mmal"
 h264_qsv_hwaccel_deps="libmfx"
+h264_rkmpp_hwaccel_deps="rkmpp"
 h264_vaapi_hwaccel_deps="vaapi"
 h264_vaapi_hwaccel_select="h264_decoder"
 h264_vda_hwaccel_deps="vda"
@@ -2634,6 +2637,7 @@ hevc_mediacodec_hwaccel_deps="mediacodec"
 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
 hevc_dxva2_hwaccel_select="hevc_decoder"
 hevc_qsv_hwaccel_deps="libmfx"
+hevc_rkmpp_hwaccel_deps="rkmpp"
 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
 hevc_vaapi_hwaccel_select="hevc_decoder"
 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
@@ -2696,6 +2700,7 @@ vp9_cuvid_hwaccel_deps="cuda cuvid"
 vp9_cuvid_hwaccel_select="vp9_cuvid_decoder"
 vp8_mediacodec_hwaccel_deps="mediacodec"
 vp8_qsv_hwaccel_deps="libmfx"
+vp8_rkmpp_hwaccel_deps="rkmpp"
 vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
 vp9_d3d11va_hwaccel_select="vp9_decoder"
 vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"



Why do these hwaccels exist?  They don't appear to do anything, since you only 
have hardware surface output anyway.



...
diff --git a/libavcodec/drmprime.h b/libavcodec/drmprime.h
new file mode 100644
index 000..44816db
--- /dev/null
+++ b/libavcodec/drmprime.h
@@ -0,0 +1,17 @@
+#ifndef AVCODEC_DRMPRIME_H
+#define AVCODEC_DRMPRIME_H
+
+#include 
+
+#define AV_DRMPRIME_NUM_PLANES  4   // maximum number of planes
+
+typedef struct av_drmprime {
+
+int strides[AV_DRMPRIME_NUM_PLANES];// stride in byte of the according 
plane
+int offsets[AV_DRMPRIME_NUM_PLANES];// offset from start in byte of 
the according plane
+int fds[AV_DRMPRIME_NUM_PLANES];// file descriptor for the plane, 
(0) if unused.
+

Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-06-13 Thread Mark Thompson
On 13/06/17 07:21, LongChair . wrote:
> From: LongChair 
> 
> This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
> Will return frames holding a av_drmprime struct in buf[3} that allows drm / 
> dmabuf usage.
> Was tested on RK3288 (TinkerBoard) and RK3328.
> 
> Additions from patch v1
>  - Change AV_PIX_FMT_RKMPP to AV_PIX_FMT_DRMPRIME as any decoder able to 
> output drmprime structures could use that pixel format.
> ---
>  Changelog  |   1 +
>  configure  |  12 ++
>  libavcodec/Makefile|   5 +
>  libavcodec/allcodecs.c |   6 +
>  libavcodec/drmprime.h  |  17 ++
>  libavcodec/rkmppdec.c  | 523 
> +
>  libavutil/pixdesc.c|   4 +
>  libavutil/pixfmt.h |   5 +
>  8 files changed, 573 insertions(+)
>  create mode 100644 libavcodec/drmprime.h
>  create mode 100644 libavcodec/rkmppdec.c
> 
> diff --git a/Changelog b/Changelog
> index 3533bdc..498e433 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -52,6 +52,7 @@ version 3.3:
>  - Removed asyncts filter (use af_aresample instead)
>  - Intel QSV-accelerated VP8 video decoding
>  - VAAPI-accelerated deinterlacing
> +- Addition of Rockchip MPP harware decoding
>  
>  
>  version 3.2:
> diff --git a/configure b/configure
> index 4ec8f21..883fc84 100755
> --- a/configure
> +++ b/configure
> @@ -304,6 +304,7 @@ External library support:
>--disable-nvenc  disable Nvidia video encoding code [autodetect]
>--enable-omx enable OpenMAX IL code [no]
>--enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
> +  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
>--disable-vaapi  disable Video Acceleration API (mainly 
> Unix/Intel) code [autodetect]
>--disable-vdadisable Apple Video Decode Acceleration code 
> [autodetect]
>--disable-vdpau  disable Nvidia Video Decode and Presentation API 
> for Unix code [autodetect]
> @@ -1607,6 +1608,7 @@ HWACCEL_LIBRARY_LIST="
>  libmfx
>  mmal
>  omx
> +rkmpp
>  "
>  
>  DOCUMENT_LIST="
> @@ -2616,6 +2618,7 @@ h264_dxva2_hwaccel_select="h264_decoder"
>  h264_mediacodec_hwaccel_deps="mediacodec"
>  h264_mmal_hwaccel_deps="mmal"
>  h264_qsv_hwaccel_deps="libmfx"
> +h264_rkmpp_hwaccel_deps="rkmpp"
>  h264_vaapi_hwaccel_deps="vaapi"
>  h264_vaapi_hwaccel_select="h264_decoder"
>  h264_vda_hwaccel_deps="vda"
> @@ -2634,6 +2637,7 @@ hevc_mediacodec_hwaccel_deps="mediacodec"
>  hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
>  hevc_dxva2_hwaccel_select="hevc_decoder"
>  hevc_qsv_hwaccel_deps="libmfx"
> +hevc_rkmpp_hwaccel_deps="rkmpp"
>  hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
>  hevc_vaapi_hwaccel_select="hevc_decoder"
>  hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
> @@ -2696,6 +2700,7 @@ vp9_cuvid_hwaccel_deps="cuda cuvid"
>  vp9_cuvid_hwaccel_select="vp9_cuvid_decoder"
>  vp8_mediacodec_hwaccel_deps="mediacodec"
>  vp8_qsv_hwaccel_deps="libmfx"
> +vp8_rkmpp_hwaccel_deps="rkmpp"
>  vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
>  vp9_d3d11va_hwaccel_select="vp9_decoder"
>  vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"

Why do these hwaccels exist?  They don't appear to do anything, since you only 
have hardware surface output anyway.

> ...
> diff --git a/libavcodec/drmprime.h b/libavcodec/drmprime.h
> new file mode 100644
> index 000..44816db
> --- /dev/null
> +++ b/libavcodec/drmprime.h
> @@ -0,0 +1,17 @@
> +#ifndef AVCODEC_DRMPRIME_H
> +#define AVCODEC_DRMPRIME_H
> +
> +#include 
> +
> +#define AV_DRMPRIME_NUM_PLANES  4   // maximum number of planes
> +
> +typedef struct av_drmprime {
> +
> +int strides[AV_DRMPRIME_NUM_PLANES];// stride in byte of the 
> according plane
> +int offsets[AV_DRMPRIME_NUM_PLANES];// offset from start in byte of 
> the according plane
> +int fds[AV_DRMPRIME_NUM_PLANES];// file descriptor for the 
> plane, (0) if unused.
> +uint32_t format;// FOURC_CC drm format for the 
> image
> +
> +} av_drmprime;
> +
> +#endif // AVCODEC_DRMPRIME_H

I'm not sure that a structure like this should be baked into the API/ABI now as 
a generic thing.  Are you confident that it is sufficient to represent any 
picture in a DRM object which might be used in future?  (Including things like 
tiling modes, field splitting, other craziness that GPU makers dream up?)

Can you explain the cases you are using this in?  Are you intending to make 
other components with input / output in this format?

With just this decoder in isolation, it would seem preferable to me to make a 
structure specific to the API for now (or use the existing one - is MppFrame 
sufficient?).  If later there are multiple implementations and need for a 
common structure like this then it will be clearer what the requirements are.  
Compare VAAPI and QSV (possibly also CUDA, CUVID, VDPAU?) - they can expose DRM 

[FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform

2017-06-13 Thread LongChair .
From: LongChair 

This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API.
Will return frames holding a av_drmprime struct in buf[3} that allows drm / 
dmabuf usage.
Was tested on RK3288 (TinkerBoard) and RK3328.

Additions from patch v1
 - Change AV_PIX_FMT_RKMPP to AV_PIX_FMT_DRMPRIME as any decoder able to output 
drmprime structures could use that pixel format.
---
 Changelog  |   1 +
 configure  |  12 ++
 libavcodec/Makefile|   5 +
 libavcodec/allcodecs.c |   6 +
 libavcodec/drmprime.h  |  17 ++
 libavcodec/rkmppdec.c  | 523 +
 libavutil/pixdesc.c|   4 +
 libavutil/pixfmt.h |   5 +
 8 files changed, 573 insertions(+)
 create mode 100644 libavcodec/drmprime.h
 create mode 100644 libavcodec/rkmppdec.c

diff --git a/Changelog b/Changelog
index 3533bdc..498e433 100644
--- a/Changelog
+++ b/Changelog
@@ -52,6 +52,7 @@ version 3.3:
 - Removed asyncts filter (use af_aresample instead)
 - Intel QSV-accelerated VP8 video decoding
 - VAAPI-accelerated deinterlacing
+- Addition of Rockchip MPP harware decoding
 
 
 version 3.2:
diff --git a/configure b/configure
index 4ec8f21..883fc84 100755
--- a/configure
+++ b/configure
@@ -304,6 +304,7 @@ External library support:
   --disable-nvenc  disable Nvidia video encoding code [autodetect]
   --enable-omx enable OpenMAX IL code [no]
   --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
+  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
   --disable-vaapi  disable Video Acceleration API (mainly Unix/Intel) 
code [autodetect]
   --disable-vdadisable Apple Video Decode Acceleration code 
[autodetect]
   --disable-vdpau  disable Nvidia Video Decode and Presentation API 
for Unix code [autodetect]
@@ -1607,6 +1608,7 @@ HWACCEL_LIBRARY_LIST="
 libmfx
 mmal
 omx
+rkmpp
 "
 
 DOCUMENT_LIST="
@@ -2616,6 +2618,7 @@ h264_dxva2_hwaccel_select="h264_decoder"
 h264_mediacodec_hwaccel_deps="mediacodec"
 h264_mmal_hwaccel_deps="mmal"
 h264_qsv_hwaccel_deps="libmfx"
+h264_rkmpp_hwaccel_deps="rkmpp"
 h264_vaapi_hwaccel_deps="vaapi"
 h264_vaapi_hwaccel_select="h264_decoder"
 h264_vda_hwaccel_deps="vda"
@@ -2634,6 +2637,7 @@ hevc_mediacodec_hwaccel_deps="mediacodec"
 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
 hevc_dxva2_hwaccel_select="hevc_decoder"
 hevc_qsv_hwaccel_deps="libmfx"
+hevc_rkmpp_hwaccel_deps="rkmpp"
 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
 hevc_vaapi_hwaccel_select="hevc_decoder"
 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
@@ -2696,6 +2700,7 @@ vp9_cuvid_hwaccel_deps="cuda cuvid"
 vp9_cuvid_hwaccel_select="vp9_cuvid_decoder"
 vp8_mediacodec_hwaccel_deps="mediacodec"
 vp8_qsv_hwaccel_deps="libmfx"
+vp8_rkmpp_hwaccel_deps="rkmpp"
 vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
 vp9_d3d11va_hwaccel_select="vp9_decoder"
 vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
@@ -2736,6 +2741,8 @@ h264_qsv_decoder_deps="libmfx"
 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec 
h264_qsv_hwaccel"
 h264_qsv_encoder_deps="libmfx"
 h264_qsv_encoder_select="qsvenc"
+h264_rkmpp_decoder_deps="rkmpp"
+h264_rkmpp_decoder_select="h264_mp4toannexb_bsf rkmpp h264_rkmpp_hwaccel"
 h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
 h264_vaapi_encoder_select="vaapi_encode golomb"
 h264_vda_decoder_deps="vda"
@@ -2751,6 +2758,8 @@ hevc_qsv_decoder_deps="libmfx"
 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec 
hevc_qsv_hwaccel"
 hevc_qsv_encoder_deps="libmfx"
 hevc_qsv_encoder_select="hevcparse qsvenc"
+hevc_rkmpp_decoder_deps="rkmpp"
+hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf rkmpp hevc_rkmpp_hwaccel"
 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
 hevc_vaapi_encoder_select="vaapi_encode golomb"
 mjpeg_cuvid_decoder_deps="cuda cuvid"
@@ -2789,6 +2798,8 @@ vp8_cuvid_decoder_deps="cuda cuvid"
 vp8_mediacodec_decoder_deps="mediacodec"
 vp8_qsv_decoder_deps="libmfx"
 vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser"
+vp8_rkmpp_decoder_deps="rkmpp"
+vp8_rkmpp_decoder_select="rkmpp vp8_rkmpp_hwaccel"
 vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
 vp8_vaapi_encoder_select="vaapi_encode"
 vp9_cuvid_decoder_deps="cuda cuvid"
@@ -5917,6 +5928,7 @@ enabled mmal  && { check_lib mmal 
interface/mmal/mmal.h mmal_port_co
  check_lib mmal interface/mmal/mmal.h 
mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
die "ERROR: mmal not found" &&
check_func_headers interface/mmal/mmal.h 
"MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
+enabled rkmpp && { check_lib rkmpp rockchip/rk_mpi.h mpp_create 
"-lrockchip_mpp" || die "ERROR : Rockchip MPP was not found."; }
 enabled netcdf&& require_pkg_config netcdf netcdf.h 

Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API. Will return frames holding a av_drmprime struct tha

2017-06-11 Thread wm4
On Sun, 11 Jun 2017 05:24:16 +
"LongChair ."  wrote:

> From: LongChair 
> 
> ---
>  Changelog  |   1 +
>  configure  |  12 ++
>  libavcodec/Makefile|   4 +
>  libavcodec/allcodecs.c |   6 +
>  libavcodec/drmprime.h  |  17 ++
>  libavcodec/rkmppdec.c  | 522 
> +
>  libavutil/pixdesc.c|   4 +
>  libavutil/pixfmt.h |   5 +
>  8 files changed, 571 insertions(+)
>  create mode 100644 libavcodec/drmprime.h
>  create mode 100644 libavcodec/rkmppdec.c
> 

I reviewed this before, so I have nothing more to say.

You should fix your commit message, though (approx. 72 chars per line
limit, concise summary/topic in the subject line, then empty line, then
detailed description of the commit).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API. Will return frames holding a av_drmprime struct that al

2017-06-10 Thread LongChair .
From: LongChair 

---
 Changelog  |   1 +
 configure  |  12 ++
 libavcodec/Makefile|   4 +
 libavcodec/allcodecs.c |   6 +
 libavcodec/drmprime.h  |  17 ++
 libavcodec/rkmppdec.c  | 522 +
 libavutil/pixdesc.c|   4 +
 libavutil/pixfmt.h |   5 +
 8 files changed, 571 insertions(+)
 create mode 100644 libavcodec/drmprime.h
 create mode 100644 libavcodec/rkmppdec.c

diff --git a/Changelog b/Changelog
index 3533bdc..498e433 100644
--- a/Changelog
+++ b/Changelog
@@ -52,6 +52,7 @@ version 3.3:
 - Removed asyncts filter (use af_aresample instead)
 - Intel QSV-accelerated VP8 video decoding
 - VAAPI-accelerated deinterlacing
+- Addition of Rockchip MPP harware decoding
 
 
 version 3.2:
diff --git a/configure b/configure
index 4ec8f21..883fc84 100755
--- a/configure
+++ b/configure
@@ -304,6 +304,7 @@ External library support:
   --disable-nvenc  disable Nvidia video encoding code [autodetect]
   --enable-omx enable OpenMAX IL code [no]
   --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
+  --enable-rkmpp   enable Rockchip Media Process Platform code [no]
   --disable-vaapi  disable Video Acceleration API (mainly Unix/Intel) 
code [autodetect]
   --disable-vdadisable Apple Video Decode Acceleration code 
[autodetect]
   --disable-vdpau  disable Nvidia Video Decode and Presentation API 
for Unix code [autodetect]
@@ -1607,6 +1608,7 @@ HWACCEL_LIBRARY_LIST="
 libmfx
 mmal
 omx
+rkmpp
 "
 
 DOCUMENT_LIST="
@@ -2616,6 +2618,7 @@ h264_dxva2_hwaccel_select="h264_decoder"
 h264_mediacodec_hwaccel_deps="mediacodec"
 h264_mmal_hwaccel_deps="mmal"
 h264_qsv_hwaccel_deps="libmfx"
+h264_rkmpp_hwaccel_deps="rkmpp"
 h264_vaapi_hwaccel_deps="vaapi"
 h264_vaapi_hwaccel_select="h264_decoder"
 h264_vda_hwaccel_deps="vda"
@@ -2634,6 +2637,7 @@ hevc_mediacodec_hwaccel_deps="mediacodec"
 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
 hevc_dxva2_hwaccel_select="hevc_decoder"
 hevc_qsv_hwaccel_deps="libmfx"
+hevc_rkmpp_hwaccel_deps="rkmpp"
 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
 hevc_vaapi_hwaccel_select="hevc_decoder"
 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
@@ -2696,6 +2700,7 @@ vp9_cuvid_hwaccel_deps="cuda cuvid"
 vp9_cuvid_hwaccel_select="vp9_cuvid_decoder"
 vp8_mediacodec_hwaccel_deps="mediacodec"
 vp8_qsv_hwaccel_deps="libmfx"
+vp8_rkmpp_hwaccel_deps="rkmpp"
 vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
 vp9_d3d11va_hwaccel_select="vp9_decoder"
 vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
@@ -2736,6 +2741,8 @@ h264_qsv_decoder_deps="libmfx"
 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec 
h264_qsv_hwaccel"
 h264_qsv_encoder_deps="libmfx"
 h264_qsv_encoder_select="qsvenc"
+h264_rkmpp_decoder_deps="rkmpp"
+h264_rkmpp_decoder_select="h264_mp4toannexb_bsf rkmpp h264_rkmpp_hwaccel"
 h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
 h264_vaapi_encoder_select="vaapi_encode golomb"
 h264_vda_decoder_deps="vda"
@@ -2751,6 +2758,8 @@ hevc_qsv_decoder_deps="libmfx"
 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec 
hevc_qsv_hwaccel"
 hevc_qsv_encoder_deps="libmfx"
 hevc_qsv_encoder_select="hevcparse qsvenc"
+hevc_rkmpp_decoder_deps="rkmpp"
+hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf rkmpp hevc_rkmpp_hwaccel"
 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
 hevc_vaapi_encoder_select="vaapi_encode golomb"
 mjpeg_cuvid_decoder_deps="cuda cuvid"
@@ -2789,6 +2798,8 @@ vp8_cuvid_decoder_deps="cuda cuvid"
 vp8_mediacodec_decoder_deps="mediacodec"
 vp8_qsv_decoder_deps="libmfx"
 vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser"
+vp8_rkmpp_decoder_deps="rkmpp"
+vp8_rkmpp_decoder_select="rkmpp vp8_rkmpp_hwaccel"
 vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
 vp8_vaapi_encoder_select="vaapi_encode"
 vp9_cuvid_decoder_deps="cuda cuvid"
@@ -5917,6 +5928,7 @@ enabled mmal  && { check_lib mmal 
interface/mmal/mmal.h mmal_port_co
  check_lib mmal interface/mmal/mmal.h 
mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
die "ERROR: mmal not found" &&
check_func_headers interface/mmal/mmal.h 
"MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
+enabled rkmpp && { check_lib rkmpp rockchip/rk_mpi.h mpp_create 
"-lrockchip_mpp" || die "ERROR : Rockchip MPP was not found."; }
 enabled netcdf&& require_pkg_config netcdf netcdf.h nc_inq_libvers
 enabled openal&& { { for al_extralibs in "${OPENAL_LIBS}" 
"-lopenal" "-lOpenAL32"; do
check_lib openal 'AL/al.h' alGetError 
"${al_extralibs}" && break; done } ||
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 0818950..1f83813 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@