Re: [FFmpeg-devel] There may be a bug for .mp4 reader.

2019-04-02 Thread Yufei He
On 04/01/2019 05:57 PM, Hendrik Leppkes wrote:
> On Mon, Apr 1, 2019 at 7:21 PM Yufei He  wrote:
>> Hi
>>
>> There may be a bug for .mp4 reader.
>>
>> On decoding some ntsc mp4 files with my h.264 codec, from actvx I received,
>>
>> avctx->framerate.den is 100
>>
>> avctx->framerate.num is 2997
>>
>> avctx->pkt_timebase.num is 1
>> avctx->pkt_timebase.den is 2997
>>
>> Duration of every packet I received from ff_decode_get_packet(avctx, ) 
>> is 100, which means it's a encoded frame. But actually, it's a encoded 
>> field, it's duration should be 50.
>>
> Bug reports should go on Trac or the API user mailing list.
>
> - Hendrik
OK.
Thanks.
Yufei.

> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] There may be a bug for .mp4 reader.

2019-04-01 Thread Yufei He
On 04/01/2019 01:42 PM, Devin Heitmueller wrote:
> Hello Yufei,
>
>> On Apr 1, 2019, at 1:21 PM, Yufei He  wrote:
>>
>> Hi
>>
>> There may be a bug for .mp4 reader.
>>
>> On decoding some ntsc mp4 files with my h.264 codec, from actvx I received,
>>
>> avctx->framerate.den is 100
>>
>> avctx->framerate.num is 2997
>>
>> avctx->pkt_timebase.num is 1
>> avctx->pkt_timebase.den is 2997
>>
>> Duration of every packet I received from ff_decode_get_packet(avctx, ) 
>> is 100, which means it's a encoded frame. But actually, it's a encoded 
>> field, it's duration should be 50.
> Libavcodec doesn’t have any support for delivering individual fields.  
> Decoders are expected to reassemble fields into frames before providing them 
> back to callers.
>
> Presumably this is some sort of PAFF encoded stream?  Does it decode properly 
> when using the software h.264 decoder?
>
> Devin
Hi Devin

The data decoded is in frames, my problem is the source compressed data: 
it could be a field or a frame depending on files, every packet for 
compressed data has duration and it should be accurate, I use it 
directly instead of parsing it again. it seems it's not correct for some 
.mp4 files. and I find it's not correct for xavc mxf long gop files 
today, though xavc intra files are good.

Yufei.
> ---
> Devin Heitmueller - LTN Global Communications
> dheitmuel...@ltnglobal.com
>
>
>
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] There may be a bug for .mp4 reader.

2019-04-01 Thread Yufei He
Hi

There may be a bug for .mp4 reader.

On decoding some ntsc mp4 files with my h.264 codec, from actvx I received,

avctx->framerate.den is 100

avctx->framerate.num is 2997

avctx->pkt_timebase.num is 1
avctx->pkt_timebase.den is 2997

Duration of every packet I received from ff_decode_get_packet(avctx, ) is 
100, which means it's a encoded frame. But actually, it's a encoded field, it's 
duration should be 50.

Regards.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] patch for supporting m264 on h.264 decoding and encoding.

2019-03-29 Thread Yufei He
Hi

This is the fixed version of this patch that follows the way other 
companies do on supporting FFmpeg.

1>Put library mvm264 to the nonfree list in configure

2>Remove calling to dlopen

Please review.

Thanks.

Yufei


From 1a636c0aa2288731374a4a6139c385baad2a8e98 Mon Sep 17 00:00:00 2001
From: yhe 
Date: Fri, 29 Mar 2019 10:06:37 -0400
Subject: [PATCH] h.264 decoder and encoder support with M264

---
 Changelog  |   1 +
 configure  |   6 +
 libavcodec/Makefile|   2 +
 libavcodec/allcodecs.c |   2 +
 libavcodec/m264dec.c   | 304 +
 libavcodec/m264dec.h   |  40 +++
 libavcodec/m264enc.c   | 262 ++
 libavcodec/m264enc.h   |  38 +++
 8 files changed, 655 insertions(+)
 create mode 100644 libavcodec/m264dec.c
 create mode 100644 libavcodec/m264dec.h
 create mode 100644 libavcodec/m264enc.c
 create mode 100644 libavcodec/m264enc.h

diff --git a/Changelog b/Changelog
index 4d80e5b..ce0daf8 100644
--- a/Changelog
+++ b/Changelog
@@ -19,6 +19,7 @@ version :
 - ARBC decoder
 - libaribb24 based ARIB STD-B24 caption support (profiles A and C)
 - Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
+- Support h.264 encoding and decoding with Matrox M264 card.
 
 
 version 4.1:
diff --git a/configure b/configure
index dcead3a..b579d10 100755
--- a/configure
+++ b/configure
@@ -302,6 +302,7 @@ External library support:
   --enable-mbedtls enable mbedTLS, needed for https support
if openssl, gnutls or libtls is not used [no]
   --enable-mediacodec  enable Android MediaCodec support [no]
+  --enable-mvm264  enable Matrox M264 H.264 support [no]
   --enable-libmysofa   enable libmysofa, needed for sofalizer filter [no]
   --enable-openal  enable OpenAL 1.1 capture support [no]
   --enable-opencl  enable OpenCL processing [no]
@@ -1717,6 +1718,7 @@ EXTERNAL_LIBRARY_NONFREE_LIST="
 libfdk_aac
 openssl
 libtls
+mvm264
 "
 
 EXTERNAL_LIBRARY_VERSION3_LIST="
@@ -2697,6 +2699,8 @@ 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_m264_decoder_deps="mvm264"
+h264_m264_encoder_deps="mvm264"
 hap_decoder_select="snappy texturedsp"
 hap_encoder_deps="libsnappy"
 hap_encoder_select="texturedspenc"
@@ -2753,6 +2757,7 @@ msmpeg4v3_decoder_select="h263_decoder"
 msmpeg4v3_encoder_select="h263_encoder"
 mss2_decoder_select="mpegvideo qpeldsp vc1_decoder"
 mts2_decoder_select="mss34dsp"
+mvm264_deps_any="libdl LoadLibrary"
 mwsc_decoder_deps="zlib"
 mxpeg_decoder_select="mjpeg_decoder"
 nellymoser_decoder_select="mdct sinewin"
@@ -6277,6 +6282,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 mvm264&& require_headers mvm264api.h 
 enabled openal&& { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
die "ERROR: openal not found"; } &&
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 15c43a8..8e8f9ab 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -348,6 +348,8 @@ OBJS-$(CONFIG_H264_DECODER)+= h264dec.o h264_cabac.o h264_cavlc.o \
   h264_slice.o h264data.o
 OBJS-$(CONFIG_H264_AMF_ENCODER)+= amfenc_h264.o
 OBJS-$(CONFIG_H264_CUVID_DECODER)  += cuviddec.o
+OBJS-$(CONFIG_H264_M264_DECODER)   += m264dec.o
+OBJS-$(CONFIG_H264_M264_ENCODER)   += m264enc.o
 OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o
 OBJS-$(CONFIG_H264_MMAL_DECODER)   += mmaldec.o
 OBJS-$(CONFIG_H264_NVENC_ENCODER)  += nvenc_h264.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index b26aeca..c03a5a3 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -737,6 +737,8 @@ extern AVCodec ff_libopenh264_encoder;
 extern AVCodec ff_libopenh264_decoder;
 extern AVCodec ff_h264_amf_encoder;
 extern AVCodec ff_h264_cuvid_decoder;
+extern AVCodec ff_h264_m264_decoder;
+extern AVCodec ff_h264_m264_encoder;
 extern AVCodec ff_h264_nvenc_encoder;
 extern AVCodec ff_h264_omx_encoder;
 extern AVCodec ff_h264_qsv_encoder;
