Re: [FFmpeg-devel] [PATCH 4/4] libavcodec/dev: v4l2: add support for v4l2 mem2mem codecs

2017-07-28 Thread Jorge Ramirez

On 07/28/2017 12:45 AM, Michael Niedermayer wrote:

On Thu, Jul 27, 2017 at 08:44:37AM +0200, Jorge Ramirez wrote:

On 07/26/2017 04:04 PM, Michael Niedermayer wrote:

On Mon, Jul 24, 2017 at 09:08:49PM +0200, Jorge Ramirez-Ortiz wrote:

From: Alexis Ballier 

This patchset enhances Alexis Ballier's original patch and validates
it using Qualcomm's Venus hardware (driver recently landed upstream
[1]).

This has been tested on Qualcomm's DragonBoard 410c and 820c

ffplay tested video decoders:
- h264,
- vp8
- mpeg4

Some of the changes introduced:
- v4l2: some cleanup of the code.
- v4l2: some cleaup before upstreaming.
- v4l2: follow the new decode api.
- v4l2: fix display size for NV12 output pool.
- v4l2: handle EOS.
- v4l2: fix vp8 and mpeg4 decoding.
- v4l2: generate EOF on dequeue errors.
- v4l2: h264_mp4toannexb filtering.

[1] https://lwn.net/Articles/697956/

this with the other patches breaks build

Hi Michael,

Could you provide some details of your build environment and kernel please?

this should have been a ubuntu 14.04 LTS with 3.13.0-125-generic which
should be the default for ubuntu 14-04



What is the oldest kernel that you have to build on?

whatever the oldest kernel used by any supported distribution is


ok will disable the codecs not supported at configure time (will post 
the fix in v2)





[...]


___
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 4/4] libavcodec/dev: v4l2: add support for v4l2 mem2mem codecs

2017-07-27 Thread Michael Niedermayer
On Thu, Jul 27, 2017 at 08:44:37AM +0200, Jorge Ramirez wrote:
> On 07/26/2017 04:04 PM, Michael Niedermayer wrote:
> >On Mon, Jul 24, 2017 at 09:08:49PM +0200, Jorge Ramirez-Ortiz wrote:
> >>From: Alexis Ballier 
> >>
> >>This patchset enhances Alexis Ballier's original patch and validates
> >>it using Qualcomm's Venus hardware (driver recently landed upstream
> >>[1]).
> >>
> >>This has been tested on Qualcomm's DragonBoard 410c and 820c
> >>
> >>ffplay tested video decoders:
> >>- h264,
> >>- vp8
> >>- mpeg4
> >>
> >>Some of the changes introduced:
> >>- v4l2: some cleanup of the code.
> >>- v4l2: some cleaup before upstreaming.
> >>- v4l2: follow the new decode api.
> >>- v4l2: fix display size for NV12 output pool.
> >>- v4l2: handle EOS.
> >>- v4l2: fix vp8 and mpeg4 decoding.
> >>- v4l2: generate EOF on dequeue errors.
> >>- v4l2: h264_mp4toannexb filtering.
> >>
> >>[1] https://lwn.net/Articles/697956/
> >this with the other patches breaks build
> 
> Hi Michael,
> 
> Could you provide some details of your build environment and kernel please?

this should have been a ubuntu 14.04 LTS with 3.13.0-125-generic which
should be the default for ubuntu 14-04


> What is the oldest kernel that you have to build on?

whatever the oldest kernel used by any supported distribution is


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/4] libavcodec/dev: v4l2: add support for v4l2 mem2mem codecs

2017-07-26 Thread Jorge Ramirez

On 07/26/2017 04:04 PM, Michael Niedermayer wrote:

On Mon, Jul 24, 2017 at 09:08:49PM +0200, Jorge Ramirez-Ortiz wrote:

From: Alexis Ballier 

This patchset enhances Alexis Ballier's original patch and validates
it using Qualcomm's Venus hardware (driver recently landed upstream
[1]).

