Re: [FFmpeg-devel] [PATCH 4/4] avcodec/truemotion2: Fix integer overflow in last loop in tm2_update_block()

2019-06-25 Thread Michael Niedermayer
On Thu, Jun 13, 2019 at 08:32:36PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -1727985666 - 538976288 cannot be represented 
> in type 'int'
> Fixes: 
> 15031/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5100228035739648
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/truemotion2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


signature.asc
Description: PGP signature
___
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 1/4] avcodec/aacpsdsp_template: Fix integer overflow in ps_hybrid_analysis_c()

2019-06-25 Thread Michael Niedermayer
On Thu, Jun 13, 2019 at 08:32:33PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -1539565182 + -798086761 cannot be 
> represented in type 'int'
> Fixes: 
> 14807/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-564925382682214
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/aacpsdsp_template.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

will apply

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

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.


signature.asc
Description: PGP signature
___
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 v3 4/5] vaapi_encode: Add ROI support

2019-06-25 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Mark Thompson
> Sent: Tuesday, June 04, 2019 7:19 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH v3 4/5] vaapi_encode: Add ROI support
> 
> +// For overlapping regions, the first in the array takes priority.
> +for (i = 0; i < nb_roi; i++) {
> +roi = (const AVRegionOfInterest*)(sd->data + roi_size * i);
> +
> +av_assert0(roi->qoffset.den != 0);
> +v = roi->qoffset.num * ctx->roi_quant_range / roi->qoffset.den;
> +av_log(avctx, AV_LOG_DEBUG, "ROI: (%d,%d)-(%d,%d)
> -> %+d.\n",
> +   roi->top, roi->left, roi->bottom, roi->right, v);
> +
> +pic->roi[i] = (VAEncROI) {
> +.roi_rectangle = {
> +.x  = roi->top,
> +.y  = roi->left,

it is typo, the correct is:
.x  = roi->left,
.y  = roi->top,

> +.width  = roi->right  - roi->left,
> +.height = roi->bottom - roi->top,
> +},
> +.roi_value = av_clip_c(v, INT8_MIN, INT8_MAX),
> +};
> +}
> +
___
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 2/4] avcodec/hevc_ps: Fix integer overflow with num_tile_rows

2019-06-25 Thread Michael Niedermayer
On Wed, Jun 19, 2019 at 03:59:47PM -0300, James Almer wrote:
> On 6/19/2019 3:13 PM, Michael Niedermayer wrote:
> > On Wed, Jun 19, 2019 at 12:54:25PM -0300, James Almer wrote:
> >> On 6/19/2019 6:22 AM, Michael Niedermayer wrote:
> >>> On Mon, Jun 17, 2019 at 07:55:45PM -0300, James Almer wrote:
>  On 6/17/2019 6:54 PM, Michael Niedermayer wrote:
> > On Sun, Jun 16, 2019 at 11:10:43PM -0300, James Almer wrote:
> >> On 6/13/2019 3:32 PM, Michael Niedermayer wrote:
> >>> Fixes: signed integer overflow: -2147483648 - 1 cannot be represented 
> >>> in type 'int'
> >>> Fixes: 
> >>> 14880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5130977304641536
> >>>
> >>> Found-by: continuous fuzzing process 
> >>> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> >>> Signed-off-by: Michael Niedermayer 
> >>> ---
> >>>  libavcodec/hevc_ps.c | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
> >>> index 80df417e4f..0ed6682bb4 100644
> >>> --- a/libavcodec/hevc_ps.c
> >>> +++ b/libavcodec/hevc_ps.c
> >>> @@ -1596,7 +1596,7 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, 
> >>> AVCodecContext *avctx,
> >>>  if (pps->num_tile_rows <= 0 ||
> >>>  pps->num_tile_rows >= sps->height) {
> >>>  av_log(avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of 
> >>> range: %d\n",
> >>> -   pps->num_tile_rows - 1);
> >>> +   pps->num_tile_rows - 1U);
> >>
> >> The proper fix for this is making pps->num_tile_rows/cols unsigned. 
> >>> [...]
> >
> > is this here ok if num_tile_rows is 0 ?
> > for (i = 0; i < pps->num_tile_rows - 1; i++) { (example line from 
> > ffmpeg git)
> >
> > i would guess nearly everyone wold say yes without having seen the
> > discussion about the type. but of course if this is unsigned its not
> > going to be safe with it being 0. 
> 
>  pps->num_tile_rows is set to a value returned by "get_ue_golomb_long() +
>  1", which will always be in the 1..UINT32_MAX range. It can't be 0, as
>  it would be a bug. Int is definitely not the right type for it.
> >>>
> >>> i dont think num_tile_rows of more than 2^31 (that is the negative when 
> >>> signed range)
> >>> makes much sense but sure i can change it to unsigned if preferred.
> >>
> >> Of course it doesn't. In pretty much any sample it will be at least 1
> >> and at most 22, which is the max value allowed by hevc level 6.2 in
> >> table A.6. Only if the stream reports an undefined level it could go up
> >> to, if i'm reading this right, sps->ctb_height and not sps->height as
> >> the decoder is currently checking. This means you can even replace
> >> get_ue_golomb_long() for a get_ue_golomb(). That would also fix this.
> >>
> >> In any case, the bitstream value is unsigned, so the struct field should
> >> be unsigned as well. Having it be signed and assigning it a value using
> >> a function that potentially returns huge unsigned values introduced this
> >> issue to being with, so instead of working around it using type
> >> promotion, just make it follow the spec.
> > 
> > what would be your feeling/oppinon about making the field uint16_t ?
> > this would make it unsigned in the struct but avoid the problems with
> > unsigned int ?
> 
> That's fine. Could even make it uint8_t, like cbs_h265.h does. I'd also
> change it to use get_ue_golomb() while at it. And please do it for both
> rows and columns. Can be in separate patches if you want the rows one to
> explicitly address the fuzzing testcase.

will do but this requires intermediate int, ill post a new patch
get_ue_golomb() can return negative error codes. storing this in an 8bit
variable would truncate the error code and could fold it into a valid
value.


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


signature.asc
Description: PGP signature
___
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] Add DICOM Support

2019-06-25 Thread Shivam


On 6/25/19 2:12 AM, Michael Niedermayer wrote:

On Mon, Jun 24, 2019 at 09:18:13PM +0530, Shivam wrote:

Hi!

     The code is to add DICOM Support. The patch is only for uncompressed
dicom files using explicit value representation. I would extend it, once i
clarify some doubts. As dicom image files contain lots of metadata about
the patient. So, should i display that data while demuxing or should i
ignore and only demux the image data ?. In the current patch, i have made an
option "-metadata", which when used will print the data on the terminal
while demuxing.

metadata should be exported to be usable by applications.

For teh API design a one test is that it should be possible to have a
dicom file as input and a format with similar features as output and not
loose any significant data.
Printing to the terminal cannot achieve that easily.


So, should i export it to a csv file ?


Either way i would suggest to support only a subset of these 4000 elements
for now but try to ensure that the deisgn can handle most of the important
elements


Okay , for now i would add only important tags (including all the image 
and pixel data group tags and some about the patient info) to the 
dictionary. and the demuxer would skip unknown tags.






Also, in the dicomdict.c ( which is only required for implicit dicom files,
and for metadata), till now i have only specified ~200 data elements. but
the dicom specification, specifies a total of ~4000 data elements (would do
binary search if all the tags are needed ). So, is there a better way to
specifiy that data?. (I mean if we ignore the metadata about the patient,
then we only need to specify ~150 data elements for image data).


I have uploaded some samples of dicom files with explicit value
representation here (in case needed).

https://drive.google.com/drive/folders/1V8HUNeX3EYiPLj_dcFt8C68tAh7C7v4X?usp=sharing


Please comment,


Thank you,

Shivam Goyal

___
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 2/4] avcodec/hevc_ps: Fix integer overflow with num_tile_rows

2019-06-25 Thread Michael Niedermayer
On Thu, Jun 20, 2019 at 01:04:45AM -0300, James Almer wrote:
> On 6/19/2019 3:59 PM, James Almer wrote:
> > On 6/19/2019 3:13 PM, Michael Niedermayer wrote:
> >> On Wed, Jun 19, 2019 at 12:54:25PM -0300, James Almer wrote:
> >>> On 6/19/2019 6:22 AM, Michael Niedermayer wrote:
>  On Mon, Jun 17, 2019 at 07:55:45PM -0300, James Almer wrote:
> > On 6/17/2019 6:54 PM, Michael Niedermayer wrote:
> >> On Sun, Jun 16, 2019 at 11:10:43PM -0300, James Almer wrote:
> >>> On 6/13/2019 3:32 PM, Michael Niedermayer wrote:
>  Fixes: signed integer overflow: -2147483648 - 1 cannot be 
>  represented in type 'int'
>  Fixes: 
>  14880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5130977304641536
> 
>  Found-by: continuous fuzzing process 
>  https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>  Signed-off-by: Michael Niedermayer 
>  ---
>   libavcodec/hevc_ps.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
>  diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
>  index 80df417e4f..0ed6682bb4 100644
>  --- a/libavcodec/hevc_ps.c
>  +++ b/libavcodec/hevc_ps.c
>  @@ -1596,7 +1596,7 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, 
>  AVCodecContext *avctx,
>   if (pps->num_tile_rows <= 0 ||
>   pps->num_tile_rows >= sps->height) {
>   av_log(avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out 
>  of range: %d\n",
>  -   pps->num_tile_rows - 1);
>  +   pps->num_tile_rows - 1U);
> >>>
> >>> The proper fix for this is making pps->num_tile_rows/cols unsigned. 
>  [...]
> >>
> >> is this here ok if num_tile_rows is 0 ?
> >> for (i = 0; i < pps->num_tile_rows - 1; i++) { (example line from 
> >> ffmpeg git)
> >>
> >> i would guess nearly everyone wold say yes without having seen the
> >> discussion about the type. but of course if this is unsigned its not
> >> going to be safe with it being 0. 
> >
> > pps->num_tile_rows is set to a value returned by "get_ue_golomb_long() +
> > 1", which will always be in the 1..UINT32_MAX range. It can't be 0, as
> > it would be a bug. Int is definitely not the right type for it.
> 
>  i dont think num_tile_rows of more than 2^31 (that is the negative when 
>  signed range)
>  makes much sense but sure i can change it to unsigned if preferred.
> >>>
> >>> Of course it doesn't. In pretty much any sample it will be at least 1
> >>> and at most 22, which is the max value allowed by hevc level 6.2 in
> >>> table A.6. Only if the stream reports an undefined level it could go up
> >>> to, if i'm reading this right, sps->ctb_height and not sps->height as
> >>> the decoder is currently checking. This means you can even replace
> >>> get_ue_golomb_long() for a get_ue_golomb(). That would also fix this.
> >>>
> >>> In any case, the bitstream value is unsigned, so the struct field should
> >>> be unsigned as well. Having it be signed and assigning it a value using
> >>> a function that potentially returns huge unsigned values introduced this
> >>> issue to being with, so instead of working around it using type
> >>> promotion, just make it follow the spec.
> >>
> >> what would be your feeling/oppinon about making the field uint16_t ?
> >> this would make it unsigned in the struct but avoid the problems with
> >> unsigned int ?
> > 
> > That's fine. Could even make it uint8_t, like cbs_h265.h does. I'd also
> > change it to use get_ue_golomb() while at it. And please do it for both
> > rows and columns. Can be in separate patches if you want the rows one to
> > explicitly address the fuzzing testcase.
> > 

> > Can you also confirm my suspicion that the checks should be comparing
> > the values with sps->ctb_height/weight and not with sps->height/weight?
> 
> Ok, so yes, it is. Should be changed in a separate patch as well.

will post it together with the other updated patch

thanks

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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


signature.asc
Description: PGP signature
___
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 3/4] avcodec/fitsdec: Fix division be 0 in size check