diff --git a/libavcodec/m264dec.c b/libavcodec/m264dec.c
new file mode 100644
index 000..cb58bad
--- /dev/null
+++ b/libavcodec/m264dec.c
@@ -0,0 +1,304 @@
+/*
+ * M264 H.264 video decoder
+ *
+ * This file 

Re: [FFmpeg-devel] patch for a new H.264 codec with Matrox m264 card.

2019-03-28 Thread Yufei He
On 03/28/2019 04:18 PM, Dennis Mungai wrote:
> On Thu, 28 Mar 2019 at 22:40, Nicolas George  wrote:
>
>> No need to Cc me, I am subscribed to the list.
>>
>> Yufei He (12019-03-28):
>>> In windows, we need provide the interface library mvM264.lib to our
>>> customers so that they can build. But driver installation of the card
>>> does not have the interface library. It just install mvM264.dll.
>>>
>>> We call dlopen to load mvM264.dll on runtime.  It's simpler. That's
>>> the way we are doing now in other projects..
>> It may be simpler for your infrastructure, but it is not simpler for
>> FFmpeg users, and it actually feels like a deliberate attempt at
>> circumventing the license.
>>
>> Regards,
>>
>> --
>>Nicolas George
>>
>>
> It's actually a deliberate attempt at circumventing the license.
> Clearly that dynamic library *can* be built from source, as its' separable
> from the device driver.
> What's preventing Matrox from releasing this library such that users can
> build it themselves?
> And why should FFmpeg  inherit the maintenance burden of dealing with an
> opaque ABI whose breakage is guaranteed with version bumps?
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Actually, I'm just a software engineer, and very new to FFmpeg.
I know little about license. It's impossible to figure out some ideas to 
circumvent the license.

For me, the most important thing is to get it work. Most of my time is 
on studying code of FFmpeg and figure out how to support M264.

The way I'm doing now is all from study of current code in FFmpeg.
I'm still studying the way how companies like blackmagic support FFmpeg.

Regards.

Yufei.




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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] patch for a new H.264 codec with Matrox m264 card.

2019-03-28 Thread Yufei He
On 03/28/2019 10:00 AM, Jean-Baptiste Kempf wrote:
>
> On Thu, 28 Mar 2019, at 13:41, Yufei He wrote:
>> In windows, we need provide the interface library mvM264.lib to our
>> customers so that they can build. But driver installation of the card
>> does not have the interface library. It just install mvM264.dll.
> Why does mvM264.dll return 0 Google Search result?
>
>
>
Hi Jean-Baptiste

I just did the same Google search, yes, it seems most of the .dlls made 
in last 2 or 3 years can not be found.
I can find some old .dll files, e.g. mvcDCT.dll.

Yufei.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] patch for a new H.264 codec with Matrox m264 card.

2019-03-28 Thread Yufei He
On 03/27/2019 11:35 AM, Nicolas George wrote:

Yufei He (12019-03-27):


Here is the fixed patch for a new H.264 codec with Matrox M264 card.

It calls the default library from the card's driver installation.
Please review.



You are still using programmatic dynamic linking instead of normal
dynamic linking, and you have not given a good reason for that. Please
fix.

Regards,


Hi Nicolas

In windows, we need provide the interface library mvM264.lib to our customers 
so that they can build. But driver installation of the card does not have the 
interface library. It just install mvM264.dll.

We call dlopen to load mvM264.dll on runtime.  It's simpler. That's the way we 
are doing now in other projects..

Thanks.

Yufei.






___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org<mailto:ffmpeg-devel-requ...@ffmpeg.org> with 
subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] patch for a new H.264 codec with Matrox m264 card.

2019-03-27 Thread Yufei He
Hi

Here is the fixed patch for a new H.264 codec with Matrox M264 card.

It calls the default library from the card's driver installation.
Please review.

Thanks.

Yufei.
  

From da521d4e1315199a5fb781adf8a56efdc64c2b42 Mon Sep 17 00:00:00 2001
From: yhe 
Date: Wed, 27 Mar 2019 11:05:41 -0400
Subject: [PATCH] h.264 decoder and encoder support with M264

---
 Changelog  |   1 +
 configure  |   2 +
 libavcodec/Makefile|   2 +
 libavcodec/allcodecs.c |   2 +
 libavcodec/m264dec.c   | 357 +
 libavcodec/m264dec.h   |  40 ++
 libavcodec/m264enc.c   | 335 ++
 libavcodec/m264enc.h   |  38 ++
 8 files changed, 777 insertions(+)
 create mode 100644 libavcodec/m264dec.c
 create mode 100644 libavcodec/m264dec.h
 create mode 100644 libavcodec/m264enc.c
 create mode 100644 libavcodec/m264enc.h

diff --git a/Changelog b/Changelog
index 4d80e5b..ce0daf8 100644
--- a/Changelog
+++ b/Changelog
@@ -19,6 +19,7 @@ version :
 - ARBC decoder
 - libaribb24 based ARIB STD-B24 caption support (profiles A and C)
 - Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
+- Support h.264 encoding and decoding with Matrox M264 card.
 
 
 version 4.1:
diff --git a/configure b/configure
index dcead3a..3be416e 100755
--- a/configure
+++ b/configure
@@ -2697,6 +2697,8 @@ 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_m264_decoder_deps_any="libdl"
+h264_m264_encoder_deps_any="libdl libswscale"
 hap_decoder_select="snappy texturedsp"
 hap_encoder_deps="libsnappy"
 hap_encoder_select="texturedspenc"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 15c43a8..8e8f9ab 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -348,6 +348,8 @@ OBJS-$(CONFIG_H264_DECODER)+= h264dec.o h264_cabac.o h264_cavlc.o \
   h264_slice.o h264data.o
 OBJS-$(CONFIG_H264_AMF_ENCODER)+= amfenc_h264.o
 OBJS-$(CONFIG_H264_CUVID_DECODER)  += cuviddec.o
+OBJS-$(CONFIG_H264_M264_DECODER)   += m264dec.o
+OBJS-$(CONFIG_H264_M264_ENCODER)   += m264enc.o
 OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o
 OBJS-$(CONFIG_H264_MMAL_DECODER)   += mmaldec.o
 OBJS-$(CONFIG_H264_NVENC_ENCODER)  += nvenc_h264.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index b26aeca..c03a5a3 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -737,6 +737,8 @@ extern AVCodec ff_libopenh264_encoder;
 extern AVCodec ff_libopenh264_decoder;
 extern AVCodec ff_h264_amf_encoder;
 extern AVCodec ff_h264_cuvid_decoder;
+extern AVCodec ff_h264_m264_decoder;
+extern AVCodec ff_h264_m264_encoder;
 extern AVCodec ff_h264_nvenc_encoder;
 extern AVCodec ff_h264_omx_encoder;
 extern AVCodec ff_h264_qsv_encoder;
diff --git a/libavcodec/m264dec.c b/libavcodec/m264dec.c
new file mode 100644
index 000..f6cc65f
--- /dev/null
+++ b/libavcodec/m264dec.c
@@ -0,0 +1,357 @@
+/*
+ * M264 H.264 video decoder
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Matrox M264 card supports h.264 encoding and decoding.
+ */
+
+#include "decode.h"
+#include "cabac.h"
+#include "error_resilience.h"
+#include "h264_parse.h"
+#include "h264_ps.h"
+#include "h264_sei.h"
+#include "h2645_parse.h"
+#include "h264chroma.h"
+#include "h264dsp.h"
+#include "h264pred.h"
+#include "h264qpel.h"
+#include "internal.h"
+#include "mpegutils.h"
+#include "parser.h"
+#include "qpeldsp.h"
+#include "rectangle.h"
+#include "videodsp.h"
+#include "config.h"
+#include "libswscale/swscale.h"
+#include "libavutil/opt.h"
+#include "m264dec.h"
+#ifdef _WIN32
+#include "compat/w32dlfcn.h"
+#else
+#include 
+#endif
+
+typedef struct {
+   uint16_t input_width;
+   uint16_t input_height;
+   uint16_t output_width;
+   uint16_t output_height;
+   uint16_t scale;
+   uint16_t rate;
+   uint16_t gop_size;
+   uint32_t bitrate;
+   uint8_t  field_order;
+} M264DecoderInfo;
+
+typedef struct {
+AVClass *class;
+int (*init_m264_decoder)(void *decoder_info, void **m264_decoder_object);

Re: [FFmpeg-devel] scaling option

2019-03-27 Thread Yufei He
On 03/26/2019 02:36 PM, Dennis Mungai wrote:


On Tue, Mar 26, 2019, 21:20 Yufei He mailto:y...@matrox.com>> 
wrote:
On 03/26/2019 11:31 AM, Dennis Mungai wrote:
> On Tue, 26 Mar 2019 at 18:21, Yufei He 
> mailto:y...@matrox.com>> wrote:
>
>> On 03/26/2019 08:53 AM, Timo Rothenpieler wrote:
>> On 26/03/2019 13:47, Yufei He wrote:
>> Hi
>>
>> Is there option for scaling on transcoding ?
>>
>> e.g. transcoding from a quadhd file to 640 * 480.
>>
>> Thanks.
>>
>> Yufei.
>>
>>
>> Yes there is, but this is ffmpeg-devel, so not the place to ask user
>> questions.
>>
>> Yes, I see the option of -vf scale=width:height
>> We can do scaling on decoding or encoding, my question was to check if
>> there is scaling option for codec.
>> I'll add special scaling option to our codec.
>>
>>
> Hello there,
>
> Scaling comes in two forms (correct me if I'm wrong):
>
> 1. Specific video filters, such as the scale filters, and other
> hardware-accelerated implementations, such as scale_npp, scale_cuda,
> scale_vaapi, etc.
> 2. Decoders (Not too sure if equating the private -resize option provided
> by these decoders is equivalent to "scaling"):
>
> See the example provided by the likes of the cuvid implementations, such as
> h264_cuvid, etc:
>
> ffmpeg -h decoder=h264_cuvid
>
> The -resize option therein acts as a scaler.
>
> Are you planning to implement a codec-specific hardware (or software-based)
> scaler (implemented as a video filter or a decoder), with similar
> functionality?
Hi Dennis
Our hardware m264 supports scaling and encoding or decoding at the same
time, this saves memory copy time between host and card if it's scaled
in host or in other separate filter.
I'm trying to make it work in FFmpeg.

Yufei.


Here's what you'll need to implement:

1. A hwaccel of the type equivalent to the accelerator backend you're creating, 
and

2. The actual hwaccel implementation. This will be an encoder (or set of 
encoders) targeting the codecs you're after.

3. Based on the two above, create video filters that can take advantage of 
hwupload, hwdownload, etc to create filter chains that will allow to move (and 
map) textures, etc from system to device memory . Take a look at how CUDA based 
hwaccels are implemented. That's a good crash course on what needs to be done.

4. Understand how the FFmpeg development process works. Patches are welcome, 
but the review process and adherence to coding standards matters even more. See 
the wikis on what's expected regarding the development process. I'd suggest 
being aware of the subsystem maintainers and the roles they play.

5. On vendor specific libraries: I'd suggest releasing this as an open 
implementation such that it can be hosted in a manner similar to how the 
ffnvcodec headers are handled. Trust me, you'll greatly lower the maintainance 
overhead on time.

Hope that helps.
Hi Dennis

We will talk about your suggestion and schedule it later.

Thanks for your help.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] scaling option

2019-03-26 Thread Yufei He
On 03/26/2019 11:31 AM, Dennis Mungai wrote:
> On Tue, 26 Mar 2019 at 18:21, Yufei He  wrote:
>
>> On 03/26/2019 08:53 AM, Timo Rothenpieler wrote:
>> On 26/03/2019 13:47, Yufei He wrote:
>> Hi
>>
>> Is there option for scaling on transcoding ?
>>
>> e.g. transcoding from a quadhd file to 640 * 480.
>>
>> Thanks.
>>
>> Yufei.
>>
>>
>> Yes there is, but this is ffmpeg-devel, so not the place to ask user
>> questions.
>>
>> Yes, I see the option of -vf scale=width:height
>> We can do scaling on decoding or encoding, my question was to check if
>> there is scaling option for codec.
>> I'll add special scaling option to our codec.
>>
>>
> Hello there,
>
> Scaling comes in two forms (correct me if I'm wrong):
>
> 1. Specific video filters, such as the scale filters, and other
> hardware-accelerated implementations, such as scale_npp, scale_cuda,
> scale_vaapi, etc.
> 2. Decoders (Not too sure if equating the private -resize option provided
> by these decoders is equivalent to "scaling"):
>
> See the example provided by the likes of the cuvid implementations, such as
> h264_cuvid, etc:
>
> ffmpeg -h decoder=h264_cuvid
>
> The -resize option therein acts as a scaler.
>
> Are you planning to implement a codec-specific hardware (or software-based)
> scaler (implemented as a video filter or a decoder), with similar
> functionality?
Hi Dennis
Our hardware m264 supports scaling and encoding or decoding at the same 
time, this saves memory copy time between host and card if it's scaled 
in host or in other separate filter.
I'm trying to make it work in FFmpeg.

Yufei.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] scaling option

2019-03-26 Thread Yufei He
On 03/26/2019 08:53 AM, Timo Rothenpieler wrote:
On 26/03/2019 13:47, Yufei He wrote:
Hi

Is there option for scaling on transcoding ?

e.g. transcoding from a quadhd file to 640 * 480.

Thanks.

Yufei.


Yes there is, but this is ffmpeg-devel, so not the place to ask user questions.

Yes, I see the option of -vf scale=width:height
We can do scaling on decoding or encoding, my question was to check if there is 
scaling option for codec.
I'll add special scaling option to our codec.




___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org<mailto:ffmpeg-devel-requ...@ffmpeg.org> with 
subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] scaling option