This has been tested on Qualcomm's DragonBoard 410c and 820c

ffplay tested video decoders:
- h264,
- vp8
- mpeg4

Some of the changes introduced:
- v4l2: some cleanup of the code.
- v4l2: some cleaup before upstreaming.
- v4l2: follow the new decode api.
- v4l2: fix display size for NV12 output pool.
- v4l2: handle EOS.
- v4l2: fix vp8 and mpeg4 decoding.
- v4l2: generate EOF on dequeue errors.
- v4l2: h264_mp4toannexb filtering.

[1] https://lwn.net/Articles/697956/

this with the other patches breaks build


Hi Michael,

Could you provide some details of your build environment and kernel please?
What is the oldest kernel that you have to build on?

The identifiers that the compiler is moaning about were added to the API 
a few years back (2 and 4) to v4l2-controls.h and videodev2.h)


1) For instance the kernel added support for 
V4L2_CID_MPEG_VIDEO_VPX_MIN_QP in 2013 with commit:


commit 4773ab99aa8bda57de22bf54ddbaa1a941b25fb0
Author: Arun Kumar K 
Date:   Fri Nov 15 02:29:22 2013 -0300

[media] s5p-mfc: Add QP setting support for vp8 encoder

Adds v4l2 controls to set MIN, MAX QP values and
I, P frame QP for vp8 encoder.

Signed-off-by: Kiran AVND 
Signed-off-by: Arun Kumar K 
Signed-off-by: Kamil Debski 
Signed-off-by: Mauro Carvalho Chehab 


2) Similarly V4L2_BUF_FLAG_LAST was introduced a couple of years ago with

Author: Philipp Zabel 
Date:   Mon May 4 07:51:04 2015 -0300

[media] DocBook media: document codec draining flow

Document the interaction between VIDIOC_DECODER_CMD 
V4L2_DEC_CMD_STOP and
VIDIOC_ENCODER_CMD V4L2_ENC_CMD_STOP to start the draining, the 
V4L2_EVENT_EOS
event signalling all capture buffers are finished and ready to be 
dequeud,
the new V4L2_BUF_FLAG_LAST buffer flag indicating the last buffer 
being dequeued
from the capture queue, and the poll and VIDIOC_DQBUF ioctl return 
values once

the queue is drained.

Signed-off-by: Philipp Zabel 
Acked-by: Hans Verkuil 
Signed-off-by: Kamil Debski 
Signed-off-by: Mauro Carvalho Chehab 


For users, those identifiers are defined in 
/usr/include/linux/videodev2.h and /usr/include/linux/v4l2-controls.h. 
so they should have been there along with the others; however and since 
this is not the case for you, it must be caused by the build environment 
being not too recent (I have been testing on Ubuntu 16.04)


(btw I have fixed the av log warning on v2)


CC  libavcodec/v4l2-buffers.o
CC  libavcodec/v4l2_m2m_enc.o
libavcodec/v4l2_m2m_enc.c: In function ‘v4lm2m_encode_init’:
libavcodec/v4l2_m2m_enc.c:150:103: error: ‘V4L2_CID_MPEG_VIDEO_VPX_MIN_QP’ 
undeclared (first use in this function)
  SET_V4L_EXT_CTRL(value, V4L2_CID_MPEG_VIDEO_VPX_MIN_QP, avctx->qmin, 
V4L2_CTRL_CLASS_MPEG, "minimum video quantizer scale");

^
libavcodec/v4l2_m2m_enc.c:150:103: note: each undeclared identifier is reported 
only once for each function it appears in
libavcodec/v4l2_m2m_enc.c:151:103: error: ‘V4L2_CID_MPEG_VIDEO_VPX_MAX_QP’ 
undeclared (first use in this function)
  SET_V4L_EXT_CTRL(value, V4L2_CID_MPEG_VIDEO_VPX_MAX_QP, avctx->qmax, 
V4L2_CTRL_CLASS_MPEG, "maximum video quantizer scale");