2019-06-25 Thread Michael Niedermayer
On Fri, Jun 14, 2019 at 09:46:17AM +0200, Moritz Barsnick wrote:
> On Thu, Jun 13, 2019 at 20:32:35 +0200, Michael Niedermayer wrote:
> 
> > avcodec/fitsdec: Fix division be 0 in size check
> Nit:^ by

will push without the typo

thanks

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

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


signature.asc
Description: PGP signature
___
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 v3 3/5] libx265: Update ROI behaviour to match documentation

2019-06-25 Thread Guo, Yejun

> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Guo, Yejun
> Sent: Tuesday, June 04, 2019 2:46 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v3 3/5] libx265: Update ROI behaviour to
> match documentation
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> > Mark Thompson
> > Sent: Tuesday, June 04, 2019 7:19 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: [FFmpeg-devel] [PATCH v3 3/5] libx265: Update ROI behaviour to
> match
> > documentation
> >
> > Equivalent to the previous patch for libx264.
> > ---
> >  libavcodec/libx265.c | 44 +++-
> 
> looks good to me, thanks.

is it possible to first push 1-3 patches of this patch set? These are the 
necessary refine for my original ROI patch. 
I hope the next ffmpeg release version will contain a complete code base for 
ROI (libx264 and libx265), thanks.

___
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] avformat/vividas: check length in read_vblock()

2019-06-25 Thread Michael Niedermayer
On Wed, Jun 12, 2019 at 03:23:59PM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 
> 15166/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5731062396747776
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/vividas.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


signature.asc
Description: PGP signature
___
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 1/4] avcodec/xpmdec: Do not use context dimensions as temporary variables

2019-06-25 Thread Michael Niedermayer
On Thu, Jun 13, 2019 at 01:20:17AM +0200, Michael Niedermayer wrote:
> Fixes: Integer overflow
> Fixes: 
> 15134/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XPM_fuzzer-5722635939348480
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/xpmdec.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

will apply

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


signature.asc
Description: PGP signature
___
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 1/2] avcodec/hevc_ps: Fix integer overflow with num_tile_rows and num_tile_columns

2019-06-25 Thread Michael Niedermayer
Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 
'int'
Fixes: 
14880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5130977304641536

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/hevc_ps.c | 23 +--
 libavcodec/hevc_ps.h |  4 ++--
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 80df417e4f..07d220a5c8 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -1584,22 +1584,25 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, 
AVCodecContext *avctx,
 pps->entropy_coding_sync_enabled_flag = get_bits1(gb);
 
 if (pps->tiles_enabled_flag) {
-pps->num_tile_columns = get_ue_golomb_long(gb) + 1;
-pps->num_tile_rows= get_ue_golomb_long(gb) + 1;
-if (pps->num_tile_columns <= 0 ||
-pps->num_tile_columns >= sps->width) {
+int num_tile_columns_minus1 = get_ue_golomb(gb);
+int num_tile_rows_minus1= get_ue_golomb(gb);
+
+if (num_tile_columns_minus1 < 0 ||
+num_tile_columns_minus1 >= sps->width - 1) {
 av_log(avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: 
%d\n",
-   pps->num_tile_columns - 1);
-ret = AVERROR_INVALIDDATA;
+   num_tile_columns_minus1);
+ret = num_tile_columns_minus1 < 0 ? num_tile_columns_minus1 : 
AVERROR_INVALIDDATA;
 goto err;
 }
-if (pps->num_tile_rows <= 0 ||
-pps->num_tile_rows >= sps->height) {
+if (num_tile_rows_minus1 < 0 ||
+num_tile_rows_minus1 >= sps->height - 1) {
 av_log(avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: 
%d\n",
-   pps->num_tile_rows - 1);
-ret = AVERROR_INVALIDDATA;
+   num_tile_rows_minus1);
+ret = num_tile_rows_minus1 < 0 ? num_tile_rows_minus1 : 
AVERROR_INVALIDDATA;
 goto err;
 }
+pps->num_tile_columns = num_tile_columns_minus1 + 1;
+pps->num_tile_rows= num_tile_rows_minus1+ 1;
 
 pps->column_width = av_malloc_array(pps->num_tile_columns, 
sizeof(*pps->column_width));
 pps->row_height   = av_malloc_array(pps->num_tile_rows,
sizeof(*pps->row_height));
diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h
index bbaa9205ef..44695f09f3 100644
--- a/libavcodec/hevc_ps.h
+++ b/libavcodec/hevc_ps.h
@@ -347,8 +347,8 @@ typedef struct HEVCPPS {
 uint8_t tiles_enabled_flag;
 uint8_t entropy_coding_sync_enabled_flag;
 
-int num_tile_columns;   ///< num_tile_columns_minus1 + 1
-int num_tile_rows;  ///< num_tile_rows_minus1 + 1
+uint8_t num_tile_columns;   ///< num_tile_columns_minus1 + 1
+uint8_t num_tile_rows;  ///< num_tile_rows_minus1 + 1
 uint8_t uniform_spacing_flag;
 uint8_t loop_filter_across_tiles_enabled_flag;
 
-- 
2.22.0

___
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 2/4] avformat/img2dec: Fix probe_buffer leak in ff_img_read_header()

2019-06-25 Thread Michael Niedermayer
On Thu, Jun 13, 2019 at 01:20:18AM +0200, Michael Niedermayer wrote:
> Fixes: memleak
> Fixes: 
> 15171/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5683881644130304
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/img2dec.c | 1 +
>  1 file changed, 1 insertion(+)

will apply

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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


signature.asc
Description: PGP signature
___
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 2/2] avcodec/hevc_ps: Change num_tile_rows/columns checks to sps->ctb_height/weight

2019-06-25 Thread Michael Niedermayer
Suggested-by: James Almer 

Signed-off-by: Michael Niedermayer 
---
 libavcodec/hevc_ps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 07d220a5c8..f6e80e1609 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -1588,14 +1588,14 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, 
AVCodecContext *avctx,
 int num_tile_rows_minus1= get_ue_golomb(gb);
 
 if (num_tile_columns_minus1 < 0 ||
-num_tile_columns_minus1 >= sps->width - 1) {
+num_tile_columns_minus1 >= sps->ctb_width - 1) {
 av_log(avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: 
%d\n",
num_tile_columns_minus1);
 ret = num_tile_columns_minus1 < 0 ? num_tile_columns_minus1 : 
AVERROR_INVALIDDATA;
 goto err;
 }
 if (num_tile_rows_minus1 < 0 ||
-num_tile_rows_minus1 >= sps->height - 1) {
+num_tile_rows_minus1 >= sps->ctb_height - 1) {
 av_log(avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: 
%d\n",
num_tile_rows_minus1);
 ret = num_tile_rows_minus1 < 0 ? num_tile_rows_minus1 : 
AVERROR_INVALIDDATA;
-- 
2.22.0

___
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] dash: change default MP4 extension to .m4s

2019-06-25 Thread Jeyapal, Karthick

On 6/24/19 4:23 PM, Alfred E. Heggestad wrote:
> On 24/06/2019 11:24, Jeyapal, Karthick wrote:
>>
>> On 6/20/19 3:00 PM, Alfred E. Heggestad wrote:
>>>
>>>
>>> On 20/06/2019 05:19, Jeyapal, Karthick wrote:

 On 6/19/19 3:08 PM, Alfred E. Heggestad wrote:
> On 19/06/2019 07:21, Jeyapal, Karthick wrote:
>>
>> On 6/18/19 1:48 PM, Alfred E. Heggestad wrote:
>>> On 18/06/2019 04:02, Steven Liu wrote:
 Alfred E. Heggestad  于2019年6月17日周一 
 下午4:02写道:
>
>  From 923da82598bddd1ed05750427dbc71e607d296a2 Mon Sep 17 
> 00:00:00 2001
> From: "Alfred E. Heggestad" 
> Date: Mon, 17 Jun 2019 09:59:04 +0200
> Subject: [PATCH] dash: change default MP4 extension to .m4s
>
> this was changed in commit 281a21ed50849e3c8c0d03005230e9fd07c24370
> ---
>   libavformat/dashenc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 3fd7e78166..a51a1da0ca 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -166,7 +166,7 @@ static struct format_string {
>   const char *str;
>   } formats[] = {
>   { SEGMENT_TYPE_AUTO, "auto" },
> -{ SEGMENT_TYPE_MP4, "mp4" },
> +{ SEGMENT_TYPE_MP4, "m4s" },
>   { SEGMENT_TYPE_WEBM, "webm" },
>   { 0, NULL }
>   };
> -- 
> 2.20.1 (Apple Git-117)
>
> ___
> 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".



 LGTM

>>>
>>> the background for this is the extension for DASH media files
>>> used to be *.m4s and it is now *.mp4
>>>
>>>
>>> the patch is a suggestion and should be checked by the DASH experts
>>>
>>> what is correct according to the standard ?
>>>
>>> the media-file is not really an .mp4 file, it cannot be
>>> played with e.g. ffplay:
>>>
>>>  $ ffplay chunk-stream1-1.m4s
>> Thanks for submitting the patch. I agree that m4s should be extension 
>> for media segments.
>> mp4 should be used only for complete files.
>> With respect to the patch, dashenc generates either multiple segments or 
>> a single file(with byte range as segments) based on "single_file" option.
>> The default of mp4 is correct when "single_file" is enabled. But it is 
>> wrong when "single_file" is disabled. The proposed patch just reverses 
>> this situation.
>> I would suggest the patch should handle both cases correctly.
>
> Hi,
>
> many thanks for your review comments.
>
> I have updated the patch based on your comments, please see below.
>
>
> this code works in my application (both single and multi files)
> but the code should be reviewed by someone who has better
> knowledge with the code.
 Thanks for sending a revised patch promptly.
 I think your patch below might adversely affect the following code
   avio_printf(out, "\t\t\t>>> mimeType=\"video/%s\" codecs=\"%s\"%s width=\"%d\" height=\"%d\"",
   i, os->format_name, os->codec_str, bandwidth_str, 
 s->streams[i]->codecpar->width, s->streams[i]->codecpar->height);

 mimetype will become "video/m4s" for if the file extension is m4s. But I 
 am not sure if it is correct or if such a mimetype exists.
 I guess mimetype should remain as "video/mp4" even if the file extension 
 is m4s.
 Please let me know your views on this.