2019-03-26 Thread Yufei He
Hi

Is there option for scaling on transcoding ?

e.g. transcoding from a quadhd file to 640 * 480.

Thanks.

Yufei.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] News: Removal of libndi

2019-03-25 Thread Yufei He
Yes, it's part of the installation for the driver of the card. People 
who have the card will install it.

Thanks.

Yufei


On 03/25/2019 01:04 PM, Jean-Baptiste Kempf wrote:
> On Mon, 25 Mar 2019, at 14:02, Yufei He wrote:
>> Matrox card is very similar to cards from other companies in terms of
>> accesses.
> Then why do you have this specific libmvM264Ffmpeg library?
> What is it? Is it part of the driver? Is it installed at the same time as the 
> driver?
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] AVPixelFormat for YUYV 10 bit.

2019-03-25 Thread Yufei He
It's a standard format. I suggest that it should be in AVPixelFormat.  
the codec can do the conversion.

Yufei.


On 03/25/2019 09:55 AM, Kieran Kunhya wrote:
> On Mon, 25 Mar 2019 at 13:53 Yufei He  wrote:
>
>> Hi
>>
>> I think there may be one format missing in AVPixelFormat.
>>
>> AV_PIX_FMT_YUYV210
>>
> For various reasons v210 and friends are implemented as a codec in FFmpeg.
>
> Kieran
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] AVPixelFormat for YUYV 10 bit.

2019-03-25 Thread Yufei He
Hi

I think there may be one format missing in AVPixelFormat.

AV_PIX_FMT_YUYV210


[cid:part1.002B7405.3138ACFB@matrox.com]


The start of each line in the V210 video buffer format must be
aligned to a multiple of 48 pixels (128 bytes). This means that if a line is 
not a
multiple of 48, each line of video data must be padded out to the nearest 48 
pixel
boundary. For example, a 1280 × 720 video buffer is 1280 pixels wide, which is 
not a
multiple of 48. Each line of the video buffer must be padded to 1296 pixels 
(3456
bytes) in order to make each line a multiple of 48.

It's popular when video is in 10bit.

Yufei.





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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] News: Removal of libndi

2019-03-25 Thread Yufei He
Hi

Matrox card is very similar to cards from other companies in terms of 
accesses.

I suggest that we should differentiate hardware codec and software codec.

Hardware codecs are very strong help to FFmpeg for high resolution video 
encoding and decoding like 4k. though gradually software codec will be 
stronger and stronger with CPU grows.

Currently, it's very hard to trancode a quadhd  mxf file to a streaming 
.mp4 file with cpu.

Actually, I don't know what we can get from code to access the hardware, 
it's all detailed hardware access api.

Hardware codecs and software codecs are taking different responsibilities.

Thanks a lot.

Yufei.