^
make: *** [libavcodec/v4l2_m2m_enc.o] Error 1
libavcodec/v4l2-buffers.c: In function ‘avpriv_init_v4lbufpool’:
libavcodec/v4l2-buffers.c:276:9: warning: unknown conversion type character ‘y’ 
in format [-Wformat=]
  av_log(bufs->log_ctx, AV_LOG_ERROR, "%type %i not supported\n", 
bufs->type);
  ^
libavcodec/v4l2-buffers.c: In function ‘avpkt_to_v4lbuf’:
libavcodec/v4l2-buffers.c:414:22: error: ‘V4L2_BUF_FLAG_LAST’ undeclared (first 
use in this function)
  out->flags = V4L2_BUF_FLAG_LAST;
   ^
libavcodec/v4l2-buffers.c:414:22: note: each undeclared identifier is reported 
only once for each function it appears in
libavcodec/v4l2-buffers.c: In function ‘v4lbuf_to_avpkt’:
libavcodec/v4l2-buffers.c:464:5: warning: ‘av_free_packet’ is deprecated 
(declared at libavcodec/avcodec.h:4621) [-Wdeprecated-declarations]
  av_free_packet(pkt);
  ^
make: *** [libavcodec/v4l2-buffers.o] Error 1
make: Target `all' not remade because of errors.

[...]


___
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/f

Re: [FFmpeg-devel] [PATCH 4/4] libavcodec/dev: v4l2: add support for v4l2 mem2mem codecs

2017-07-26 Thread Michael Niedermayer
On Mon, Jul 24, 2017 at 09:08:49PM +0200, Jorge Ramirez-Ortiz wrote:
> From: Alexis Ballier 
> 
> This patchset enhances Alexis Ballier's original patch and validates
> it using Qualcomm's Venus hardware (driver recently landed upstream
> [1]).
> 
> This has been tested on Qualcomm's DragonBoard 410c and 820c
> 
> ffplay tested video decoders:
> - h264,
> - vp8
> - mpeg4
> 
> Some of the changes introduced:
> - v4l2: some cleanup of the code.
> - v4l2: some cleaup before upstreaming.
> - v4l2: follow the new decode api.
> - v4l2: fix display size for NV12 output pool.
> - v4l2: handle EOS.
> - v4l2: fix vp8 and mpeg4 decoding.
> - v4l2: generate EOF on dequeue errors.
> - v4l2: h264_mp4toannexb filtering.
> 
> [1] https://lwn.net/Articles/697956/

this with the other patches breaks build
CC  libavcodec/v4l2-buffers.o
CC  libavcodec/v4l2_m2m_enc.o
libavcodec/v4l2_m2m_enc.c: In function ‘v4lm2m_encode_init’:
libavcodec/v4l2_m2m_enc.c:150:103: error: ‘V4L2_CID_MPEG_VIDEO_VPX_MIN_QP’ 
undeclared (first use in this function)
 SET_V4L_EXT_CTRL(value, V4L2_CID_MPEG_VIDEO_VPX_MIN_QP, 
avctx->qmin, V4L2_CTRL_CLASS_MPEG, "minimum video quantizer scale");

   ^
libavcodec/v4l2_m2m_enc.c:150:103: note: each undeclared identifier is reported 
only once for each function it appears in
libavcodec/v4l2_m2m_enc.c:151:103: error: ‘V4L2_CID_MPEG_VIDEO_VPX_MAX_QP’ 
undeclared (first use in this function)
 SET_V4L_EXT_CTRL(value, V4L2_CID_MPEG_VIDEO_VPX_MAX_QP, 
avctx->qmax, V4L2_CTRL_CLASS_MPEG, "maximum video quantizer scale");

   ^
make: *** [libavcodec/v4l2_m2m_enc.o] Error 1
libavcodec/v4l2-buffers.c: In function ‘avpriv_init_v4lbufpool’:
libavcodec/v4l2-buffers.c:276:9: warning: unknown conversion type character ‘y’ 
in format [-Wformat=]
 av_log(bufs->log_ctx, AV_LOG_ERROR, "%type %i not supported\n", 
bufs->type);
 ^
libavcodec/v4l2-buffers.c: In function ‘avpkt_to_v4lbuf’:
libavcodec/v4l2-buffers.c:414:22: error: ‘V4L2_BUF_FLAG_LAST’ undeclared (first 
use in this function)
 out->flags = V4L2_BUF_FLAG_LAST;
  ^
libavcodec/v4l2-buffers.c:414:22: note: each undeclared identifier is reported 
only once for each function it appears in
libavcodec/v4l2-buffers.c: In function ‘v4lbuf_to_avpkt’:
libavcodec/v4l2-buffers.c:464:5: warning: ‘av_free_packet’ is deprecated 
(declared at libavcodec/avcodec.h:4621) [-Wdeprecated-declarations]
 av_free_packet(pkt);
 ^
make: *** [libavcodec/v4l2-buffers.o] Error 1
make: Target `all' not remade because of errors.

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 4/4] libavcodec/dev: v4l2: add support for v4l2 mem2mem codecs