>>>
>>> I tested with ffmpeg 4.1.3 and the mimetype is video/mp4
>>>
>>>
>>> >> bandwidth="1011342" width="1280" height="720">
>>>
>>>
>>>
>>> I made a new patch which is a bit more readable. Please see here:
>>>
>>>
>>>
>>>  From c90254066e08a8dc46f275fbc2a1d65f26608bd4 Mon Sep 17 00:00:00 2001
>>> From: "Alfred E. Heggestad" 
>>> Date: Thu, 20 Jun 2019 11:27:53 +0200
>>> Subject: [PATCH] dash: split extension for MP4 into .mp4 or .m4s
>>>
>>> ---
>>>   libavformat/dashenc.c | 23 ---
>>>   1 file changed, 20 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>>> index 3fd7e78166..b25afb40aa 100644
>>> --- a/libavformat/dashenc.c
>>> +++ b/libavformat/dashenc.c
>>> @@ -89,6 +89,7 @@ typedef struct OutputStream {
>>>   int bit_rate;
>>>   SegmentType segment_type;  /* segment type selected for this 
>>> particular stream */
>>>   const char *format_name;
>>> +const char *extension_name;
>>>   const char *single_file_name;  /* file names selected f

Re: [FFmpeg-devel] [PATCH 4/4] avcodec/fitsdec: Check data_min/max

2019-06-25 Thread Michael Niedermayer
On Thu, Jun 13, 2019 at 04:29:54PM +0200, Moritz Barsnick wrote:
> On Thu, Jun 13, 2019 at 01:20:20 +0200, Michael Niedermayer wrote:
> > +if (header->data_min == header->data_max) {
> 
> Just a note:
> Equality comparison of floats/doubles may trigger a warning. (Possibly
> needs to be explicitly enabled though, like with "-Wfloat-equal" on
> gcc.) Might be okay though nevertheless.

ill post a new patch that reorders this a bit, maybe it doesnt generate
a warning. But using something like DBL_EPSILON is more wrong than the ==
here i think, as it could turn a non blank image into a blank one

thx


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

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


signature.asc
Description: PGP signature
___
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] avcodec/fitsdec: Check data_min/max

2019-06-25 Thread Michael Niedermayer
Fixes: division by 0
Fixes: 
15206/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5657260212092928

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/fitsdec.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c
index 67a8bd71f4..4f452422ef 100644
--- a/libavcodec/fitsdec.c
+++ b/libavcodec/fitsdec.c
@@ -168,6 +168,14 @@ static int fits_read_header(AVCodecContext *avctx, const 
uint8_t **ptr, FITSHead
 header->data_min = (header->data_min - header->bzero) / header->bscale;
 header->data_max = (header->data_max - header->bzero) / header->bscale;
 }
+if (!header->rgb && header->data_min >= header->data_max) {
+if (header->data_min > header->data_max) {
+av_log(avctx, AV_LOG_ERROR, "data min/max (%g %g) is invalid\n", 
header->data_min, header->data_max);
+return AVERROR_INVALIDDATA;
+}
+av_log(avctx, AV_LOG_WARNING, "data min/max indicates a blank 
image\n");
+header->data_max ++;
+}
 
 return 0;
 }
-- 
2.22.0

___
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] avformat/mov: Set fragment.found_tfhd only after TFHD has been parsed

2019-06-25 Thread Michael Niedermayer
On Sat, Jun 15, 2019 at 03:51:54PM +0200, Michael Niedermayer wrote:
> Fixes: Assertion failure
> Fixes: crbug971646.mp4
> 
> Reported-by: Matt Wolenetz 
> Reviewed-by: Matt Wolenetz 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/mov.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

will apply

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

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


signature.asc
Description: PGP signature
___
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 3/5] avcodec/loco: Limit lossy parameter so it is sane and does not overflow

2019-06-25 Thread Michael Niedermayer
On Sun, Jun 16, 2019 at 12:00:54AM +0200, Michael Niedermayer wrote:
> Fixes: 
> 15248/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LOCO_fuzzer-5087440458481664
> Fixes: signed integer overflow: 3 + 2147483647 cannot be represented in type 
> 'int'
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/loco.c | 5 +
>  1 file changed, 5 insertions(+)

will apply

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


signature.asc
Description: PGP signature
___
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 1/5] avcodec/motionpixels: Check for vlc error in mp_get_vlc()

2019-06-25 Thread Michael Niedermayer
On Sun, Jun 16, 2019 at 12:00:52AM +0200, Michael Niedermayer wrote:
> Fixes: 
> 15246/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOTIONPIXELS_fuzzer-5168534407086080
> Fixes: runtime error: index -1 out of bounds for type 'HuffCode [16]'
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/motionpixels.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


signature.asc
Description: PGP signature
___
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 v14 2/2] doc: Add libsvt_hevc encoder docs

2019-06-25 Thread Jing Sun
Add docs for libsvt_hevc encoder in encoders.texi and general.texi

Signed-off-by: Jun Zhao 
Signed-off-by: Zhengxu Huang 
Signed-off-by: Hassene Tmar 
Signed-off-by: Jing Sun 
---
 doc/encoders.texi | 149 ++
 doc/general.texi  |   8 +++
 2 files changed, 157 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index eefd124..81debda 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1640,6 +1640,155 @@ Set maximum NAL size in bytes.
 Allow skipping frames to hit the target bitrate if set to 1.
 @end table
 
+@section libsvt_hevc
+
+Scalable Video Technology for HEVC (SVT-HEVC) encoder wrapper.
+
+This encoder requires the presence of the headers and
+library during configuration. You need to explicitly configure the
+build with @code{--enable-libsvthevc}. The library is detected using
+@command{pkg-config}.
+
+For more information about the library see
+@url{https://github.com/intel/SVT-HEVC.git}.
+
+@subsection Options
+
+The following FFmpeg global options affect the configurations of the
+libsvt_hevc encoder:
+
+@table @option
+@item b  (@emph{bitrate})
+Set the bitrate (as a number of bits per second). Default is 7M.
+
+@item g  / @option{gop_size}
+Set the GOP size. Default is -2 (unspecified).
+
+@item flags +cgop
+Enable closed GOP.
+
+@item qmin (@emph{min-q})
+Default is 10
+
+@item qmax (@emph{max-q})
+Default is 48
+
+Set minimum/maximum quantisation values.  Valid range is from 0 to 51
+(Only used when bit rate control mode @option{rc} is set to 1(vbr) mode.
+It is required that qmax >= qmin).
+
+@item profile (@emph{profile})
+Set profile restrictions. Can assume one of the following possible values:
+
+@table @samp
+@item main
+main profile
+@item main10
+main10 profile
+@item rext
+rext profile
+@end table
+
+Default is 1 (main).
+
+@item level (@emph{level})
+
+@option{level} sets the value of @emph{level}.
+Set level (level_idc). Default is 0 (to be determined by the encoder).
+
+@end table
+
+The encoder also has its own specific options:
+
+@table @option
+@item aud (@emph{aud})
+Enable use of access unit delimiters when set to 1. Default is 0 (Off).
+
+@item hielevel
+Set hierarchical levels. Can assume one of the following possible values:
+
+@table @samp
+@item flat
+flat more
+@item 1 level
+Minigop size is 2^1
+@item 2 level
+Minigop size is 2^2
+@item 3 level
+Minigop size is 2^3
+@end table
+
+Default is 3 level.
+
+@item la_depth
+Set look-ahead depth, depending on @option{rc}: for @var{vbr}, it's recommended
+to unset it and use the default value (the intra period); for @var{cqp}, better
+specify the look-ahead depth.
+
+The range is @var{-1-256}. Default is -1 (unset and the default value to be 
used).
+
+@item preset
+Set the quality vs density tradeoff point at which the encoding is to be 
performed.
+Higher perset value, higher density and lower quality.
+
+The range is @var{0-12}. Default is 9.
+
+@item tier
+Set @emph{general_tier_flag}.  This may affect the level chosen for the stream
+if it is not explicitly specified. Can assume one of the following possible 
values:
+
+@table @samp
+@item main
+main tier
+@item high
+high tier
+@end table
+
+Default is 1 (main).
+
+@item rc
+Set bit rate control mode. Can assume one of the following possible values:
+
+@table @samp
+@item cqp
+Constant QP (CQP) mode
+@item vbr
+Variable Bit Rate (VBR) mode
+@end table
+
+Default is 0 (cqp).
+
+@item forced_idr
+Force keyframes to be IDR if set to 1. Default is 0 (CRA).
+
+@item asm_type
+Auto select highest supported asm if set to 1 or C only if 0. Default is 1.
+
+@item qp
+Initial quantization parameter for the intra pictures used when
+@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32.
+
+@item sc_detection
+Enables or disables the scene change detection algorithm. Default is 0 
(disabled).
+
+@item tune
+Set quality tuning mode. Can assume one of the following possible values:
+
+@table @samp
+@item sq
+Visually optimized mode
+@item oq
+PSNR / SSIM optimized mode
+@item vmaf
+VMAF optimized mode
+@end table
+
+Default is 1 (oq).
+
+@item bl_mode
+Enables or disables Random Access Prediction. Default is 0 (disabled).
+@end table
+
 @section libtheora
 
 libtheora Theora encoder wrapper.
diff --git a/doc/general.texi b/doc/general.texi
index 3c0c803..fa9cd31 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -243,6 +243,14 @@ FFmpeg can use the OpenJPEG libraries for 
decoding/encoding J2K videos.  Go to
 instructions.  To enable using OpenJPEG in FFmpeg, pass 
@code{--enable-libopenjpeg} to
 @file{./configure}.
 
+@section Scalable Video Technology for HEVC
+
+FFmpeg can make use of the SVT-HEVC library for HEVC encoding.
+
+Go to @url{https://github.com/intel/SVT-HEVC.git} and follow the instructions
+for installing the library. Pass @code{--enable-libsvthevc} to configure to
+enable it.
+
 @section TwoLAME
 
 FFmpeg can make use of the TwoLAME library for MP2 encoding.
-- 
1.8.3.1

_

[FFmpeg-devel] [PATCH v14 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper

2019-06-25 Thread Jing Sun
Signed-off-by: Zhengxu Huang 
Signed-off-by: Hassene Tmar 
Signed-off-by: Jun Zhao 
Signed-off-by: Jing Sun 
---
 configure|   4 +
 libavcodec/Makefile  |   1 +
 libavcodec/allcodecs.c   |   1 +
 libavcodec/libsvt_hevc.c | 501 +++
 libavcodec/version.h |   2 +-
 5 files changed, 508 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/libsvt_hevc.c

diff --git a/configure b/configure
index 7cea9d4..8f2f065 100755
--- a/configure
+++ b/configure
@@ -264,6 +264,7 @@ External library support:
   --enable-libspeexenable Speex de/encoding via libspeex [no]
   --enable-libsrt  enable Haivision SRT protocol via libsrt [no]
   --enable-libssh  enable SFTP protocol via libssh [no]
+  --enable-libsvthevc  enable HEVC encoding via svt [no]
   --enable-libtensorflow   enable TensorFlow as a DNN module backend
for DNN based filters like sr [no]
   --enable-libtesseractenable Tesseract, needed for ocr filter [no]
@@ -1787,6 +1788,7 @@ EXTERNAL_LIBRARY_LIST="
 libspeex
 libsrt
 libssh
+libsvthevc
 libtensorflow
 libtesseract
 libtheora
@@ -3180,6 +3182,7 @@ libshine_encoder_select="audio_frame_queue"
 libspeex_decoder_deps="libspeex"
 libspeex_encoder_deps="libspeex"
 libspeex_encoder_select="audio_frame_queue"
+libsvt_hevc_encoder_deps="libsvthevc"
 libtheora_encoder_deps="libtheora"
 libtwolame_encoder_deps="libtwolame"
 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
@@ -6226,6 +6229,7 @@ enabled libsoxr   && require libsoxr soxr.h 
soxr_create -lsoxr
 enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h 
sftp_init
 enabled libspeex  && require_pkg_config libspeex speex speex/speex.h 
speex_decoder_init
 enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" 
srt/srt.h srt_socket
+enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h 
EbInitHandle
 enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h 
TF_Version -ltensorflow
 enabled libtesseract  && require_pkg_config libtesseract tesseract 
tesseract/capi.h TessBaseAPICreate
 enabled libtheora && require libtheora theora/theoraenc.h th_info_init 
-ltheoraenc -ltheoradec -logg
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index edccd73..7eb13de 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o 
libopus.o \
 OBJS-$(CONFIG_LIBSHINE_ENCODER)   += libshine.o
 OBJS-$(CONFIG_LIBSPEEX_DECODER)   += libspeexdec.o
 OBJS-$(CONFIG_LIBSPEEX_ENCODER)   += libspeexenc.o
+OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o
 OBJS-$(CONFIG_LIBTHEORA_ENCODER)  += libtheoraenc.o
 OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o
 OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index d2f9a39..d8788a7 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -707,6 +707,7 @@ extern AVCodec ff_librsvg_decoder;
 extern AVCodec ff_libshine_encoder;
 extern AVCodec ff_libspeex_encoder;
 extern AVCodec ff_libspeex_decoder;
+extern AVCodec ff_libsvt_hevc_encoder;
 extern AVCodec ff_libtheora_encoder;
 extern AVCodec ff_libtwolame_encoder;
 extern AVCodec ff_libvo_amrwbenc_encoder;
diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c
new file mode 100644
index 000..d9ac04c
--- /dev/null
+++ b/libavcodec/libsvt_hevc.c
@@ -0,0 +1,501 @@
+/*
+* Scalable Video Technology for HEVC encoder library plugin
+*
+* Copyright (c) 2019 Intel Corporation
+*
+* 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 this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "EbErrorCodes.h"
+#include "EbTime.h"
+#include "EbApi.h"
+
+#include "libavutil/common.h"
+#include "libavutil/frame.h"
+#include "libavutil/opt.h"
+
+#include "internal.h"
+#include "avcodec.h"
+
+typedef enum eos_status {
+EOS_NOT_REACHED = 0,
+EOS_SENT,
+EOS_RECEIVED
+}EOS_STATUS;
+
+typedef struct SvtContext {
+AVClass *class;
+
+EB_H265_ENC_CONFIGURATION enc_params;
+EB_COMPONENTTYPE *svt_handle;
+EB_BUFFERHEADERTYPE in_buf;
+EOS_STATUS eos_flag;
+

Re: [FFmpeg-devel] [PATCH] dash: change default MP4 extension to .m4s

2019-06-25 Thread Alfred E. Heggestad



On 25/06/2019 11:43, Jeyapal, Karthick wrote:


On 6/24/19 4:23 PM, Alfred E. Heggestad wrote:






Hi Karthick,


here is the rebased patch as an attachment.


please review and apply if it looks okay.


Thanks. I have applied it.



Thanks for applying it :)


/alfred
___
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 v14 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper

2019-06-25 Thread Carl Eugen Hoyos
Am Di., 25. Juni 2019 um 12:17 Uhr schrieb Jing Sun :

> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 2709163..3583499 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
>
>  #define LIBAVCODEC_VERSION_MAJOR  58
>  #define LIBAVCODEC_VERSION_MINOR  53
> -#define LIBAVCODEC_VERSION_MICRO 100
> +#define LIBAVCODEC_VERSION_MICRO 101

A minor bump is common for new codecs.

Carl Eugen
___
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 1/2] avcodec/hevc_ps: Fix integer overflow with num_tile_rows and num_tile_columns

2019-06-25 Thread James Almer
On 6/25/2019 5:55 AM, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 
> 'int'
> Fixes: 
> 14880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5130977304641536
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/hevc_ps.c | 23 +--
>  libavcodec/hevc_ps.h |  4 ++--
>  2 files changed, 15 insertions(+), 12 deletions(-)
> 
> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
> index 80df417e4f..07d220a5c8 100644
> --- a/libavcodec/hevc_ps.c
> +++ b/libavcodec/hevc_ps.c
> @@ -1584,22 +1584,25 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, 
> AVCodecContext *avctx,
>  pps->entropy_coding_sync_enabled_flag = get_bits1(gb);
>  
>  if (pps->tiles_enabled_flag) {
> -pps->num_tile_columns = get_ue_golomb_long(gb) + 1;
> -pps->num_tile_rows= get_ue_golomb_long(gb) + 1;
> -if (pps->num_tile_columns <= 0 ||
> -pps->num_tile_columns >= sps->width) {
> +int num_tile_columns_minus1 = get_ue_golomb(gb);
> +int num_tile_rows_minus1= get_ue_golomb(gb);
> +
> +if (num_tile_columns_minus1 < 0 ||

num_tile_columns_minus1 can never be < 0 for an int now that you're
using get_ue_golomb(gb). It returns values from 0 to 8190.
Add an av_assert0, at most. A value < 0 would mean there's a huge bug in
golomb.h, and not invalid bitstream data.

And since you got rid of the "- 1" calculation below, which was your
original concern, you could also just make this unsigned. There's really
no need for an int at all.

> +num_tile_columns_minus1 >= sps->width - 1) {

Should be sps->ctb_width

From 7.4.3.3.1:

"num_tile_columns_minus1 plus 1 specifies the number of tile columns
partitioning the picture. num_tile_columns_minus1 shall be in the range
of 0 to PicWidthInCtbsY − 1, inclusive. When not present, the value of
num_tile_columns_minus1 is inferred to be equal to 0."

>  av_log(avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of 
> range: %d\n",
> -   pps->num_tile_columns - 1);
> -ret = AVERROR_INVALIDDATA;
> +   num_tile_columns_minus1);
> +ret = num_tile_columns_minus1 < 0 ? num_tile_columns_minus1 : 
> AVERROR_INVALIDDATA;

Again, can't be < 0.

>  goto err;
>  }
> -if (pps->num_tile_rows <= 0 ||
> -pps->num_tile_rows >= sps->height) {
> +if (num_tile_rows_minus1 < 0 ||
> +num_tile_rows_minus1 >= sps->height - 1) {

Similarly, sps->ctb_height

"num_tile_rows_minus1 plus 1 specifies the number of tile rows
partitioning the picture. num_tile_rows_minus1 shall be in the range of
0 to PicHeightInCtbsY − 1, inclusive. When not present, the value of
num_tile_rows_minus1 is inferred to be equal to 0."

>  av_log(avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: 
> %d\n",
> -   pps->num_tile_rows - 1);
> -ret = AVERROR_INVALIDDATA;
> +   num_tile_rows_minus1);
> +ret = num_tile_rows_minus1 < 0 ? num_tile_rows_minus1 : 
> AVERROR_INVALIDDATA;
>  goto err;
>  }
> +pps->num_tile_columns = num_tile_columns_minus1 + 1;
> +pps->num_tile_rows= num_tile_rows_minus1+ 1;
>  
>  pps->column_width = av_malloc_array(pps->num_tile_columns, 
> sizeof(*pps->column_width));
>  pps->row_height   = av_malloc_array(pps->num_tile_rows,
> sizeof(*pps->row_height));
> diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h
> index bbaa9205ef..44695f09f3 100644
> --- a/libavcodec/hevc_ps.h
> +++ b/libavcodec/hevc_ps.h
> @@ -347,8 +347,8 @@ typedef struct HEVCPPS {
>  uint8_t tiles_enabled_flag;
>  uint8_t entropy_coding_sync_enabled_flag;
>  
> -int num_tile_columns;   ///< num_tile_columns_minus1 + 1
> -int num_tile_rows;  ///< num_tile_rows_minus1 + 1
> +uint8_t num_tile_columns;   ///< num_tile_columns_minus1 + 1
> +uint8_t num_tile_rows;  ///< num_tile_rows_minus1 + 1

I'd like Mark to chime in if possible, seeing he used uint8_t for these
in cbs, because i'm not sure just how big sps->ctb_{width,height} can be
in some extreme cases (4k or 8k video with a lot of tiles). uint16_t
like you originally suggested may be a safer bet in those cases after all.

LGTM with the above fixed.

>  uint8_t uniform_spacing_flag;
>  uint8_t loop_filter_across_tiles_enabled_flag;
>  
> 

___
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 1/2] avcodec/hevc_ps: Fix integer overflow with num_tile_rows and num_tile_columns

2019-06-25 Thread James Almer
On 6/25/2019 10:30 AM, James Almer wrote:
> On 6/25/2019 5:55 AM, Michael Niedermayer wrote:
>> +num_tile_columns_minus1 >= sps->width - 1) {
> 
> Should be sps->ctb_width
> 
> From 7.4.3.3.1:
> 
> "num_tile_columns_minus1 plus 1 specifies the number of tile columns
> partitioning the picture. num_tile_columns_minus1 shall be in the range
> of 0 to PicWidthInCtbsY − 1, inclusive. When not present, the value of
> num_tile_columns_minus1 is inferred to be equal to 0."

Ugh, sorry, only now i looked at your second patch. You can ignore this part

Rest of my review still stands.
___
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 2/2] avcodec/hevc_ps: Change num_tile_rows/columns checks to sps->ctb_height/weight

2019-06-25 Thread James Almer
On 6/25/2019 5:55 AM, Michael Niedermayer wrote:
> Suggested-by: James Almer 
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/hevc_ps.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
> index 07d220a5c8..f6e80e1609 100644
> --- a/libavcodec/hevc_ps.c
> +++ b/libavcodec/hevc_ps.c
> @@ -1588,14 +1588,14 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, 
> AVCodecContext *avctx,
>  int num_tile_rows_minus1= get_ue_golomb(gb);
>  
>  if (num_tile_columns_minus1 < 0 ||
> -num_tile_columns_minus1 >= sps->width - 1) {
> +num_tile_columns_minus1 >= sps->ctb_width - 1) {
>  av_log(avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of 
> range: %d\n",
> num_tile_columns_minus1);
>  ret = num_tile_columns_minus1 < 0 ? num_tile_columns_minus1 : 
> AVERROR_INVALIDDATA;
>  goto err;
>  }
>  if (num_tile_rows_minus1 < 0 ||
> -num_tile_rows_minus1 >= sps->height - 1) {
> +num_tile_rows_minus1 >= sps->ctb_height - 1) {
>  av_log(avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: 
> %d\n",
> num_tile_rows_minus1);
>  ret = num_tile_rows_minus1 < 0 ? num_tile_rows_minus1 : 
> AVERROR_INVALIDDATA;
> 

LGTM
___
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 v2] libavfilter: Add derain filter changeLog

2019-06-25 Thread Steven Liu


> 在 2019年6月13日,18:56,Xuewei Meng  写道:
> 
> Signed-off-by: Xuewei Meng 
> ---
> Changelog | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/Changelog b/Changelog
> index 0e4e9eb7b9..086f36b966 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -32,6 +32,7 @@ version :
> - asr filter
> - showspatial multimedia filter
> - VP4 video decoder
> +- derain filter
> 
> 
> version 4.1:
> -- 
> 2.17.1
> 
> ___
> 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”.

Applied

Thanks
Steven





___
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 v4] libavformat/mpegtsenc: Add minimal support for ATSC PSIP tables

2019-06-25 Thread Phil Burr
It's been a month, no replies.  Is this commit going to be committed, or is
there something further I need to do to move this along?  Should I post a
rebased version?

Thanks,
Phil

On Tue, May 21, 2019 at 8:40 AM Phillip Burr  wrote:

> Minimal support for ATSC PSIP tables.  Does not support STT or
> EIT tables and so is not compliant with terrestrial ATSC.
> ATSC tables are not created by default, and will only be transmitted
> if either "atsc_name" or "atsc_channel" metadata is supplied.
>
> Signed-off-by: Phillip Burr 
> ---
>  doc/muxers.texi |  33 ++-
>  libavformat/mpegts.h|   8 +
>  libavformat/mpegtsenc.c | 468 
>  3 files changed, 415 insertions(+), 94 deletions(-)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 83ae017d6c..dd68eec362 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -1500,10 +1500,35 @@ MPEG transport stream muxer.
>
>  This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
>
> -The recognized metadata settings in mpegts muxer are
> @code{service_provider}
> -and @code{service_name}. If they are not set the default for
> -@code{service_provider} is @samp{FFmpeg} and the default for
> -@code{service_name} is @samp{Service01}.
> +@subsection Metadata
> +
> +The recognized metadata settings in this muxer are:
> +
> +@table @option
> +@item service_name @var{string}
> +Set the @code{service_provider}.  Default is @samp{FFmpeg}.
> +
> +@item service_name @var{string}
> +Set the @code{service_name}. Default is @samp{Service01}.
> +
> +@item atsc_name @var{string}
> +Set the @code{atsc_name} for the stream.  This is the ATSC short
> +channel name for the stream.
> +
> +@item atsc_channel @var{string}
> +Set the @code{atsc_channel} virtual channel for the stream.  This
> +is parsed as @samp{Channel[.SubChannel]} format where the subchannel
> +is optional and defaults to @code{1}.
> +
> +@end table
> +
> +ATSC tables will @emph{not} be generated unless either @code{atsc_name}
> +or @code{atsc_channel} are provided @emph{and} @code{muxrate} is provided.
> +In the event that either @code{atsc_name} or @code{atsc_channel} is
> provided
> +but not both, the default for @code{atsc_name} is @samp{FFmpeg}
> +and the default for @code{atsc_channel} is @samp{1.1}.
> +ATSC tables generated include @code{MGT} and @code{TVCT} tables but are
> lacking the mandatory
> +@code{STT}, @code{EIT0}, @code{EIT1}, @code{EIT2} and @code{EIT3} tables
> needed for terrestrial ATC compliance.
>
>  @subsection Options
>
> diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
> index 272e2be4f7..ca6943b1ba 100644
> --- a/libavformat/mpegts.h
> +++ b/libavformat/mpegts.h
> @@ -35,12 +35,20 @@
>  /* pids */
>  #define PAT_PID 0x
>  #define SDT_PID 0x0011
> +#define ATSC_PID0x1ffb
>
>  /* table ids */
>  #define PAT_TID   0x00
>  #define PMT_TID   0x02
>  #define M4OD_TID  0x05
>  #define SDT_TID   0x42
> +#define MGT_TID   0xc7
> +#define TVCT_TID  0xc8
> +#define CVCT_TID  0xc9
> +#define RRT_TID   0xca
> +#define EIT_TID   0xcb
> +#define ETT_TID   0xcc
> +#define STT_TID   0xcd
>
>  #define STREAM_TYPE_VIDEO_MPEG1 0x01
>  #define STREAM_TYPE_VIDEO_MPEG2 0x02
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index fc0ea225c6..335ff254d8 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -56,12 +56,40 @@ typedef struct MpegTSService {
>  int sid;   /* service ID */
>  uint8_t name[256];
>  uint8_t provider_name[256];
> +
> +uint16_t atsc_name[7]; /* ATSC VCT fields */
> +int atsc_mj_channel;
> +int atsc_mn_channel;
> +
>  int pcr_pid;
>  int pcr_packet_count;
>  int pcr_packet_period;
>  AVProgram *program;
>  } MpegTSService;
>
> +/* The section length is 12 bits. The first 2 are set to 0, the remaining
> + * 10 bits should not exceed 1021. */
> +#define SECTION_LENGTH 1020
> +
> +typedef struct MpegTSAtsc {
> +int enabled;
> +int regenerate;
> +
> +MpegTSSection section; /* ATSC tables */
> +
> +int mgt_packet_count;
> +int mgt_packet_period;
> +int tvct_packet_count;
> +int tvct_packet_period;
> +int64_t last_mgt_ts;
> +int64_t last_tvct_ts;
> +
> +uint32_t tvct_length;
> +uint32_t mgt_length;
> +uint8_t tvct_data[SECTION_LENGTH];
> +uint8_t mgt_data[SECTION_LENGTH];
> +} MpegTSAtsc;
> +
>  // service_type values as defined in ETSI 300 468
>  enum {
>  MPEGTS_SERVICE_TYPE_DIGITAL_TV   = 0x01,
> @@ -78,6 +106,7 @@ typedef struct MpegTSWrite {
>  MpegTSSection pat; /* MPEG-2 PAT table */
>  MpegTSSection sdt; /* MPEG-2 SDT table context */
>  MpegTSService **services;
> +MpegTSAtsc atsc;
>  int sdt_packet_count;
>  int sdt_packet_period;
>  int pat_packet_count;
> @@ -121,10 +150,6 @@ typedef struct MpegTSWrite {
>  #define DEFAULT_PES_HEADER_FREQ  16
>  #define DEFAULT_PES_PAYLOAD_SIZE 

Re: [FFmpeg-devel] [PATCH] avformat/oggparseogm: sync avctx w/ codecpar

2019-06-25 Thread Chris Cunningham
Friendly ping.

On Thu, Jun 20, 2019 at 11:17 AM Chris Cunningham 
wrote:

> On Thu, Feb 28, 2019 at 9:13 AM James Almer  wrote:
>
>> On 2/26/2019 10:18 PM, Chris Cunningham wrote:
>> > On Thu, Feb 21, 2019 at 4:46 PM Chris Cunningham
>> > mailto:chcunning...@chromium.org>> wrote:
>> >
>> > I'm fine to do either. James, do you still prefer to skip the later
>> > headers if this breaks some old ogm files?
>> >
>> >
>> > James, friendly ping
>>
>> Yes, i'd prefer if we skip any superfluous parameter header that shows
>> up before the first data packet.
>> The return value of ff_codec_get_id() should also be checked to not
>> propagate AV_CODEC_ID_NONE, which was the source of this issue.
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
> Renewing request to apply for this patch.
>
> The alternate route of identifying/skipping the bad packets was more
> difficult than expected (https://patchwork.ffmpeg.org/patch/13593/).
> James signed on this approach instead.
>
> Chris
>
___
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] avformat/oggparseogm: sync avctx w/ codecpar

2019-06-25 Thread James Almer
On 6/25/2019 1:44 PM, Chris Cunningham wrote:
> Friendly ping.
> 
> On Thu, Jun 20, 2019 at 11:17 AM Chris Cunningham 
> wrote:
> 
>> On Thu, Feb 28, 2019 at 9:13 AM James Almer  wrote:
>>
>>> On 2/26/2019 10:18 PM, Chris Cunningham wrote:
 On Thu, Feb 21, 2019 at 4:46 PM Chris Cunningham
 mailto:chcunning...@chromium.org>> wrote:

 I'm fine to do either. James, do you still prefer to skip the later
 headers if this breaks some old ogm files?


 James, friendly ping
>>>
>>> Yes, i'd prefer if we skip any superfluous parameter header that shows
>>> up before the first data packet.
>>> The return value of ff_codec_get_id() should also be checked to not
>>> propagate AV_CODEC_ID_NONE, which was the source of this issue.
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>>
>> Renewing request to apply for this patch.
>>
>> The alternate route of identifying/skipping the bad packets was more
>> difficult than expected (https://patchwork.ffmpeg.org/patch/13593/).
>> James signed on this approach instead.
>>
>> Chris

Applied.
___
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] avcodec: add delayer bitstream filter

2019-06-25 Thread Andreas Håkon
Example of use:

ffmpeg -f mpegts -i INPUT.ts -map i:101 -c:v copy -map i:102 -bsf:a 
delayer=offset=3600 -c:a copy -f mpegts OUTPUT.ts

You can use it with VIDEO, AUDIO or DATA streams.

Regards.
A.H.

---From 414a3c78dfa208b8253448d5c09fde9a8bee56cb Mon Sep 17 00:00:00 2001
From: Andreas Hakon 
Date: Tue, 25 Jun 2019 20:03:48 +0100
Subject: [PATCH] avcodec: add delayer bitstream filter

This implements a new delayer bitstream filter.

Signed-off-by: Andreas Hakon 
---
 doc/bitstream_filters.texi |4 ++
 libavcodec/Makefile|1 +
 libavcodec/bitstream_filters.c |1 +
 libavcodec/delayer_bsf.c   |   81 
 4 files changed, 87 insertions(+)
 create mode 100644 libavcodec/delayer_bsf.c

diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index 40e8ada..563dfa9 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -96,6 +96,10 @@ Deletes Padding OBUs.
 
 Remove zero padding at the end of a packet.
 
+@section delayer
+
+Apply an offset to the PTS/DTS timestamps.
+
 @section dca_core
 
 Extract the core from a DCA/DTS stream, dropping extensions such as
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index edccd73..e723e62 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1071,6 +1071,7 @@ OBJS-$(CONFIG_AAC_ADTSTOASC_BSF)  += 
aac_adtstoasc_bsf.o mpeg4audio.o
 OBJS-$(CONFIG_AV1_METADATA_BSF)   += av1_metadata_bsf.o
 OBJS-$(CONFIG_AV1_FRAME_SPLIT_BSF)+= av1_frame_split_bsf.o
 OBJS-$(CONFIG_CHOMP_BSF)  += chomp_bsf.o
+OBJS-$(CONFIG_DELAYER_BSF)+= delayer_bsf.o
 OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
 OBJS-$(CONFIG_DCA_CORE_BSF)   += dca_core_bsf.o
 OBJS-$(CONFIG_EAC3_CORE_BSF)  += eac3_core_bsf.o
diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index 4630039..a3c509a 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -28,6 +28,7 @@ extern const AVBitStreamFilter ff_aac_adtstoasc_bsf;
 extern const AVBitStreamFilter ff_av1_frame_split_bsf;
 extern const AVBitStreamFilter ff_av1_metadata_bsf;
 extern const AVBitStreamFilter ff_chomp_bsf;
+extern const AVBitStreamFilter ff_delayer_bsf;
 extern const AVBitStreamFilter ff_dump_extradata_bsf;
 extern const AVBitStreamFilter ff_dca_core_bsf;
 extern const AVBitStreamFilter ff_eac3_core_bsf;
diff --git a/libavcodec/delayer_bsf.c b/libavcodec/delayer_bsf.c
new file mode 100644
index 000..81ef625
--- /dev/null
+++ b/libavcodec/delayer_bsf.c
@@ -0,0 +1,81 @@
+/*
+ * 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
+ * This bitstream filter applies an offset to the PTS/DTS timestamps.
+ *
+ */
+
+// TODO: Control time wrapping
+// TODO: Instead of using absolute timestamp offsets, use frame numbers
+// TODO: Advance in time? (aka negative offset)
+
+#include "avcodec.h"
+#include "bsf.h"
+
+#include "libavutil/opt.h"
+
+typedef struct DelayerContext {
+const AVClass *class;
+int offset;
+} DelayerContext;
+
+static int delayer_filter(AVBSFContext *ctx, AVPacket *pkt)
+{
+int ret;
+DelayerContext *s = ctx->priv_data;
+int64_t opts,odts;
+
+ret = ff_bsf_get_packet_ref(ctx, pkt);
+if (ret < 0)
+return ret;
+
+opts = pkt->pts;
+if (pkt->pts != AV_NOPTS_VALUE) {
+pkt->pts += s->offset;
+}
+odts = pkt->dts;
+if (pkt->dts != AV_NOPTS_VALUE) {
+pkt->dts += s->offset;
+}
+av_log(ctx, AV_LOG_DEBUG, "Updated PTS/DTS (%"PRId64"/%"PRId64" : 
%"PRId64"/%"PRId64") with offset:%d\n", pkt->pts,pkt->dts, opts,odts, s->offset 
);
+
+return 0;
+}
+
+#define OFFSET(x) offsetof(DelayerContext, x)
+#define FLAGS 
(AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_SUBTITLE_PARAM|AV_OPT_FLAG_BSF_PARAM)
+static const AVOption options[] = {
+{ "offset", NULL, OFFSET(offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 
INT_MAX, FLAGS },
+{ NULL },
+};
+
+static const AVClass delayer_class = {
+.class_name = "delayer",
+.item_name  = av_default_item_name,
+.option = options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
+const AVBitStreamFilter ff_delayer_bsf = {
+.name   

Re: [FFmpeg-devel] [PATCH] avcodec: add delayer bitstream filter

2019-06-25 Thread Gyan



On 26-06-2019 12:47 AM, Andreas Håkon wrote:

Example of use:

ffmpeg -f mpegts -i INPUT.ts -map i:101 -c:v copy -map i:102 -bsf:a 
delayer=offset=3600 -c:a copy -f mpegts OUTPUT.ts

You can use it with VIDEO, AUDIO or DATA streams.


What's the advantage over output_ts_offset?

Gyan
___
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] avcodec: add delayer bitstream filter

2019-06-25 Thread Gyan



On 26-06-2019 12:58 AM, Gyan wrote:



On 26-06-2019 12:47 AM, Andreas Håkon wrote:

Example of use:

ffmpeg -f mpegts -i INPUT.ts -map i:101 -c:v copy -map i:102 -bsf:a 
delayer=offset=3600 -c:a copy -f mpegts OUTPUT.ts


You can use it with VIDEO, AUDIO or DATA streams.


What's the advantage over output_ts_offset?


To answer that partially, this can be applied per-stream.

Wouldn't this be better if extended to be a BSF version of setpts? In 
addition to delays, rescaling as well as other ops could be carried out 
on TS.


Gyan
___
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] avcodec: add delayer bitstream filter

2019-06-25 Thread Andreas Rheinhardt
Andreas Håkon:
> Example of use:
> 
> ffmpeg -f mpegts -i INPUT.ts -map i:101 -c:v copy -map i:102 -bsf:a 
> delayer=offset=3600 -c:a copy -f mpegts OUTPUT.ts
> 
> You can use it with VIDEO, AUDIO or DATA streams.
> 
> Regards.
> A.H.
> 
> ---
> 
> 
> ___
> 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".
> 

The delay applied here depends on the timebase. Wouldn't it be more
user-friendly to let the user input the delay in (say) microseconds
and convert it appropriately?
And ff_delayer_bsf isn't properly aligned.

- Andreas Rheinhardt
___
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] print pts as min:sec

2019-06-25 Thread Ulf Zibis
Hi,

is there a functionality in the ffmpeg library to print AVFrame pts
values in respect to AVRational time_base in human readable form?

Thanks

-Ulf

___
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] frame->display_picture_number is always 0

2019-06-25 Thread Ulf Zibis
Hi,

in a filter context I'm reading AVFrame field display_picture_number. It
is always 0.
How can I get this field filled with valid data?

The field AVFrame->coded_picture_number has valid data, but the numbers
are slightly unordered, so I want to use field display_picture_number.

Thanks,

-Ulf


___
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 3/3] avcodec/simple_idct_template: Fix integer overflow in idctSparseColAdd()

2019-06-25 Thread Michael Niedermayer
Fixes: signed integer overflow: 1106434976 + 1041773512 cannot be represented 
in type 'int'
Fixes: 
15421/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV2_fuzzer-5669209314426880

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/simple_idct_template.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/simple_idct_template.c 
b/libavcodec/simple_idct_template.c
index 90d1c21355..d8fcfd7c53 100644
--- a/libavcodec/simple_idct_template.c
+++ b/libavcodec/simple_idct_template.c
@@ -288,25 +288,25 @@ static inline void FUNC6(idctSparseColPut)(pixel *dest, 
ptrdiff_t line_size,
 static inline void FUNC6(idctSparseColAdd)(pixel *dest, ptrdiff_t line_size,
   idctin *col)
 {
-int a0, a1, a2, a3, b0, b1, b2, b3;
+unsigned a0, a1, a2, a3, b0, b1, b2, b3;
 
 IDCT_COLS;
 
-dest[0] = av_clip_pixel(dest[0] + ((a0 + b0) >> COL_SHIFT));
+dest[0] = av_clip_pixel(dest[0] + ((int)(a0 + b0) >> COL_SHIFT));
 dest += line_size;
-dest[0] = av_clip_pixel(dest[0] + ((a1 + b1) >> COL_SHIFT));
+dest[0] = av_clip_pixel(dest[0] + ((int)(a1 + b1) >> COL_SHIFT));
 dest += line_size;
-dest[0] = av_clip_pixel(dest[0] + ((a2 + b2) >> COL_SHIFT));
+dest[0] = av_clip_pixel(dest[0] + ((int)(a2 + b2) >> COL_SHIFT));
 dest += line_size;
-dest[0] = av_clip_pixel(dest[0] + ((a3 + b3) >> COL_SHIFT));
+dest[0] = av_clip_pixel(dest[0] + ((int)(a3 + b3) >> COL_SHIFT));
 dest += line_size;
-dest[0] = av_clip_pixel(dest[0] + ((a3 - b3) >> COL_SHIFT));
+dest[0] = av_clip_pixel(dest[0] + ((int)(a3 - b3) >> COL_SHIFT));
 dest += line_size;
-dest[0] = av_clip_pixel(dest[0] + ((a2 - b2) >> COL_SHIFT));
+dest[0] = av_clip_pixel(dest[0] + ((int)(a2 - b2) >> COL_SHIFT));
 dest += line_size;
-dest[0] = av_clip_pixel(dest[0] + ((a1 - b1) >> COL_SHIFT));
+dest[0] = av_clip_pixel(dest[0] + ((int)(a1 - b1) >> COL_SHIFT));
 dest += line_size;
-dest[0] = av_clip_pixel(dest[0] + ((a0 - b0) >> COL_SHIFT));
+dest[0] = av_clip_pixel(dest[0] + ((int)(a0 - b0) >> COL_SHIFT));
 }
 
 static inline void FUNC6(idctSparseCol)(idctin *col)
-- 
2.22.0

___
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 2/3] avcodec/simple_idct_template: Fix integer overflow in idctSparseCol()

2019-06-25 Thread Michael Niedermayer
Fixes: signed integer overflow: -1027919784 + -1120041624 cannot be represented 
in type 'int'
Fixes: 
15406/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3_fuzzer-5700646528876544

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/simple_idct_template.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/simple_idct_template.c 
b/libavcodec/simple_idct_template.c
index 35c31321c6..90d1c21355 100644
--- a/libavcodec/simple_idct_template.c
+++ b/libavcodec/simple_idct_template.c
@@ -312,18 +312,18 @@ static inline void FUNC6(idctSparseColAdd)(pixel *dest, 
ptrdiff_t line_size,
 static inline void FUNC6(idctSparseCol)(idctin *col)
 #endif
 {
-int a0, a1, a2, a3, b0, b1, b2, b3;
+unsigned a0, a1, a2, a3, b0, b1, b2, b3;
 
 IDCT_COLS;
 
-col[0 ] = ((a0 + b0) >> COL_SHIFT);
-col[8 ] = ((a1 + b1) >> COL_SHIFT);
-col[16] = ((a2 + b2) >> COL_SHIFT);
-col[24] = ((a3 + b3) >> COL_SHIFT);
-col[32] = ((a3 - b3) >> COL_SHIFT);
-col[40] = ((a2 - b2) >> COL_SHIFT);
-col[48] = ((a1 - b1) >> COL_SHIFT);
-col[56] = ((a0 - b0) >> COL_SHIFT);
+col[0 ] = ((int)(a0 + b0) >> COL_SHIFT);
+col[8 ] = ((int)(a1 + b1) >> COL_SHIFT);
+col[16] = ((int)(a2 + b2) >> COL_SHIFT);
+col[24] = ((int)(a3 + b3) >> COL_SHIFT);
+col[32] = ((int)(a3 - b3) >> COL_SHIFT);
+col[40] = ((int)(a2 - b2) >> COL_SHIFT);
+col[48] = ((int)(a1 - b1) >> COL_SHIFT);
+col[56] = ((int)(a0 - b0) >> COL_SHIFT);
 }
 
 #ifndef EXTRA_SHIFT
-- 
2.22.0

___
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 1/3] avcodec/svq3: Use ff_set_dimension()

2019-06-25 Thread Michael Niedermayer
Fixes: OOM
Fixes: 
15410/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ3_fuzzer-5659464805384192

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/svq3.c | 36 
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 18a4448ffa..9cea9ac840 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -1183,6 +1183,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
 GetBitContext gb;
 int frame_size_code;
 int unk0, unk1, unk2, unk3, unk4;
+int w,h;
 
 size = AV_RB32(&extradata[4]);
 if (size > extradata_end - extradata - 8) {
@@ -1195,38 +1196,41 @@ static av_cold int svq3_decode_init(AVCodecContext 
*avctx)
 frame_size_code = get_bits(&gb, 3);
 switch (frame_size_code) {
 case 0:
-avctx->width  = 160;
-avctx->height = 120;
+w = 160;
+h = 120;
 break;
 case 1:
-avctx->width  = 128;
-avctx->height =  96;
+w = 128;
+h =  96;
 break;
 case 2:
-avctx->width  = 176;
-avctx->height = 144;
+w = 176;
+h = 144;
 break;
 case 3:
-avctx->width  = 352;
-avctx->height = 288;
+w = 352;
+h = 288;
 break;
 case 4:
-avctx->width  = 704;
-avctx->height = 576;
+w = 704;
+h = 576;
 break;
 case 5:
-avctx->width  = 240;
-avctx->height = 180;
+w = 240;
+h = 180;
 break;
 case 6:
-avctx->width  = 320;
-avctx->height = 240;
+w = 320;
+h = 240;
 break;
 case 7:
-avctx->width  = get_bits(&gb, 12);
-avctx->height = get_bits(&gb, 12);
+w = get_bits(&gb, 12);
+h = get_bits(&gb, 12);
 break;
 }
+ret = ff_set_dimensions(avctx, w, h);
+if (ret < 0)
+goto fail;
 
 s->halfpel_flag  = get_bits1(&gb);
 s->thirdpel_flag = get_bits1(&gb);
-- 
2.22.0

___
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 v4] vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables

2019-06-25 Thread greg Luce
Hello,

Just wondering if there’s anything else I should do to get this in

Thanks!
___
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] print pts as min:sec