On 03/24/2019 04:14 PM, Jean-Baptiste Kempf wrote:
> On Sun, 24 Mar 2019, at 20:10, Ronald S. Bultje wrote:
>> The GPL does not mention hardware (instead, they use the word "system
>> library"). Going from here, I don't consider enterprise-level hardware like
>> Matrox $$$ priced stuff to be a system library at all. My system certainly
>> has no hardware or drivers or system-level libraries that are
>> API+ABI+functionally compatible with Matrox' tools and wares - under any
>> license, not open-source and not closed-source. How can the system library
>> exception possibly apply here?
> Drivers have always been considered part of the OS, whatever the price of the 
> hardware.
> The Linux kernel has drivers for pieces of hardware that are way more 
> expensive than Matrox hardware.
>
> So, if the library is part of the driver (installed at the same time), it is 
> considered part of the "major components of the OS", because if you don't 
> install the driver, you cannot use the hardware.
> This is the opinion of the Linux Foundation, the FSF, FSFE and so many others.
>
> Usually, the "major components" (as mentioned in the GPL and not "system 
> libraries", which is the shortcut) explicitly mention 3 parts: kernel, 
> compiler and  "others."
> The common understanding is that everything that runs in Kernel-Land, aka 
> kernel + drivers is the kernel part of the "major components". libc, compiler 
> and libraries linked by compilers, if distributed with the OS, are the second 
> part of the "major components"; and the last part, "others" cover the other 
> core parts of the OS (usually the "base" in linux distributions), and covers 
> init and the shell, and the basic services normally installed by default (at, 
> cron, etc..).
>
> Yes, this meaning is very dated, but GPLv2 is from 1991.
>
>
> Most of those hardware libraries are glorified ioctls around the driver and 
> shipped with the drivers.
> And I see this with nVidia, Intel MFX and Decklink (lots of "acquire C++ 
> interface, set param" there, release the C++ interface).
>
> Matrox seems to do something else, though, introducing a special library for 
> FFmpeg consumption, and I doubt that feels like a driver...
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] mxf file support

2019-03-22 Thread Yufei He
Hi Tomas

Sony defined many kinds of meta data.

e.g. SMPTE RDD 18:2012

Acquisition Metadata Sets for
Video Camera Parameters

I think the file created by -vcodec copy is a general op1a mxf file.

It can not pass Sony's mxf file verifier, which means their camera can 
not play those files.

Yufei.


On 03/22/2019 11:11 AM, Tomas Härdin wrote:
> fre 2019-03-22 klockan 12:47 + skrev Yufei He:
>> Hi Tomas
>>
>>   From my tests, I find FFmpeg can demux XAVC mxf files from Sony and
>> find the video stream is actually h.264 data. This is very good to us.
>>
>> Actually Sony XAVC mxf has a lot of restrictions on mxf file wrapper and
>> h.264 data.
>>
>> But I don't know how to specify the it or it's not supported yet in FFmpeg.
>>
>> Probably we can support it if it's not there yet.
> This depends on what the restrictions are. The first step would be to
> just remux (-vcodec copy) the files and see what happens. If that
> doesn't work then mxfenc.c would need to be patched
>
> /Tomas
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] mxf file support

2019-03-22 Thread Yufei He
Hi Tomas

 From my tests, I find FFmpeg can demux XAVC mxf files from Sony and 
find the video stream is actually h.264 data. This is very good to us.

Actually Sony XAVC mxf has a lot of restrictions on mxf file wrapper and 
h.264 data.

But I don't know how to specify the it or it's not supported yet in FFmpeg.

Probably we can support it if it's not there yet.

Yufei.


On 03/21/2019 06:09 PM, Tomas Härdin wrote:
> tor 2019-03-21 klockan 18:48 + skrev Yufei He:
>> Hi
>>
>> It seems FFmpeg supports reading all kinds of mxf files from Sony and
>> Panasonics. it's very good to find that FFmpeg can support Sony XAVC
>> QuadHD files and find the essence data is actually H.264.
>>
>> Our customers have a lot of high data rate mxf files from Sony and
>> Panasonics. They need transcode those files to streaming files like
>> .ts,.mp4, etc.
> Here it sounds like you you want to demux Sony XAVC MXFs..
>
>> Does FFmpeg supports writing Sony XAVC mxf files ?
> and here it sounds like you want to mux them.
>
> It's certainly possible to ape whatever peculiaritites Sony has for its
> MXF muxer, I've done similar things with MXF in the past.
>
> /Tomas
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] mxf file support

2019-03-21 Thread Yufei He
Hi

It seems FFmpeg supports reading all kinds of mxf files from Sony and 
Panasonics. it's very good to find that FFmpeg can support Sony XAVC 
QuadHD files and find the essence data is actually H.264.

Our customers have a lot of high data rate mxf files from Sony and 
Panasonics. They need transcode those files to streaming files like 
.ts,.mp4, etc.

Does FFmpeg supports writing Sony XAVC mxf files ?

Thanks.

Yufei.

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


[FFmpeg-devel] aac variable encoding

2019-03-21 Thread Yufei He
Hi

On transcoding from 1080p .ts files to .mp4 files with my m264 codec, 
audio of the output .mp4 files stutters.

We found audio of the stuttering files is vbr.

I did not set aac encoding bitrate. somehow it becomes vbr when I use my 
m264 codec on transcoding 1080p files.

It works well for 1080i .ts files and all .mp4 and .mov files, and aac 
audio of the output files is cbr.

So the problem is why aac encoding becomes vbr.

Command I use is:

./ffmpeg -i TS/TSv2m2641080p30mcbr.ts  -vsync 0 -vcodec m264 -b:v 10M 
8_ff.mp4

Thanks.

Yufei.









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


Re: [FFmpeg-devel] patch for a new H.264 codec with Matrox m264 card.

2019-03-15 Thread Yufei He
Hi Jean-Baptiste

Sorry for the complexity and confusion to so many people involved on 
this new patch.

We have been working on this for 4 months because some of our big 
customers on internet business have been asking Matrox to make our M264 
card to support FFmpeg on h.264 transcoding, esp on 4k and HD files.

M264 is very powerful on 4k and HD decoding and encoding.

M264 uses a h.264 encoding chip made by Matrox, and there are a lot of 
modules involved to make it work. Those modules are not public in 
Matrox, which is a company of 40 years.

Yes, mvM264Ffmpeg.dll is a wrapper to those modules, it involves all the 
interfaces talking to the chip.

I did not find a better way to make this work.

Thanks a lot to all people involved.

Yufei.


On 03/15/2019 11:23 AM, Jean-Baptiste Kempf wrote:
> On Fri, 15 Mar 2019, at 15:02, Tomas Härdin wrote:
>>> +#ifdef _WIN32
>>> +lib_handle = dlopen("mvM264Ffmpeg.dll", RTLD_LAZY);
>>> +#else
>>> +lib_handle = dlopen("libmvM264Ffmpeg.so", RTLD_LAZY);
>>> +#endif
>> Still dlopen() I see. You should link to these libraries properly, as
>> others have said, and add appropriate license stuff to configure.
> What are those libraries? Are they drivers/system libraries?
>
> They seem to be a wrapper done just for the FFMpeg integration. If so, what 
> is the license of those?
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] patch for a new H.264 codec with Matrox m264 card.

2019-03-14 Thread Yufei He
Hi

Here is the patch for a new H.264 codec with Matrox m264 card.

Please review.

Thanks.

Yufei.


From b1f7779028378f3e0d5360766a8591d0cf5a0a71 Mon Sep 17 00:00:00 2001
From: yhe 
Date: Thu, 14 Mar 2019 10:10:46 -0400
Subject: [PATCH] H.264 encoder and decoder support with Matrox M264.

---
 Changelog   |   1 +
 configure   |   2 +
 libavcodec/Makefile |   2 +
 libavcodec/allcodecs.c  |   2 +
 libavcodec/codec_desc.c |   1 -
 libavcodec/m264dec.c| 315 
 libavcodec/m264dec.h|  39 ++
 libavcodec/m264enc.c| 296 +
 libavcodec/m264enc.h|  38 ++
 9 files changed, 695 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/m264dec.c
 create mode 100644 libavcodec/m264dec.h
 create mode 100644 libavcodec/m264enc.c
 create mode 100644 libavcodec/m264enc.h

diff --git a/Changelog b/Changelog
index 4d80e5b..ce0daf8 100644
--- a/Changelog
+++ b/Changelog
@@ -19,6 +19,7 @@ version :
 - ARBC decoder
 - libaribb24 based ARIB STD-B24 caption support (profiles A and C)
 - Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
+- Support h.264 encoding and decoding with Matrox M264 card.
 
 
 version 4.1:
diff --git a/configure b/configure
index dcead3a..5a5d7d5 100755
--- a/configure
+++ b/configure
@@ -2697,6 +2697,8 @@ 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_m264_decoder_deps_any="libdl"
+h264_m264_encoder_deps_any="libdl"
 hap_decoder_select="snappy texturedsp"
 hap_encoder_deps="libsnappy"
 hap_encoder_select="texturedspenc"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 15c43a8..8e8f9ab 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -348,6 +348,8 @@ OBJS-$(CONFIG_H264_DECODER)+= h264dec.o h264_cabac.o h264_cavlc.o \
   h264_slice.o h264data.o
 OBJS-$(CONFIG_H264_AMF_ENCODER)+= amfenc_h264.o
 OBJS-$(CONFIG_H264_CUVID_DECODER)  += cuviddec.o