2017-07-24 Thread Jorge Ramirez-Ortiz
From: Alexis Ballier 

This patchset enhances Alexis Ballier's original patch and validates
it using Qualcomm's Venus hardware (driver recently landed upstream
[1]).

This has been tested on Qualcomm's DragonBoard 410c and 820c

ffplay tested video decoders:
- h264,
- vp8
- mpeg4

Some of the changes introduced:
- v4l2: some cleanup of the code.
- v4l2: some cleaup before upstreaming.
- v4l2: follow the new decode api.
- v4l2: fix display size for NV12 output pool.
- v4l2: handle EOS.
- v4l2: fix vp8 and mpeg4 decoding.
- v4l2: generate EOF on dequeue errors.
- v4l2: h264_mp4toannexb filtering.

[1] https://lwn.net/Articles/697956/

Reviewed-by: Jorge Ramirez 
Reviewed-by: Alexis Ballier 
Tested-by: Jorge Ramirez 
---
 Changelog |   3 +-
 configure |  17 +-
 libavcodec/Makefile   |  15 +-
 libavcodec/allcodecs.c|   7 +
 libavcodec/v4l2-buffers.c | 633 ++
 libavcodec/v4l2-buffers.h | 247 
 libavcodec/v4l2-common.c  |  48 ++--
 libavcodec/v4l2-common.h  |   4 +-
 libavcodec/v4l2_m2m.c | 358 
 libavcodec/v4l2_m2m.h |  69 +
 libavcodec/v4l2_m2m_avcodec.h |  32 +++
 libavcodec/v4l2_m2m_dec.c | 244 
 libavcodec/v4l2_m2m_enc.c | 251 +
 13 files changed, 1897 insertions(+), 31 deletions(-)
 create mode 100644 libavcodec/v4l2-buffers.c
 create mode 100644 libavcodec/v4l2-buffers.h
 create mode 100644 libavcodec/v4l2_m2m.c
 create mode 100644 libavcodec/v4l2_m2m.h
 create mode 100644 libavcodec/v4l2_m2m_avcodec.h
 create mode 100644 libavcodec/v4l2_m2m_dec.c
 create mode 100644 libavcodec/v4l2_m2m_enc.c

diff --git a/Changelog b/Changelog
index 187ae79..d31de07 100644
--- a/Changelog
+++ b/Changelog
@@ -29,6 +29,7 @@ version :
 - limiter video filter
 - libvmaf video filter
 - Dolby E decoder and SMPTE 337M demuxer
+- V4L2 mem2mem HW accelerated codecs support
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
@@ -65,7 +66,6 @@ version 3.3:
 - Intel QSV-accelerated VP8 video decoding
 - VAAPI-accelerated deinterlacing
 
-
 version 3.2:
 - libopenmpt demuxer
 - tee protocol