2019-06-25 Thread greg Luce
>
> is there a functionality in the ffmpeg library to print AVFrame pts
> values in respect to AVRational time_base in human readable form?


I wonder if vf_drawtext might have an example of what you’re looking for
with the pts keyword?


>
___
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 v15 2/2] doc: Add libsvt_hevc encoder docs

2019-06-25 Thread Jing Sun
Add docs for libsvt_hevc encoder in encoders.texi and general.texi

Signed-off-by: Jun Zhao 
Signed-off-by: Zhengxu Huang 
Signed-off-by: Hassene Tmar 
Signed-off-by: Jing Sun 
---
 doc/encoders.texi | 149 ++
 doc/general.texi  |   8 +++
 2 files changed, 157 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index eefd124..81debda 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1640,6 +1640,155 @@ Set maximum NAL size in bytes.
 Allow skipping frames to hit the target bitrate if set to 1.
 @end table
 
+@section libsvt_hevc
+
+Scalable Video Technology for HEVC (SVT-HEVC) encoder wrapper.
+
+This encoder requires the presence of the headers and
+library during configuration. You need to explicitly configure the
+build with @code{--enable-libsvthevc}. The library is detected using
+@command{pkg-config}.
+
+For more information about the library see
+@url{https://github.com/intel/SVT-HEVC.git}.
+
+@subsection Options
+
+The following FFmpeg global options affect the configurations of the
+libsvt_hevc encoder:
+
+@table @option
+@item b  (@emph{bitrate})
+Set the bitrate (as a number of bits per second). Default is 7M.
+
+@item g  / @option{gop_size}
+Set the GOP size. Default is -2 (unspecified).
+
+@item flags +cgop
+Enable closed GOP.
+
+@item qmin (@emph{min-q})
+Default is 10
+
+@item qmax (@emph{max-q})
+Default is 48
+
+Set minimum/maximum quantisation values.  Valid range is from 0 to 51
+(Only used when bit rate control mode @option{rc} is set to 1(vbr) mode.
+It is required that qmax >= qmin).
+
+@item profile (@emph{profile})
+Set profile restrictions. Can assume one of the following possible values:
+
+@table @samp
+@item main
+main profile
+@item main10
+main10 profile
+@item rext
+rext profile
+@end table
+
+Default is 1 (main).
+
+@item level (@emph{level})
+
+@option{level} sets the value of @emph{level}.
+Set level (level_idc). Default is 0 (to be determined by the encoder).
+
+@end table
+
+The encoder also has its own specific options:
+
+@table @option
+@item aud (@emph{aud})
+Enable use of access unit delimiters when set to 1. Default is 0 (Off).
+
+@item hielevel
+Set hierarchical levels. Can assume one of the following possible values:
+
+@table @samp
+@item flat
+flat more
+@item 1 level
+Minigop size is 2^1
+@item 2 level
+Minigop size is 2^2
+@item 3 level
+Minigop size is 2^3
+@end table
+
+Default is 3 level.
+
+@item la_depth
+Set look-ahead depth, depending on @option{rc}: for @var{vbr}, it's recommended
+to unset it and use the default value (the intra period); for @var{cqp}, better
+specify the look-ahead depth.
+
+The range is @var{-1-256}. Default is -1 (unset and the default value to be 
used).
+
+@item preset
+Set the quality vs density tradeoff point at which the encoding is to be 
performed.
+Higher perset value, higher density and lower quality.
+
+The range is @var{0-12}. Default is 9.
+
+@item tier
+Set @emph{general_tier_flag}.  This may affect the level chosen for the stream
+if it is not explicitly specified. Can assume one of the following possible 
values:
+
+@table @samp
+@item main
+main tier
+@item high
+high tier
+@end table
+
+Default is 1 (main).
+
+@item rc
+Set bit rate control mode. Can assume one of the following possible values:
+
+@table @samp
+@item cqp
+Constant QP (CQP) mode
+@item vbr
+Variable Bit Rate (VBR) mode
+@end table
+
+Default is 0 (cqp).
+
+@item forced_idr
+Force keyframes to be IDR if set to 1. Default is 0 (CRA).
+
+@item asm_type
+Auto select highest supported asm if set to 1 or C only if 0. Default is 1.
+
+@item qp
+Initial quantization parameter for the intra pictures used when
+@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32.
+
+@item sc_detection
+Enables or disables the scene change detection algorithm. Default is 0 
(disabled).
+
+@item tune
+Set quality tuning mode. Can assume one of the following possible values:
+
+@table @samp
+@item sq
+Visually optimized mode
+@item oq
+PSNR / SSIM optimized mode
+@item vmaf
+VMAF optimized mode
+@end table
+
+Default is 1 (oq).
+
+@item bl_mode
+Enables or disables Random Access Prediction. Default is 0 (disabled).
+@end table
+
 @section libtheora
 
 libtheora Theora encoder wrapper.
diff --git a/doc/general.texi b/doc/general.texi
index 3c0c803..fa9cd31 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -243,6 +243,14 @@ FFmpeg can use the OpenJPEG libraries for 
decoding/encoding J2K videos.  Go to
 instructions.  To enable using OpenJPEG in FFmpeg, pass 
@code{--enable-libopenjpeg} to
 @file{./configure}.
 
+@section Scalable Video Technology for HEVC
+
+FFmpeg can make use of the SVT-HEVC library for HEVC encoding.
+
+Go to @url{https://github.com/intel/SVT-HEVC.git} and follow the instructions
+for installing the library. Pass @code{--enable-libsvthevc} to configure to
+enable it.
+
 @section TwoLAME
 
 FFmpeg can make use of the TwoLAME library for MP2 encoding.
-- 
1.8.3.1

_

[FFmpeg-devel] [PATCH v15 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper

2019-06-25 Thread Jing Sun
Signed-off-by: Zhengxu Huang 
Signed-off-by: Hassene Tmar 
Signed-off-by: Jun Zhao 
Signed-off-by: Jing Sun 
---
 configure|   4 +
 libavcodec/Makefile  |   1 +
 libavcodec/allcodecs.c   |   1 +
 libavcodec/libsvt_hevc.c | 501 +++
 libavcodec/version.h |   2 +-
 5 files changed, 508 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/libsvt_hevc.c

diff --git a/configure b/configure
index 7cea9d4..8f2f065 100755
--- a/configure
+++ b/configure
@@ -264,6 +264,7 @@ External library support:
   --enable-libspeexenable Speex de/encoding via libspeex [no]
   --enable-libsrt  enable Haivision SRT protocol via libsrt [no]
   --enable-libssh  enable SFTP protocol via libssh [no]
+  --enable-libsvthevc  enable HEVC encoding via svt [no]
   --enable-libtensorflow   enable TensorFlow as a DNN module backend
for DNN based filters like sr [no]
   --enable-libtesseractenable Tesseract, needed for ocr filter [no]
@@ -1787,6 +1788,7 @@ EXTERNAL_LIBRARY_LIST="
 libspeex
 libsrt
 libssh
+libsvthevc
 libtensorflow
 libtesseract
 libtheora
@@ -3180,6 +3182,7 @@ libshine_encoder_select="audio_frame_queue"
 libspeex_decoder_deps="libspeex"
 libspeex_encoder_deps="libspeex"
 libspeex_encoder_select="audio_frame_queue"
+libsvt_hevc_encoder_deps="libsvthevc"
 libtheora_encoder_deps="libtheora"
 libtwolame_encoder_deps="libtwolame"
 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
@@ -6226,6 +6229,7 @@ enabled libsoxr   && require libsoxr soxr.h 
soxr_create -lsoxr
 enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h 
sftp_init
 enabled libspeex  && require_pkg_config libspeex speex speex/speex.h 
speex_decoder_init
 enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" 
srt/srt.h srt_socket
+enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h 
EbInitHandle
 enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h 
TF_Version -ltensorflow
 enabled libtesseract  && require_pkg_config libtesseract tesseract 
tesseract/capi.h TessBaseAPICreate
 enabled libtheora && require libtheora theora/theoraenc.h th_info_init 
-ltheoraenc -ltheoradec -logg
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index edccd73..7eb13de 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o 
libopus.o \
 OBJS-$(CONFIG_LIBSHINE_ENCODER)   += libshine.o
 OBJS-$(CONFIG_LIBSPEEX_DECODER)   += libspeexdec.o
 OBJS-$(CONFIG_LIBSPEEX_ENCODER)   += libspeexenc.o
+OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o
 OBJS-$(CONFIG_LIBTHEORA_ENCODER)  += libtheoraenc.o
 OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o
 OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index d2f9a39..d8788a7 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -707,6 +707,7 @@ extern AVCodec ff_librsvg_decoder;
 extern AVCodec ff_libshine_encoder;
 extern AVCodec ff_libspeex_encoder;
 extern AVCodec ff_libspeex_decoder;
+extern AVCodec ff_libsvt_hevc_encoder;
 extern AVCodec ff_libtheora_encoder;
 extern AVCodec ff_libtwolame_encoder;
 extern AVCodec ff_libvo_amrwbenc_encoder;
diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c
new file mode 100644
index 000..d9ac04c
--- /dev/null
+++ b/libavcodec/libsvt_hevc.c
@@ -0,0 +1,501 @@
+/*
+* Scalable Video Technology for HEVC encoder library plugin
+*
+* Copyright (c) 2019 Intel Corporation
+*
+* 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 this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "EbErrorCodes.h"
+#include "EbTime.h"
+#include "EbApi.h"
+
+#include "libavutil/common.h"
+#include "libavutil/frame.h"
+#include "libavutil/opt.h"
+
+#include "internal.h"
+#include "avcodec.h"
+
+typedef enum eos_status {
+EOS_NOT_REACHED = 0,
+EOS_SENT,
+EOS_RECEIVED
+}EOS_STATUS;
+
+typedef struct SvtContext {
+AVClass *class;
+
+EB_H265_ENC_CONFIGURATION enc_params;
+EB_COMPONENTTYPE *svt_handle;
+EB_BUFFERHEADERTYPE in_buf;
+EOS_STATUS eos_flag;
+

Re: [FFmpeg-devel] [PATCH v14 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper

2019-06-25 Thread Sun, Jing A
-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of Carl 
Eugen Hoyos
Sent: Tuesday, June 25, 2019 9:07 PM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH v14 1/2] lavc/svt_hevc: add libsvt hevc 
encoder wrapper


>A minor bump is common for new codecs.

>Carl Eugen

Thanks Carl! It's modified.

Regards,
Sun, Jing
___
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 v2 4/9] vp9_parser: Return stream properties

2019-06-25 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Li, Zhong
> Sent: Friday, May 31, 2019 3:23 PM
> To: FFmpeg development discussions and patches
> 
> Subject: Re: [FFmpeg-devel] [PATCH v2 4/9] vp9_parser: Return stream
> properties
> 
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> Behalf
> > Of Li, Zhong
> > Sent: Sunday, April 28, 2019 6:24 PM
> > To: FFmpeg development discussions and patches
> > 
> > Subject: Re: [FFmpeg-devel] [PATCH v2 4/9] vp9_parser: Return stream
> > properties
> >
> > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > Behalf
> > > Of Mark Thompson
> > > Sent: Tuesday, April 2, 2019 7:40 AM
> > > To: ffmpeg-devel@ffmpeg.org
> > > Subject: [FFmpeg-devel] [PATCH v2 4/9] vp9_parser: Return stream
> > > properties
> > >
> > > Rewrites the parser entirely, using CBS for header parsing.
> > > ---
> > >  libavcodec/vp9_parser.c | 112
> > > +---
> > >  1 file changed, 82 insertions(+), 30 deletions(-)
> > >
> > > diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c index
> > > c957a75667..6bf4f30e80 100644
> > > --- a/libavcodec/vp9_parser.c
> > > +++ b/libavcodec/vp9_parser.c
> > > @@ -1,8 +1,5 @@
> > >  /*
> > > - * VP9 compatible video decoder
> > > - *
> > > - * Copyright (C) 2013 Ronald S. Bultje 
> > > - * Copyright (C) 2013 Clément Bœsch 
> > > + * VP9 parser
> > >   *
> > >   * This file is part of FFmpeg.
> > >   *
> > > @@ -21,50 +18,105 @@
> > >   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> > > 02110-1301 USA
> > >   */
> > >
> > > -#include "libavutil/intreadwrite.h"
> > > -#include "libavcodec/get_bits.h"
> > > +#include "libavutil/avassert.h"
> > > +#include "cbs.h"
> > > +#include "cbs_vp9.h"
> > >  #include "parser.h"
> > >
> > > -static int parse(AVCodecParserContext *ctx,
> > > - AVCodecContext *avctx,
> > > - const uint8_t **out_data, int *out_size,
> > > - const uint8_t *data, int size)
> > > +typedef struct VP9ParserContext {
> > > +CodedBitstreamContext *cbc;
> > > +VP9RawFrameHeader frame_header; } VP9ParserContext;
> > > +
> > > +static const enum AVPixelFormat vp9_pix_fmts[3][2][2] = {
> > > +{ // 8-bit.
> > > +{ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV440P },
> > > +{ AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P },
> > > +},
> > > +{ // 10-bit.
> > > +{ AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV440P10 },
> > > +{ AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV420P10 },
> > > +},
> > > +{ // 12-bit.
> > > +{ AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV440P12 },
> > > +{ AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV420P12 },
> > > +},
> > > +};
> > > +
> > > +static int vp9_parser_parse(AVCodecParserContext *ctx,
> > > +AVCodecContext *avctx,
> > > +const uint8_t **out_data, int
> > *out_size,
> > > +const uint8_t *data, int size)
> > >  {
> > > -GetBitContext gb;
> > > -int res, profile, keyframe;
> > > +VP9ParserContext *s = ctx->priv_data;
> > > +const CodedBitstreamVP9Context *vp9 = s->cbc->priv_data;
> > > +const VP9RawFrameHeader *fh;
> > > +int err;
> > >
> > >  *out_data = data;
> > >  *out_size = size;
> > >
> > > -if (!size || (res = init_get_bits8(&gb, data, size)) < 0)
> > > -return size; // parsers can't return errors
> > > -get_bits(&gb, 2); // frame marker
> > > -profile  = get_bits1(&gb);
> > > -profile |= get_bits1(&gb) << 1;
> > > -if (profile == 3) profile += get_bits1(&gb);
> > > -if (profile > 3)
> > > -return size;
> > > +ctx->key_frame = -1;
> > > +ctx->pict_type = AV_PICTURE_TYPE_NONE;
> > > +ctx->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
> > >
> > > -avctx->profile = profile;
> > > +if (!size)
> > > +return 0;
> > >
> > > -if (get_bits1(&gb)) {
> > > -keyframe = 0;
> > > -} else {
> > > -keyframe  = !get_bits1(&gb);
> > > +s->cbc->log_ctx = avctx;
> > > +
> > > +err = ff_cbs_parse_headers(s->cbc, &s->frame_header, data, size);
> > > +if (err < 0) {
> > > +av_log(avctx, AV_LOG_WARNING, "Failed to parse VP9 frame
> > > headers.\n");
> > > +goto end;
> > >  }
> > > +fh = &s->frame_header;
> > >
> > > -if (!keyframe) {
> > > -ctx->pict_type = AV_PICTURE_TYPE_P;
> > > -ctx->key_frame = 0;
> > > -} else {
> > > +avctx->profile = vp9->profile;
> > > +avctx->level   = FF_LEVEL_UNKNOWN;
> > > +
> > > +ctx->width  = ctx->coded_width  = vp9->frame_width;
> > > +ctx->height = ctx->coded_height = vp9->frame_height;
> > > +
> > > +if (fh->frame_type == VP9_KEY_FRAME) {
> > >  ctx->pict_type = AV_PICTURE_TYPE_I;
> > >  ctx->key_frame = 1;
> > > +} else {
> > > +ctx->pict_type = fh->intra_only ? AV_PICTURE_TYP

Re: [FFmpeg-devel] [PATCH v2 5/9] lavc/qsvdec: Add VP9 decoder support

2019-06-25 Thread Li, Zhong


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Li, Zhong
> Sent: Tuesday, April 16, 2019 10:32 AM
> To: FFmpeg development discussions and patches
> 
> Subject: Re: [FFmpeg-devel] [PATCH v2 5/9] lavc/qsvdec: Add VP9 decoder
> support
> 
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> Behalf
> > Of Mark Thompson
> > Sent: Tuesday, April 2, 2019 7:40 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: [FFmpeg-devel] [PATCH v2 5/9] lavc/qsvdec: Add VP9 decoder
> > support
> >
> > From: Zhong Li 
> >
> > VP9 decoder is supported on Intel kabyLake+ platforms with MSDK
> > Version 1.19+
> >
> > Signed-off-by: Zhong Li 
> > ---
> > On 20/03/2019 14:41, Li, Zhong wrote:
> > > Yes, QSV is a marketing name which is no equal to libmfx/MSDK.
> > > But would be better to keep consistent with others, such as "Intel
> > QSV-accelerated VP8 video decoding" in pervious changelog?
> >
> > I don't think so?  VP9 decoding with the QSV hardware is already
> > supported, this only adds the additional option of using libmfx to
> > access the same thing as well.
> 
> Ok, here are just some words description of changelog. I will be happy to see
> this patch can be applied.
> (As previous comment, the updated version of vp9 parser with pic_type of
> key frame issue fixing LGTM.)

Ping?

If nobody against, I will merge it with cbs vp9 parser patch during one week.
___
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".