+OBJS-$(CONFIG_H264_M264_DECODER)   += m264dec.o
+OBJS-$(CONFIG_H264_M264_ENCODER)   += m264enc.o
 OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o
 OBJS-$(CONFIG_H264_MMAL_DECODER)   += mmaldec.o
 OBJS-$(CONFIG_H264_NVENC_ENCODER)  += nvenc_h264.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index b26aeca..c03a5a3 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -737,6 +737,8 @@ extern AVCodec ff_libopenh264_encoder;
 extern AVCodec ff_libopenh264_decoder;
 extern AVCodec ff_h264_amf_encoder;
 extern AVCodec ff_h264_cuvid_decoder;
+extern AVCodec ff_h264_m264_decoder;
+extern AVCodec ff_h264_m264_encoder;
 extern AVCodec ff_h264_nvenc_encoder;
 extern AVCodec ff_h264_omx_encoder;
 extern AVCodec ff_h264_qsv_encoder;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index a3de8e1..55c02a8 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1705,7 +1705,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Gryphon's Anim Compressor"),
 .props = AV_CODEC_PROP_LOSSY,
 },
-
 /* various PCM "codecs" */
 {
 .id= AV_CODEC_ID_PCM_S16LE,
diff --git a/libavcodec/m264dec.c b/libavcodec/m264dec.c
new file mode 100644
index 000..f16716e
--- /dev/null
+++ b/libavcodec/m264dec.c
@@ -0,0 +1,315 @@
+/*
+ * M264 H.264 video decoder
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Matrox M264 card supports h.264 encoding and decoding.
+ */
+
+#include "decode.h"
+#include "cabac.h"
+#include "error_resilience.h"
+#include "h264_parse.h"
+#include "h264_ps.h"
+#include "h264_sei.h"
+#include "h2645_parse.h"
+#include "h264chroma.h"
+#include "h264dsp.h"
+#include "h264pred.h"
+#include "h264qpel.h"
+#include "internal.h"
+#include "mpegutils.h"
+#include "parser.h"
+#include "qpeldsp.h"
+#include "rectangle.h"
+#include "videodsp.h"
+#include "config.h"
+#include "libswscale/swscale.h"
+#include "m264dec.h"
+#ifdef _WIN32
+#include "compat/w32dlfcn.h"
+#else

[FFmpeg-devel] extradata on h.264 encoding for mp4 and mov files.

2019-03-11 Thread Yufei He
Hi

It seems ffmpeg can only generate AVCC box if I set extradata in my encoder's 
init function, it does not take the extradata if I make it in receive_packet 
function.

But I don't have sps and pps when the encoder's init function is called. I only 
can get it when I get first encoded frame.

Please help.

Thanks.

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


Re: [FFmpeg-devel] patch for a new H.264 codec

2019-03-11 Thread Yufei He
Hi Carl

Matrox M264 is similar to other hardware codecs.

I saw amf_load_library and nvenc_load_library in ffmpeg.

Matrox M264 is the same.

We got a lot customers using ffmpeg and they want to use Matrox M264 to do 
transcoding.

Thanks a lot.

Yufei.


static int amf_load_library(AVCodecContext *avctx)
{
AmfContext *ctx = avctx->priv_data;
AMFInit_Fn init_fun;
AMFQueryVersion_Fn version_fun;
AMF_RESULT res;
ctx->delayed_frame = av_frame_alloc();
if (!ctx->delayed_frame) {
return AVERROR(ENOMEM);
}
// hardcoded to current HW queue size - will realloc in 
timestamp_queue_enqueue() if too small
ctx->timestamp_list = av_fifo_alloc((avctx->max_b_frames + 16) * 
sizeof(int64_t));
if (!ctx->timestamp_list) {
return AVERROR(ENOMEM);
}
ctx->dts_delay = 0;
ctx->library = dlopen(AMF_DLL_NAMEA, RTLD_NOW | RTLD_LOCAL);
AMF_RETURN_IF_FALSE(ctx, ctx->library != NULL,
AVERROR_UNKNOWN, "DLL %s failed to open\n", AMF_DLL_NAMEA);
init_fun = (AMFInit_Fn)dlsym(ctx->library, AMF_INIT_FUNCTION_NAME);
AMF_RETURN_IF_FALSE(ctx, init_fun != NULL, AVERROR_UNKNOWN, "DLL %s failed to 
find function %s\n", AMF_DLL_NAMEA, AMF_INIT_FUNCTION_NAME);
version_fun = (AMFQueryVersion_Fn)dlsym(ctx->library, 
AMF_QUERY_VERSION_FUNCTION_NAME);
AMF_RETURN_IF_FALSE(ctx, version_fun != NULL, AVERROR_UNKNOWN, "DLL %s failed 
to find function %s\n", AMF_DLL_NAMEA, AMF_QUERY_VERSION_FUNCTION_NAME);


static av_cold int nvenc_load_libraries(AVCodecContext *avctx)
{
NvencContext *ctx = avctx->priv_data;
NvencDynLoadFunctions *dl_fn = >nvenc_dload_funcs;
NVENCSTATUS err;
uint32_t nvenc_max_ver;
int ret;
ret = cuda_load_functions(_fn->cuda_dl, avctx);
if (ret < 0)
return ret;
ret = nvenc_load_functions(_fn->nvenc_dl, avctx);
if (ret < 0) {
nvenc_print_driver_requirement(avctx, AV_LOG_ERROR);
return ret;
}
err = dl_fn->nvenc_dl->NvEncodeAPIGetMaxSupportedVersion(_max_ver);
if (err != NV_ENC_SUCCESS)
return nvenc_print_error(avctx, err, "Failed to query nvenc max version");
av_log(avctx, AV_LOG_VERBOSE, "Loaded Nvenc version %d.%d\n", nvenc_max_ver >> 
4, nvenc_max_ver & 0xf);
if ((NVENCAPI_MAJOR_VERSION << 4 | NVENCAPI_MINOR_VERSION) > nvenc_max_ver) {
av_log(avctx, AV_LOG_ERROR, "Driver does not support the required nvenc API 
version. "
"Required: %d.%d Found: %d.%d\n",
NVENCAPI_MAJOR_VERSION, NVENCAPI_MINOR_VERSION,
nvenc_max_ver >> 4, nvenc_max_ver & 0xf);
On 03/11/2019 07:04 AM, Carl Eugen Hoyos wrote:

2019-03-11 11:57 GMT+01:00, Ronald S. Bultje 
:



- How do we set up a fate station with m264 support?



We do not test any external libraries with fate.

[...]



- How do we test that it still works after we make innocent
changes to some API?



Same as so far: We remove the feature that isn't updated.



- If we add new H264 files to our conformance suite, how
do we confirm that m264dec passes them?



That wouldn't work for any of our external codecs (at least
for some it wouldn't), in some cases the reason is that
the external codec supports things unsupported by FFmpeg,
in some cases there are license issues even with
open-source software.

Sorry, but some of this sounds like a solution in search of a
problem.

No strong opinion here about Matrox but we accepted AMD
in spite of their mails, so I don't see why we can't accept a
non-free Matrox codec (as long as the patch is reasonably
clean).

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


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


[FFmpeg-devel] How to make a mp4 file have AVCC box

2019-03-07 Thread Yufei He
Hi

I have a problem that the trancoded MP4 file does not have valid AVCC box. It's 
supposed to have the extradata from the codec.

I can only get the extradata after I receive the first encoded frame, while I 
don't have any frame in my encoder's init function.

It seems ffmpeg can only generate AVCC box if I set extradata in my encoder's 
init function, it does not take the extradata if I make it in receive_packet 
function.

Please help.

Thanks.

Yufei.
if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER && !avctx->extradata) {
const AVBitStreamFilter *filter = av_bsf_get_by_name("extract_extradata");
ret = av_bsf_alloc(filter, );
if (ret < 0)
return ret;
ret = avcodec_parameters_from_context(ctx->par_in, avctx);
if (ret < 0)
return ret;
ret = av_bsf_init(ctx);
if (ret < 0)
return ret;
ctx->time_base_in = avctx->time_base;
ret = av_bsf_send_packet(ctx, avpkt);
if (ret < 0)
return ret;
ret = av_bsf_receive_packet(ctx, avpkt);
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
return 0;
if (avpkt->side_data_elems > 0 )
{
avctx->extradata = av_mallocz(avpkt->side_data->size + 
AV_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
memcpy(avctx->extradata, avpkt->side_data->data, avpkt->side_data->size);
avctx->extradata_size = avpkt->side_data->size;
}
av_bsf_free();
}

On 03/06/2019 02:10 PM, James Almer wrote:

On 3/6/2019 4:04 PM, Yufei He wrote:


Hi

I want to use   ff_extract_extradata_bsf to get extradata from a h.264 frame.

Here is the code.

AVPacket *avpkt; // there is valid data.
AVBSFContext *ctx = NULL;
ret = av_bsf_alloc(_extract_extradata_bsf, );
ret = ff_extract_extradata_bsf.init(ctx);
ret = ff_extract_extradata_bsf.filter(ctx, avpkt);

ff_extract_extradata_bsf.filter failed on calling ff_bsf_get_packet_ref because 
 ctx->internal->buffer+pkt->data is NULL.

int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
{
AVBSFInternal *in = ctx->internal;
if (in->eof)
return AVERROR_EOF;
if (!ctx->internal->buffer_pkt->data &&
!ctx->internal->buffer_pkt->side_data_elems)
return AVERROR(EAGAIN);

How should ctx->internal->buffer+pkt->data be set?

Thanks.

Yufei.


You're not using the bsf API correctly. You're accessing internal
callbacks like init() and filter() directly. Use the public functions
defined in avcodec.h, and look at usage examples like in ffmpeg.c if needed.

Also, any further questions or emails about this should go to the
libav-user list at https://lists.ffmpeg.org/mailman/listinfo/libav-user/
This list is for actual ffmpeg development, not for usage questions.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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


[FFmpeg-devel] How to make a mp4 file have AVCC box

2019-03-07 Thread Yufei He
Hi James

Thanks. I got the extradata from first encoded frame with functions in 
avcodec.h and examples in ffmpeg.c.

My problem is that the trancoded MP4 file does not have valid AVCC box. It's 
supposed to have the extradata from the codec.

I can only get the extradata after I receive the first encoded frame, while I 
don't have any frame in my encoder's init function.

It seems ffmpeg can only generate AVCC box if I set extradata in my encoder's 
init function, it does not take the extradata if I make it in receive_packet 
function.

Please help.

Yufei.
if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER && !avctx->extradata) {
const AVBitStreamFilter *filter = av_bsf_get_by_name("extract_extradata");
ret = av_bsf_alloc(filter, );
if (ret < 0)
return ret;
ret = avcodec_parameters_from_context(ctx->par_in, avctx);
if (ret < 0)
return ret;
ret = av_bsf_init(ctx);
if (ret < 0)
return ret;
ctx->time_base_in = avctx->time_base;
ret = av_bsf_send_packet(ctx, avpkt);
if (ret < 0)
return ret;
ret = av_bsf_receive_packet(ctx, avpkt);
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
return 0;
if (avpkt->side_data_elems > 0 )
{
avctx->extradata = av_mallocz(avpkt->side_data->size + 
AV_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
memcpy(avctx->extradata, avpkt->side_data->data, avpkt->side_data->size);
avctx->extradata_size = avpkt->side_data->size;
}
av_bsf_free();
}

On 03/06/2019 02:10 PM, James Almer wrote:

On 3/6/2019 4:04 PM, Yufei He wrote:


Hi

I want to use   ff_extract_extradata_bsf to get extradata from a h.264 frame.

Here is the code.

AVPacket *avpkt; // there is valid data.
AVBSFContext *ctx = NULL;
ret = av_bsf_alloc(_extract_extradata_bsf, );
ret = ff_extract_extradata_bsf.init(ctx);
ret = ff_extract_extradata_bsf.filter(ctx, avpkt);

ff_extract_extradata_bsf.filter failed on calling ff_bsf_get_packet_ref because 
 ctx->internal->buffer+pkt->data is NULL.

int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
{
AVBSFInternal *in = ctx->internal;
if (in->eof)
return AVERROR_EOF;
if (!ctx->internal->buffer_pkt->data &&
!ctx->internal->buffer_pkt->side_data_elems)
return AVERROR(EAGAIN);

How should ctx->internal->buffer+pkt->data be set?

Thanks.

Yufei.



You're not using the bsf API correctly. You're accessing internal
callbacks like init() and filter() directly. Use the public functions
defined in avcodec.h, and look at usage examples like in ffmpeg.c if needed.

Also, any further questions or emails about this should go to the
libav-user list at https://lists.ffmpeg.org/mailman/listinfo/libav-user/
This list is for actual ffmpeg development, not for usage questions.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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


[FFmpeg-devel] question for ff_extract_extradata_bsf

2019-03-06 Thread Yufei He
Hi

I want to use   ff_extract_extradata_bsf to get extradata from a h.264 frame.

Here is the code.

AVPacket *avpkt; // There is valid data.
AVBSFContext *ctx = NULL;
ret = av_bsf_alloc(_extract_extradata_bsf, );
ret = ff_extract_extradata_bsf.init(ctx);
ret = ff_extract_extradata_bsf.filter(ctx, avpkt);

ff_extract_extradata_bsf.filter failed on calling ff_bsf_get_packet_ref because 
 ctx->internal->buffer_pkt->data is NULL.

int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
{
AVBSFInternal *in = ctx->internal;
if (in->eof)
return AVERROR_EOF;
if (!ctx->internal->buffer_pkt->data &&
!ctx->internal->buffer_pkt->side_data_elems)
return AVERROR(EAGAIN);

...
}


How should ctx->internal->buffer+pkt->data be set?

Thanks.

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


[FFmpeg-devel] question for ff_extract_extradata_bsf

2019-03-06 Thread Yufei He
Hi

I want to use   ff_extract_extradata_bsf to get extradata from a h.264 frame.

Here is the code.

AVPacket *avpkt; // there is valid data.
AVBSFContext *ctx = NULL;
ret = av_bsf_alloc(_extract_extradata_bsf, );
ret = ff_extract_extradata_bsf.init(ctx);
ret = ff_extract_extradata_bsf.filter(ctx, avpkt);

ff_extract_extradata_bsf.filter failed on calling ff_bsf_get_packet_ref because 
 ctx->internal->buffer+pkt->data is NULL.

int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
{
AVBSFInternal *in = ctx->internal;
if (in->eof)
return AVERROR_EOF;
if (!ctx->internal->buffer_pkt->data &&
!ctx->internal->buffer_pkt->side_data_elems)
return AVERROR(EAGAIN);

How should ctx->internal->buffer+pkt->data be set?

Thanks.

Yufei.



On 03/06/2019 01:09 PM, Lynne wrote:

A lot of files have CRC included.
The CRC only covers 34 bytes at most from the frame but it should still be
enough for some amount of error detection.




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


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


Re: [FFmpeg-devel] patch for a new H.264 codec

2019-02-26 Thread Yufei He
Hi Moritz

It's the first time that I send patch to ffmpeg, for sure I don't know a 
lot of things for ffmpeg.

Thanks a lot for your detailed review.

I'll read the doc and fix the issues you said.

Yufei.


On 02/25/2019 04:21 PM, Moritz Barsnick wrote:
> Hi Yufei,
> before providing large patches here, do read this mailing list and the
> ffmpeg codebase for a while. It will help you to understand the
> process, and to understand how ffmpeg's sources are organized.
>
> I'm sure you missed this:
> https://www.ffmpeg.org/developer.html
>
> Read all of it thoroughly.
>
> The content of this section:
> https://www.ffmpeg.org/developer.html#Coding-Rules-1
> especially comes to mind. Your code uses totally different formatting
> than the rest of the ffmpeg codebase. You should take a look around as
> see how others do it, and what that style guide says.
>
> Apart from that: Everything that Nicolas wrote.
>
> In addition this:
>
> On Mon, Feb 25, 2019 at 19:49:43 +, Yufei He wrote:
>> index c90f119..f70368b 100644
>> --- a/Changelog
>> +++ b/Changelog
>> @@ -11,6 +11,7 @@ version :
>>   - dhav demuxer
>>   - PCM-DVD encoder
>>   - GIF parser
>> +- M264 encoder
> Your patch is against an at least two months old version of ffmpeg git.
> Please merge it to latest git HEAD and create a new patch. Your patch
> won't apply currently, and therefore noone will bother to test it.
>
> And even if I try to work around that, here's what happens:
>
> LD  ffmpeg_g
> /usr/bin/ld: libavcodec/libavcodec.a(m264enc.o): in function 
> `ff_m264_encode_init':
> /home/barsnick/Development/ffmpeg-stuff/ffmpeg/libavcodec/m264enc.c:98: 
> undefined reference to `dlopen'
> /usr/bin/ld: 
> /home/barsnick/Development/ffmpeg-stuff/ffmpeg/libavcodec/m264enc.c:108: 
> undefined reference to `dlsym'
> /usr/bin/ld: 
> /home/barsnick/Development/ffmpeg-stuff/ffmpeg/libavcodec/m264enc.c:109: 
> undefined reference to `dlsym'
> /usr/bin/ld: 
> /home/barsnick/Development/ffmpeg-stuff/ffmpeg/libavcodec/m264enc.c:110: 
> undefined reference to `dlsym'
> /usr/bin/ld: 
> /home/barsnick/Development/ffmpeg-stuff/ffmpeg/libavcodec/m264enc.c:111: 
> undefined reference to `dlsym'
> /usr/bin/ld: 
> /home/barsnick/Development/ffmpeg-stuff/ffmpeg/libavcodec/m264enc.c:112: 
> undefined reference to `dlsym'
> /usr/bin/ld: 
> libavcodec/libavcodec.a(m264enc.o):/home/barsnick/Development/ffmpeg-stuff/ffmpeg/libavcodec/m264enc.c:113:
>  more undefined references to `dlsym' follow
> /usr/bin/ld: libavcodec/libavcodec.a(m264enc.o): in function 
> `ff_m264_encode_close':
> /home/barsnick/Development/ffmpeg-stuff/ffmpeg/libavcodec/m264enc.c:264: 
> undefined reference to `dlclose'
> collect2: error: ld returned 1 exit status
> make: *** [Makefile:108: ffmpeg_g] Error 1
>
> You need to get your dependencies right.
>
>> +   if(*got_output)
>> +   {
>> +  if(decoded_frame->width == 0)
>> +  {
>> + av_log(NULL, AV_LOG_DEBUG, "Frame parameters mismatch context 
>> %d,%d,%d != %d,%d,%d\n",
>> +   decoded_frame->width,
>> +   decoded_frame->height,
>> +   decoded_frame->format,
>> +   ist->dec_ctx->width,
>> +   ist->dec_ctx->height,
>> +   ist->dec_ctx->pix_fmt);
>> +  }
>> +   }
> This is debug code and does not belong into a released codec.
> Furthermore, ffmpeg provides av_log() functions.
>
>> index 000..dc1852f
>> --- /dev/null
>> +++ b/libavcodec/.vscode/settings.json
> Don't commit your local development environment's settings, please.
>
>>   OBJS-$(CONFIG_DNXHD_DECODER)   += dnxhddec.o dnxhddata.o
>>   OBJS-$(CONFIG_DNXHD_ENCODER)   += dnxhdenc.o dnxhddata.o
>> +OBJS-$(CONFIG_M264_ENCODER)+= m264enc.o
>> +OBJS-$(CONFIG_M264_DECODER)+= m264dec.o
>>   OBJS-$(CONFIG_DOLBY_E_DECODER) += dolby_e.o kbdwin.o
>>   OBJS-$(CONFIG_DPX_DECODER) += dpx.o
> Do you realize that the rest of this list is in alphabetical order?
>
>>   OBJS-$(CONFIG_VP9_SUPERFRAME_SPLIT_BSF)   += vp9_superframe_split_bsf.o
>>   
>> +
>> +
>> +
>>   # thread libraries
> Why do you add useless empty lines, and commit them?
>
>>   extern AVCodec ff_dnxhd_encoder;
>>   extern AVCodec ff_dnxhd_decoder;
>> +extern AVCodec ff_m264_encoder;
>> +extern AVCodec ff_m264_decoder;
>>   extern AVCodec ff_dpx_encoder;
>>   extern AVCodec ff_dpx_decoder;
> Alphabetical order, again.
>
>>   if (c)
>> -*opaque = (void*)(i + 1);
>

Re: [FFmpeg-devel] patch for a new H.264 codec

2019-02-26 Thread Yufei He
Hi Tomas

Thanks for the review.

My codec is a hardware codec, it depends an dynamic library that goes 
with the M264 card.

The way it works will be:

1>Our customers buy the card and install the drivers of it.

2>They Compile ffmpeg.

3>Call ffmpeg with codec option of m264.

That's why I use dlopen to load the dynamic library that talks with the 
hardware.

Please help us check if it works in ffmpeg.

Thanks.

Yufei.



On 02/25/2019 03:45 PM, Tomas Härdin wrote:
> Hi
>
>> +void convert_to_annexb(unsigned char * dest, unsigned long
>> data_size)
>> +{
>> +   unsigned char *current = dest;
>> +   union
>> +   {
>> +  unsigned char by4[4];
>> +  uint32_t length;
>> +   } union_u32_byte;
>> +
>> +   while ((dest + data_size) > (current + 4))
>> +   {
>> +  if((current[0] == 0) &&
>> + (current[1] == 0) &&
>> + (current[2] == 0) &&
>> + (current[3] == 1))
>> +  {
>> + // in case it is already in annex B
>> + break;
>> +  }
>> +
>> +  union_u32_byte.by4[3] = current[0];
>> +  union_u32_byte.by4[2] = current[1];
>> +  union_u32_byte.by4[1] = current[2];
>> +  union_u32_byte.by4[0] = current[3];
> This won't work on certain machines. Type punning is also undefined if
> memory serves me right, and may not work right in all compilers.
> Definitely not recommended. There are macros in FFmpeg for this already
> (AV_RL32 and friends)
>
>> +#ifdef _WIN32
>> +   lib_handle = dlopen("mvM264Ffmpeg.dll", RTLD_LAZY);
>> +#else
>> +   lib_handle = dlopen("libmvM264Ffmpeg.so", RTLD_LAZY);
>> +#endif
> I believe FFmpeg has policy specifically against stuff like this. Link
> the dynamic library properly, and put appropriate license stuff in
> configure. The resulting ffmpeg binaries will more than likely not be
> redistributable, libav* might also be depending on what the Matrox
> library's license is.
>
>> +   printf("m264_encode_init_h264: avctx->width = %d\n", avctx->width);
>> +   printf("m264_encode_init_h264: avctx->height = %d\n", avctx->height);
>> +   printf("m264_encode_init_h264: avctx->framerate.num = %d\n", 
>> avctx->framerate.num);
>> +   printf("m264_encode_init_h264: avctx->framerate.den = %d\n", 
>> avctx->framerate.den);
>> +   printf("m264_encode_init_h264: avctx->gop_size = %d\n", avctx->gop_size);
>> +   printf("m264_encode_init_h264: avctx->bit_rate = %" PRId64 "\n", 
>> avctx->bit_rate);
> Forgotten debug stuff? printf() is definitely not OK
>
> There are other issues with this patch, but there's no point in looking
> more for now
>
> /Tomas
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] patch for a new H.264 codec

2019-02-25 Thread Yufei He
Hi

Please review this one.

Thanks.

Yufei.


On 02/25/2019 02:58 PM, Nicolas George wrote:

Yufei He (12019-02-25):


From 7dd17409a22858f3c18d832c301fb904508dea3b Mon Sep 17 00:00:00 2001
From: yhe <mailto:y...@matrox.com>
Date: Mon, 25 Feb 2019 14:38:21 -0500
Subject: [PATCH] M264 codec support



Quick comments.

They are in no way to be taken as any kind of endorsement for the patch.




---
 .vscode/settings.json|  27 +++



No, thanks.



 Changelog|   1 +
 configure|   1 +
 doc/general.texi |   1 +
 fftools/ffmpeg.c |  14 ++
 libavcodec/.vscode/settings.json |   5 +
 libavcodec/Makefile  |   5 +
 libavcodec/allcodecs.c   |   6 +-
 libavcodec/avcodec.h |   3 +
 libavcodec/codec_desc.c  |   9 +
 libavcodec/m264dec.c | 476 +++
 libavcodec/m264dec.h |  42 
 libavcodec/m264enc.c | 289 
 libavcodec/m264enc.h |  39 
 libavcodec/profiles.c|   5 +
 libavcodec/profiles.h|   1 +
 16 files changed, 922 insertions(+), 2 deletions(-)
 create mode 100644 .vscode/settings.json
 create mode 100644 libavcodec/.vscode/settings.json
 create mode 100644 libavcodec/m264dec.c
 create mode 100644 libavcodec/m264dec.h
 create mode 100644 libavcodec/m264enc.c
 create mode 100644 libavcodec/m264enc.h

diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 000..4cdd683
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,27 @@
+{
+   "files.associations": {
+  "avcodec.h": "c",
+  "nvdec.h": "c",
+  "config.h": "c",
+  "avassert.h": "c",
+  "iostream": "cpp",
+  "profiles.h": "c",
+  "swscale.h": "c",
+  "array": "c",
+  "functional": "c",
+  "hash_map": "c",
+  "initializer_list": "c",
+  "utility": "c",
+  "*.tcc": "cpp",
+  "deque": "cpp",
+  "list": "cpp",
+  "vector": "cpp",
+  "system_error": "cpp",
+  "bitset": "cpp",
+  "valarray": "cpp",
+  "adpcm_data.h": "c",
+  "blockdsp.h": "c",
+  "channel_layout.h": "c",
+  "h264chroma.h": "c"
+   }
+}
\ No newline at end of file
diff --git a/Changelog b/Changelog
index c90f119..f70368b 100644
--- a/Changelog
+++ b/Changelog
@@ -11,6 +11,7 @@ version :
 - dhav demuxer
 - PCM-DVD encoder
 - GIF parser
+- M264 encoder


 version 4.1:
diff --git a/configure b/configure
index b062b63..161beee 100755
--- a/configure
+++ b/configure
@@ -2618,6 +2618,7 @@ dds_decoder_select="texturedsp"
 dirac_decoder_select="dirac_parse dwt golomb videodsp mpegvideoenc"
 dnxhd_decoder_select="blockdsp idctdsp"
 dnxhd_encoder_select="blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"





+#m264_encoder_select="blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"



Leftover debug.



 dolby_e_decoder_select="mdct"
 dvvideo_decoder_select="dvprofile idctdsp"
 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
diff --git a/doc/general.texi b/doc/general.texi
index 2bc33d1..e012bad 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -828,6 +828,7 @@ following image formats are supported:
 @item Deluxe Paint Animation @tab @tab  X
 @item DNxHD  @tab   X @tab  X
 @tab aka SMPTE VC3





+@item M264   @tab   X @tab



Does not belong there.



 @item Duck TrueMotion 1.0   @tab @tab  X
 @tab fourcc: DUCK
 @item Duck TrueMotion 2.0@tab @tab  X
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 6abcc57..b8fa266 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2418,6 +2418,20 @@ static int decode_video(InputStream *ist, AVPacket *pkt, 
int *got_output, int64_
 if (!*got_output || ret < 0)
 return ret;






+   if(*got_output)
+   {
+  if(decoded_frame->width == 0)
+  {
+ av_log(NULL, AV_LOG_DEBUG, "Frame parameters mismatch context 
%d,%d,%d != %d,%d,%d\n",
+   decoded_frame->width,
+   decoded_frame->height,
+   decoded_frame->format,
+   ist->dec_ctx->width,
+   ist->dec_ctx->height,
+   ist->dec_ctx->pix_fmt);
+  }
+   }
+



Unrelated. And coding style inconsistent.



 if(ist->top_field_first>=0)
 decoded_frame->top_f

[FFmpeg-devel] patch for a new H.264 codec

2019-02-25 Thread Yufei He
Hi

Here is the patch.

Please check.

Thanks.

Yufei.


From 7dd17409a22858f3c18d832c301fb904508dea3b Mon Sep 17 00:00:00 2001
From: yhe 
Date: Mon, 25 Feb 2019 14:38:21 -0500
Subject: [PATCH] M264 codec support

---
 .vscode/settings.json|  27 +++
 Changelog|   1 +
 configure|   1 +
 doc/general.texi |   1 +
 fftools/ffmpeg.c |  14 ++
 libavcodec/.vscode/settings.json |   5 +
 libavcodec/Makefile  |   5 +
 libavcodec/allcodecs.c   |   6 +-
 libavcodec/avcodec.h |   3 +
 libavcodec/codec_desc.c  |   9 +
 libavcodec/m264dec.c | 476 +++
 libavcodec/m264dec.h |  42 
 libavcodec/m264enc.c | 289 
 libavcodec/m264enc.h |  39 
 libavcodec/profiles.c|   5 +
 libavcodec/profiles.h|   1 +
 16 files changed, 922 insertions(+), 2 deletions(-)
 create mode 100644 .vscode/settings.json
 create mode 100644 libavcodec/.vscode/settings.json
 create mode 100644 libavcodec/m264dec.c
 create mode 100644 libavcodec/m264dec.h
 create mode 100644 libavcodec/m264enc.c
 create mode 100644 libavcodec/m264enc.h

diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 000..4cdd683
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,27 @@
+{
+   "files.associations": {
+  "avcodec.h": "c",
+  "nvdec.h": "c",
+  "config.h": "c",
+  "avassert.h": "c",
+  "iostream": "cpp",
+  "profiles.h": "c",
+  "swscale.h": "c",
+  "array": "c",
+  "functional": "c",
+  "hash_map": "c",
+  "initializer_list": "c",
+  "utility": "c",
+  "*.tcc": "cpp",
+  "deque": "cpp",
+  "list": "cpp",
+  "vector": "cpp",
+  "system_error": "cpp",
+  "bitset": "cpp",
+  "valarray": "cpp",
+  "adpcm_data.h": "c",
+  "blockdsp.h": "c",
+  "channel_layout.h": "c",
+  "h264chroma.h": "c"
+   }
+}
\ No newline at end of file
diff --git a/Changelog b/Changelog
index c90f119..f70368b 100644
--- a/Changelog
+++ b/Changelog
@@ -11,6 +11,7 @@ version :
 - dhav demuxer
 - PCM-DVD encoder
 - GIF parser
+- M264 encoder
 
 
 version 4.1:
diff --git a/configure b/configure
index b062b63..161beee 100755
--- a/configure
+++ b/configure
@@ -2618,6 +2618,7 @@ dds_decoder_select="texturedsp"
 dirac_decoder_select="dirac_parse dwt golomb videodsp mpegvideoenc"
 dnxhd_decoder_select="blockdsp idctdsp"
 dnxhd_encoder_select="blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
+#m264_encoder_select="blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
 dolby_e_decoder_select="mdct"
 dvvideo_decoder_select="dvprofile idctdsp"
 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
diff --git a/doc/general.texi b/doc/general.texi
index 2bc33d1..e012bad 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -828,6 +828,7 @@ following image formats are supported:
 @item Deluxe Paint Animation @tab @tab  X
 @item DNxHD  @tab   X @tab  X
 @tab aka SMPTE VC3
+@item M264   @tab   X @tab  
 @item Duck TrueMotion 1.0   @tab @tab  X
 @tab fourcc: DUCK
 @item Duck TrueMotion 2.0@tab @tab  X
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 6abcc57..b8fa266 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2418,6 +2418,20 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_
 if (!*got_output || ret < 0)
 return ret;
 
+   if(*got_output)
+   {
+  if(decoded_frame->width == 0)
+  {
+ av_log(NULL, AV_LOG_DEBUG, "Frame parameters mismatch context %d,%d,%d != %d,%d,%d\n",
+   decoded_frame->width,
+   decoded_frame->height,
+   decoded_frame->format,
+   ist->dec_ctx->width,
+   ist->dec_ctx->height,
+   ist->dec_ctx->pix_fmt);
+  }
+   }
+
 if(ist->top_field_first>=0)
 decoded_frame->top_field_first = ist->top_field_first;
 
diff --git a/libavcodec/.vscode/settings.json b/libavcodec/.vscode/settings.json
new file mode 100644
index 000..dc1852f
--- /dev/null
+++ b/libavcodec/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+   "files.associations": {
+  "amfenc.h": "c"
+   }
+}
\ No newline at end of file
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index d53b8ff..32d147f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -266,6 +266,8 @@ OBJS-$(CONFIG_DIRAC_DECODER)   += diracdec.o dirac.o diracdsp.o diractab
 OBJS-$(CONFIG_DFA_DECODER) += dfa.o
 OBJS-$(CONFIG_DNXHD_DECODER)   += dnxhddec.o dnxhddata.o
 OBJS-$(CONFIG_DNXHD_ENCODER)   += dnxhdenc.o dnxhddata.o
+OBJS-$(CONFIG_M264_ENCODER)+= m264enc.o
+OBJS-$(CONFIG_M264_DECODER)+= m264dec.o
 OBJS-$(CONFIG_DOLBY_E_DECODER) += dolby_e.o kbdwin.o
 

[FFmpeg-devel] patch for a new H.264 codec

2019-02-25 Thread Yufei He
Hi

I just finished a new codec for h.264, how to send patches to review ?

This  is my first piece of code  for ffmpeg.


When you submit your patch, please use git format-patch or git send-email.
/

I did "git format-patch", but where is the patch?

My git said " git: 'send-email' is not a git command. See 'git --help'."

Please help.

Thanks.

Yufei.



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