@@ -105,7 +105,6 @@ version 3.2:
 - Changed mapping of rtp MIME type G726 to codec g726le.
 - spec compliant VAAPI/DXVA2 VC-1 decoding of slices in frame-coded images
 
-
 version 3.1:
 - DXVA2-accelerated HEVC Main10 decoding
 - fieldhint filter
diff --git a/configure b/configure
index 0ebc022..9762f32 100755
--- a/configure
+++ b/configure
@@ -10,7 +10,6 @@
 # Prevent locale nonsense from breaking basic text processing.
 LC_ALL=C
 export LC_ALL
-
 # make sure we are running under a compatible shell
 # try to make this part work with most shells
 
@@ -149,6 +148,7 @@ Component options:
   --disable-pixelutils disable pixel utils in libavutil
 
 Individual component options:
+  --disable-v4l2_m2m   disable V4L2 mem2mem code [autodetect]
   --disable-everything disable all components listed below
   --disable-encoder=NAME   disable encoder NAME
   --enable-encoder=NAMEenable encoder NAME
@@ -1432,6 +1432,7 @@ AVCODEC_COMPONENTS="
 
 AVDEVICE_COMPONENTS="
 indevs
+v4l2_m2m
 outdevs
 "
 AVFILTER_COMPONENTS="
@@ -2269,10 +2270,12 @@ map 'eval ${v}_inline_deps=inline_asm' 
$ARCH_EXT_LIST_ARM
 loongson2_deps="mips"
 loongson3_deps="mips"
 v4l2_deps_any="linux_videodev2_h sys_videoio_h"
+v4l2_m2m_select="v4l2"
 mipsfpu_deps="mips"
 mipsdsp_deps="mips"
 mipsdspr2_deps="mips"
 mips32r2_deps="mips"
+vc1_v4l2m2m_decoder_deps="v4l2_m2m"
 mips32r5_deps="mips"
 mips32r6_deps="mips"
 mips64r2_deps="mips"
@@ -2283,6 +2286,8 @@ mmi_deps="mips"
 altivec_deps="ppc"
 dcbzl_deps="ppc"
 ldbrx_deps="ppc"
+vp8_v4l2m2m_decoder_deps="v4l2_m2m"
+vp8_v4l2m2m_encoder_deps="v4l2_m2m"
 ppc4xx_deps="ppc"
 vsx_deps="altivec"
 power8_deps="vsx"
@@ -2436,11 +2441,15 @@ h261_decoder_select="mpegvideo"
 h261_encoder_select="aandcttables mpegvideoenc"
 h263_decoder_select="h263_parser h263dsp mpegvideo qpeldsp"
 h263_encoder_select="aandcttables h263dsp mpegvideoenc"
+h263_v4l2m2m_decoder_deps="v4l2_m2m"
+h263_v4l2m2m_encoder_deps="v4l2_m2m"
 h263i_decoder_select="h263_decoder"
 h263p_decoder_select="h263_decoder"
 h263p_encoder_select="h263_encoder"
 h264_decoder_select="cabac golomb h264chroma h264dsp h264parse h264pred 
h264qpel videodsp"
 h264_decoder_suggest="error_resilience"
+h264_v4l2m2m_decoder_deps="v4l2_m2m"
+h264_v4l2m2m_encoder_deps="v4l2_m2m"
 hap_decoder_select="snappy texturedsp"
 hap_encoder_deps="libsnappy"
 hap_encoder_select="texturedspenc"
@@ -2481,6 +2490,7 @@ mpc7_decoder_select="bswapdsp mpegaudiodsp"
 mpc8_decoder_select="mpegaudiodsp"
 mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
 mpeg_xvmc_decoder_select="mpeg2video_decoder"
+mpeg1_v4l2m2m_decoder_deps="v4l2_m2m"
 mpegvideo_decoder_select="mpegvideo"
 mpeg1video_decoder_select="mpegvideo"
 mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp"
@@ -248