Re: [FFmpeg-devel] [PATCH] libavcodec/pgx: Added pgx decoder

2020-06-25 Thread Gautam Ramakrishnan
On Thu, Jun 25, 2020 at 12:50 AM Carl Eugen Hoyos  wrote:
>
> Am Mi., 24. Juni 2020 um 20:55 Uhr schrieb :
> >
> > From: Gautam Ramakrishnan 
> >
> > This patch support to read and decode
> > pgx files.
> > ---
> >  libavcodec/Makefile  |   1 +
> >  libavcodec/allcodecs.c   |   1 +
> >  libavcodec/codec_id.h|   1 +
> >  libavcodec/pgx.h |  38 +
> >  libavcodec/pgxdec.c  | 176 +++
> >  libavformat/allformats.c |   1 +
> >  libavformat/img2dec.c|  11 +++
> >  7 files changed, 229 insertions(+)
> >  create mode 100644 libavcodec/pgx.h
> >  create mode 100644 libavcodec/pgxdec.c
> >
> > diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> > index 5a6ea59715..0198c244e0 100644
> > --- a/libavcodec/Makefile
> > +++ b/libavcodec/Makefile
> > @@ -533,6 +533,7 @@ OBJS-$(CONFIG_PCX_ENCODER) += pcxenc.o
> >  OBJS-$(CONFIG_PFM_DECODER) += pnmdec.o pnm.o
> >  OBJS-$(CONFIG_PGM_DECODER) += pnmdec.o pnm.o
> >  OBJS-$(CONFIG_PGM_ENCODER) += pnmenc.o
> > +OBJS-$(CONFIG_PGX_DECODER) += pgxdec.o
> >  OBJS-$(CONFIG_PGMYUV_DECODER)  += pnmdec.o pnm.o
> >  OBJS-$(CONFIG_PGMYUV_ENCODER)  += pnmenc.o
> >  OBJS-$(CONFIG_PGSSUB_DECODER)  += pgssubdec.o
> > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> > index fa0c08d42e..b0217e6d6a 100644
> > --- a/libavcodec/allcodecs.c
> > +++ b/libavcodec/allcodecs.c
> > @@ -236,6 +236,7 @@ extern AVCodec ff_pcx_decoder;
> >  extern AVCodec ff_pfm_decoder;
> >  extern AVCodec ff_pgm_encoder;
> >  extern AVCodec ff_pgm_decoder;
> > +extern AVCodec ff_pgx_decoder;
> >  extern AVCodec ff_pgmyuv_encoder;
> >  extern AVCodec ff_pgmyuv_decoder;
> >  extern AVCodec ff_pictor_decoder;
> > diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
> > index d885962c9c..027ef21c62 100644
> > --- a/libavcodec/codec_id.h
> > +++ b/libavcodec/codec_id.h
> > @@ -111,6 +111,7 @@ enum AVCodecID {
> >  AV_CODEC_ID_PPM,
> >  AV_CODEC_ID_PBM,
> >  AV_CODEC_ID_PGM,
>
> > +AV_CODEC_ID_PGX,
>
> You cannot put this in the middle of an enum, it breaks abi.
>
Ok, I shall move it to the bottom
> >  AV_CODEC_ID_PGMYUV,
> >  AV_CODEC_ID_PAM,
> >  AV_CODEC_ID_FFVHUFF,
> > diff --git a/libavcodec/pgx.h b/libavcodec/pgx.h
> > new file mode 100644
> > index 00..bbe93fafe7
> > --- /dev/null
> > +++ b/libavcodec/pgx.h
> > @@ -0,0 +1,38 @@
> > +/*
> > + * PGX image format
> > + * Copyright (c) 2020 Gautam Ramakrishnan
> > + *
> > + * 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
> > + */
> > +
> > +#ifndef AVCODEC_PGX_H
> > +#define AVCODEC_PGX_H
> > +
> > +#include "avcodec.h"
> > +#include "bytestream.h"
> > +
> > +typedef struct PGXContext {
> > +GetByteContext  g;
> > +int depth;
> > +int sgnd;
> > +int width;
> > +int height;
> > +} PGXContext;
> > +
> > +int ff_pgx_decode_header(AVCodecContext *avctx, PGXContext * const s);
> > +
> > +#endif /* AVCODEC_PNM_H */
>
> > \ No newline at end of file
>
> Apart from this:
> Why is the header file needed at all?
>
In case we add an encoder. We'll probably make the header file later then?
> > diff --git a/libavcodec/pgxdec.c b/libavcodec/pgxdec.c
> > new file mode 100644
> > index 00..233bf34717
> > --- /dev/null
> > +++ b/libavcodec/pgxdec.c
> > @@ -0,0 +1,176 @@
> > +/*
> > + * PGX image format
> > + * Copyright (c) 2020 Gautam Ramakrishnan
> > + *
> > + * 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
>

[FFmpeg-devel] [Result] General Assembly extra members

2020-06-25 Thread Jean-Baptiste Kempf
Hello,

The 3 extra members have been elected to the General Assembly the vote that 
happened online.

FYI: 26 people voted out of 49 people.

The next vote will have those 3 people added to the list of voters.

Thanks for the participation!

Best,

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
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] [Result] General Assembly extra members

2020-06-25 Thread Jean-Baptiste Kempf
On Thu, Jun 25, 2020, at 10:59, Jean-Baptiste Kempf wrote:
> Hello,
> 
> The 3 extra members have been elected to the General Assembly the vote 
> that happened online.
> 
> FYI: 26 people voted out of 49 people.

The full results can be found here:
https://vote.ffmpeg.org/cgi-bin/civs/results.pl?id=E_1d588e0a1379a502

Best,

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
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] avformat/mov: fix missing line break in messages

2020-06-25 Thread Moritz Barsnick
One of them can be triggered by https://samples.ffmpeg.org/F4V/H263_NM_f.mp4.

Signed-off-by: Moritz Barsnick 
---
 libavformat/mov.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index adc52de947..40fff5dd7d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -894,7 +894,7 @@ static int mov_read_ddts(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 (frame_duration_code == 3) ? 4096 : 0;

 if (channel_layout_code > 0xff) {
-av_log(c->fc, AV_LOG_WARNING, "Unsupported DTS audio channel layout");
+av_log(c->fc, AV_LOG_WARNING, "Unsupported DTS audio channel 
layout\n");
 }
 st->codecpar->channel_layout =
 ((channel_layout_code & 0x1) ? AV_CH_FRONT_CENTER : 0) |
@@ -5219,7 +5219,7 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 } else {
 edit_count = atom.size / elst_entry_size;
 if (edit_count * elst_entry_size != atom.size) {
-av_log(c->fc, AV_LOG_WARNING, "ELST atom of %"PRId64" bytes, 
bigger than %d entries.", atom.size, edit_count);
+av_log(c->fc, AV_LOG_WARNING, "ELST atom of %"PRId64" bytes, 
bigger than %d entries.\n", atom.size, edit_count);
 }
 }
 }
--
2.26.2

___
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] Add VDPAU to list of supported formats

2020-06-25 Thread ManojGuptaBonda
Added VDPAU to list of supported formats for HEVC10 and 12 bit formats
also added 42010 bit to surface_parameters and new VDP chroma formats to
VDPAUPixFmtMaps

Add HEVC 420 10/12 Bit  and 444 10/12 Bit support for VDPAU


YUV444P10 is defined as the 444 surface with 10bit valid data in LSBs
but H/w returns Data in MSBs Hence if we map output as YUV444p16 it
is filtering out the LSB to convert to p10 format.
---
 libavcodec/hevcdec.c|  6 ++
 libavcodec/vdpau.c  |  4 
 libavutil/hwcontext_vdpau.c | 13 +++--
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index c9e28f5826..e576cce5de 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -414,6 +414,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const 
HEVCSPS *sps)
 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
 *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
 #endif
+#if CONFIG_HEVC_VDPAU_HWACCEL
+*fmt++ = AV_PIX_FMT_VDPAU;
+#endif
 #if CONFIG_HEVC_NVDEC_HWACCEL
 *fmt++ = AV_PIX_FMT_CUDA;
 #endif
@@ -435,6 +438,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const 
HEVCSPS *sps)
 case AV_PIX_FMT_YUV420P12:
 case AV_PIX_FMT_YUV444P10:
 case AV_PIX_FMT_YUV444P12:
+#if CONFIG_HEVC_VDPAU_HWACCEL
+*fmt++ = AV_PIX_FMT_VDPAU;
+#endif
 #if CONFIG_HEVC_NVDEC_HWACCEL
 *fmt++ = AV_PIX_FMT_CUDA;
 #endif
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index 167f06d7ae..fa10905c75 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -83,6 +83,8 @@ int av_vdpau_get_surface_parameters(AVCodecContext *avctx,
 switch (avctx->sw_pix_fmt) {
 case AV_PIX_FMT_YUV420P:
 case AV_PIX_FMT_YUVJ420P:
+case AV_PIX_FMT_YUV420P10:
+case AV_PIX_FMT_YUV420P12:
 t = VDP_CHROMA_TYPE_420;
 w = (w + 1) & ~1;
 h = (h + 3) & ~3;
@@ -95,6 +97,8 @@ int av_vdpau_get_surface_parameters(AVCodecContext *avctx,
 break;
 case AV_PIX_FMT_YUV444P:
 case AV_PIX_FMT_YUVJ444P:
+case AV_PIX_FMT_YUV444P10:
+case AV_PIX_FMT_YUV444P12:
 t = VDP_CHROMA_TYPE_444;
 h = (h + 1) & ~1;
 break;
diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c
index 6b8c1d5f76..6061476094 100644
--- a/libavutil/hwcontext_vdpau.c
+++ b/libavutil/hwcontext_vdpau.c
@@ -39,8 +39,8 @@ typedef struct VDPAUDeviceContext {
 VdpVideoSurfaceCreate   *surf_create;
 VdpVideoSurfaceDestroy  *surf_destroy;
 
-enum AVPixelFormat *pix_fmts[3];
-int  nb_pix_fmts[3];
+enum AVPixelFormat *pix_fmts[8];
+int  nb_pix_fmts[8];
 } VDPAUDeviceContext;
 
 typedef struct VDPAUFramesContext {
@@ -61,6 +61,8 @@ typedef struct VDPAUPixFmtMap {
 static const VDPAUPixFmtMap pix_fmts_420[] = {
 { VDP_YCBCR_FORMAT_NV12, AV_PIX_FMT_NV12},
 { VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV420P },
+{ VDP_YCBCR_FORMAT_P016, AV_PIX_FMT_P016},
+{ VDP_YCBCR_FORMAT_P010, AV_PIX_FMT_P010},
 { 0, AV_PIX_FMT_NONE,   },
 };
 
@@ -75,6 +77,7 @@ static const VDPAUPixFmtMap pix_fmts_422[] = {
 static const VDPAUPixFmtMap pix_fmts_444[] = {
 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
 { VDP_YCBCR_FORMAT_Y_U_V_444, AV_PIX_FMT_YUV444P },
+{VDP_YCBCR_FORMAT_Y_U_V_444_16, AV_PIX_FMT_YUV444P16},
 #endif
 { 0,  AV_PIX_FMT_NONE,   },
 };
@@ -87,6 +90,11 @@ static const struct {
 { VDP_CHROMA_TYPE_420, AV_PIX_FMT_YUV420P, pix_fmts_420 },
 { VDP_CHROMA_TYPE_422, AV_PIX_FMT_YUV422P, pix_fmts_422 },
 { VDP_CHROMA_TYPE_444, AV_PIX_FMT_YUV444P, pix_fmts_444 },
+{ VDP_CHROMA_TYPE_420_16, AV_PIX_FMT_YUV420P10, pix_fmts_420 },
+{ VDP_CHROMA_TYPE_420_16, AV_PIX_FMT_YUV420P12, pix_fmts_420 },
+{ VDP_CHROMA_TYPE_422_16, AV_PIX_FMT_YUV422P, pix_fmts_422 },
+{ VDP_CHROMA_TYPE_444_16, AV_PIX_FMT_YUV444P10, pix_fmts_444 },
+{ VDP_CHROMA_TYPE_444_16, AV_PIX_FMT_YUV444P12, pix_fmts_444 },
 };
 
 static int count_pixfmts(const VDPAUPixFmtMap *map)
@@ -354,6 +362,7 @@ static int vdpau_transfer_data_from(AVHWFramesContext *ctx, 
AVFrame *dst,
 if ((vdpau_format == VDP_YCBCR_FORMAT_YV12)
 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
 || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444)
+|| (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444_16)
 #endif
 )
 FFSWAP(void*, data[1], data[2]);
-- 
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".

[FFmpeg-devel] [PATCH 0/2] VDPAU HEVC 10/12 Bit Decode Support

2020-06-25 Thread ManojGuptaBonda
NVIDIA R450 driver added VDPAU support for HEVC 10/12 bit Decoding
adding the same in ffmpeg

ManojGuptaBonda (2):
  lavc/vdpau_hevc: add function to find exact vdp_profile for REXT
  Add VDPAU to list of supported formats

 libavcodec/Makefile |  2 +-
 libavcodec/hevcdec.c|  6 +++
 libavcodec/vdpau.c  |  4 ++
 libavcodec/vdpau_hevc.c | 83 -
 libavutil/hwcontext_vdpau.c | 13 +-
 5 files changed, 104 insertions(+), 4 deletions(-)

-- 
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".

[FFmpeg-devel] [PATCH 1/2] lavc/vdpau_hevc: add function to find exact vdp_profile for REXT

2020-06-25 Thread ManojGuptaBonda
Add vdpau_parse_rext_profile and use profile constraint flags to
determine the exact vdp_profile for HEVC_REXT.

If profile mismatch is allowed, select Main profile by default.

Add build object in Makefile for h265_profile_level dependency.
---
 libavcodec/Makefile |  2 +-
 libavcodec/vdpau_hevc.c | 83 -
 2 files changed, 83 insertions(+), 2 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 5a6ea59715..4f28cb0f2a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -910,7 +910,7 @@ OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o
 OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o
 OBJS-$(CONFIG_HEVC_QSV_HWACCEL)   += qsvdec_h2645.o
 OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o h265_profile_level.o
-OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o
+OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o h265_profile_level.o
 OBJS-$(CONFIG_MJPEG_NVDEC_HWACCEL)+= nvdec_mjpeg.o
 OBJS-$(CONFIG_MJPEG_VAAPI_HWACCEL)+= vaapi_mjpeg.o
 OBJS-$(CONFIG_MPEG1_NVDEC_HWACCEL)+= nvdec_mpeg12.o
diff --git a/libavcodec/vdpau_hevc.c b/libavcodec/vdpau_hevc.c
index 29cb2da078..1ee781c685 100644
--- a/libavcodec/vdpau_hevc.c
+++ b/libavcodec/vdpau_hevc.c
@@ -29,6 +29,8 @@
 #include "hwconfig.h"
 #include "vdpau.h"
 #include "vdpau_internal.h"
+#include "h265_profile_level.h"
+
 
 static int vdpau_hevc_start_frame(AVCodecContext *avctx,
   const uint8_t *buffer, uint32_t size)
@@ -429,10 +431,87 @@ static int vdpau_hevc_end_frame(AVCodecContext *avctx)
 return 0;
 }
 
+
+
+static int ptl_convert(const PTLCommon *general_ptl, H265RawProfileTierLevel 
*h265_raw_ptl)
+{
+h265_raw_ptl->general_profile_space = general_ptl->profile_space;
+h265_raw_ptl->general_tier_flag = general_ptl->tier_flag;
+h265_raw_ptl->general_profile_idc   = general_ptl->profile_idc;
+
+memcpy(h265_raw_ptl->general_profile_compatibility_flag,
+  general_ptl->profile_compatibility_flag, 32 
* sizeof(uint8_t));
+
+#define copy_field(name) h265_raw_ptl->general_ ## name = general_ptl->name
+copy_field(progressive_source_flag);
+copy_field(interlaced_source_flag);
+copy_field(non_packed_constraint_flag);
+copy_field(frame_only_constraint_flag);
+copy_field(max_12bit_constraint_flag);
+copy_field(max_10bit_constraint_flag);
+copy_field(max_8bit_constraint_flag);
+copy_field(max_422chroma_constraint_flag);
+copy_field(max_420chroma_constraint_flag);
+copy_field(max_monochrome_constraint_flag);
+copy_field(intra_constraint_flag);
+copy_field(one_picture_only_constraint_flag);
+copy_field(lower_bit_rate_constraint_flag);
+copy_field(max_14bit_constraint_flag);
+copy_field(inbld_flag);
+copy_field(level_idc);
+#undef copy_field
+
+return 0;
+}
+
+/*
+ * Find exact vdpau_profile for HEVC Range Extension
+ */
+static int vdpau_hevc_parse_rext_profile(AVCodecContext *avctx, 
VdpDecoderProfile *vdp_profile)
+{
+const HEVCContext *h = avctx->priv_data;
+const HEVCSPS *sps = h->ps.sps;
+const PTL *ptl = &sps->ptl;
+const PTLCommon *general_ptl = &ptl->general_ptl;
+const H265ProfileDescriptor *profile;
+H265RawProfileTierLevel h265_raw_ptl = {0};
+
+/* convert PTLCommon to H265RawProfileTierLevel */
+ptl_convert(general_ptl, &h265_raw_ptl);
+
+profile = ff_h265_get_profile(&h265_raw_ptl);
+if (!profile) {
+av_log(avctx, AV_LOG_WARNING, "HEVC profile is not found.\n");
+if (avctx->hwaccel_flags & AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH) {
+// Default to selecting Main profile if profile mismatch is allowed
+*vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN;
+return 0;
+} else
+return AVERROR(ENOTSUP);
+}
+
+if (!strcmp(profile->name, "Main 12") ||
+!strcmp(profile->name, "Main 12 Intra"))
+*vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN_12;
+else if (!strcmp(profile->name, "Main 4:4:4") ||
+ !strcmp(profile->name, "Main 4:4:4 Intra"))
+*vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN_444;
+else if (!strcmp(profile->name, "Main 4:4:4 10") ||
+ !strcmp(profile->name, "Main 4:4:4 10 Intra"))
+*vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN_444_10;
+else if (!strcmp(profile->name, "Main 4:4:4 12") ||
+ !strcmp(profile->name, "Main 4:4:4 12 Intra"))
+*vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN_444_12;
+
+return 0;
+}
+
+
 static int vdpau_hevc_init(AVCodecContext *avctx)
 {
 VdpDecoderProfile profile;
 uint32_t level = avctx->level;
+int ret;
 
 switch (avctx->profile) {
 case FF_PROFILE_HEVC_MAIN:
@@ -445,7 +524,9 @@ static int vdpau_hevc_init(AVCodecContext *avctx)
 profile = VDP_DECODER_PROFILE_HEVC_MAIN_STILL;
 break;
 case FF_PROFILE_HEVC_

Re: [FFmpeg-devel] [PATCH] avformat/mov: fix missing line break in messages

2020-06-25 Thread myp...@gmail.com
On Thu, Jun 25, 2020 at 6:46 PM Moritz Barsnick  wrote:
>
> One of them can be triggered by https://samples.ffmpeg.org/F4V/H263_NM_f.mp4.
>
> Signed-off-by: Moritz Barsnick 
> ---
>  libavformat/mov.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index adc52de947..40fff5dd7d 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -894,7 +894,7 @@ static int mov_read_ddts(MOVContext *c, AVIOContext *pb, 
> MOVAtom atom)
>  (frame_duration_code == 3) ? 4096 : 0;
>
>  if (channel_layout_code > 0xff) {
> -av_log(c->fc, AV_LOG_WARNING, "Unsupported DTS audio channel 
> layout");
> +av_log(c->fc, AV_LOG_WARNING, "Unsupported DTS audio channel 
> layout\n");
>  }
>  st->codecpar->channel_layout =
>  ((channel_layout_code & 0x1) ? AV_CH_FRONT_CENTER : 0) |
> @@ -5219,7 +5219,7 @@ static int mov_read_elst(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  } else {
>  edit_count = atom.size / elst_entry_size;
>  if (edit_count * elst_entry_size != atom.size) {
> -av_log(c->fc, AV_LOG_WARNING, "ELST atom of %"PRId64" bytes, 
> bigger than %d entries.", atom.size, edit_count);
> +av_log(c->fc, AV_LOG_WARNING, "ELST atom of %"PRId64" bytes, 
> bigger than %d entries.\n", atom.size, edit_count);
>  }
>  }
>  }
> --
> 2.26.2
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 v4 0/6] adpcm_ima_apm encoder + apm muxer

2020-06-25 Thread Zane van Iperen
On Sat, 20 Jun 2020 10:59:09 +
"Zane van Iperen"  wrote:

> 
> Add support for encoding adpcm_ima_apm and muxing to apm.
> 
Ping.

Zane

___
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] avdevice/xcbgrab: Add select_region option.

2020-06-25 Thread Omar Emara
This patch adds a select_region option to the xcbgrab input device.
If set to 1, the user will be prompted to select the grabbing area
graphically by clicking and dragging. A rectangle will be drawn to
mark the grabbing area. A single click with no dragging will select
the whole screen. The option overwrites the video_size, grab_x, and
grab_y options if set by the user.

For testing, just set the select_region option as follows:

ffmpeg -f x11grab -select_region 1 -i :0.0 output.mp4

The drawing happens directly on the root window using standard rubber
banding techniques, so it is very efficient and doesn't depend on any
X extensions or compositors.

Signed-off-by: Omar Emara 
---
 doc/indevs.texi   |   7 +++
 libavdevice/xcbgrab.c | 122 ++
 2 files changed, 129 insertions(+)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 6f5afaf344..b5df111801 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -1478,6 +1478,13 @@ ffmpeg -f x11grab -framerate 25 -video_size cif -i 
:0.0+10,20 out.mpg
 @subsection Options
 
 @table @option
+@item select_region
+Specify whether to select the grabbing area graphically using the pointer.
+A value of @code{1} prompts the user to select the grabbing area graphically
+by clicking and dragging. A single click with no dragging will select the
+whole screen. This option overwrites the @var{video_size}, @var{grab_x},
+and @var{grab_y} options. Default value is @code{0}.
+
 @item draw_mouse
 Specify whether to draw the mouse pointer. A value of @code{0} specifies
 not to draw the pointer. Default value is @code{1}.
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index 6f6b2dbf15..a65944cbcd 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -22,6 +22,7 @@
 #include "config.h"
 
 #include 
+#include 
 #include 
 
 #if CONFIG_LIBXCB_XFIXES
@@ -69,6 +70,7 @@ typedef struct XCBGrabContext {
 int show_region;
 int region_border;
 int centered;
+int select_region;
 
 const char *framerate;
 
@@ -92,6 +94,7 @@ static const AVOption options[] = {
 { "centered", "Keep the mouse pointer at the center of grabbing region 
when following.", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, INT_MIN, INT_MAX, D, 
"follow_mouse" },
 { "show_region", "Show the grabbing region.", OFFSET(show_region), 
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
 { "region_border", "Set the region border thickness.", 
OFFSET(region_border), AV_OPT_TYPE_INT, { .i64 = 3 }, 1, 128, D },
+{ "select_region", "Select the grabbing region graphically using the 
pointer.", OFFSET(select_region), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
 { NULL },
 };
 
@@ -668,6 +671,117 @@ static void setup_window(AVFormatContext *s)
 draw_rectangle(s);
 }
 
+#define CROSSHAIR_CURSOR 34
+
+typedef struct {
+int16_t x;
+int16_t y;
+} Position;
+
+static xcb_rectangle_t rectangle_from_corners(Position *corner_a, Position 
*corner_b) {
+xcb_rectangle_t rectangle;
+if (corner_a->x < corner_b->x) {
+rectangle.x = corner_a->x;
+rectangle.width = corner_b->x - corner_a->x;
+} else {
+rectangle.x = corner_b->x;
+rectangle.width = corner_a->x - corner_b->x;
+}
+if (corner_a->y < corner_b->y) {
+rectangle.y = corner_a->y;
+rectangle.height = corner_b->y - corner_a->y;
+} else {
+rectangle.y = corner_b->y;
+rectangle.height = corner_a->y - corner_b->y;
+}
+return rectangle;
+}
+
+static xcb_rectangle_t select_region(xcb_connection_t *connection,
+ xcb_screen_t *screen) {
+int done = 0;
+int was_drawn = 0;
+int was_pressed = 0;
+xcb_cursor_t cursor;
+xcb_font_t cursor_font;
+Position press_position;
+xcb_generic_event_t *event;
+xcb_rectangle_t old_rectangle;
+
+xcb_window_t root_window = screen->root;
+xcb_gcontext_t graphics_context = xcb_generate_id(connection);
+uint32_t graphics_context_mask = XCB_GC_FUNCTION | XCB_GC_SUBWINDOW_MODE;
+uint32_t graphics_context_values[] = {XCB_GX_INVERT,
+  
XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS};
+xcb_create_gc(connection, graphics_context, root_window,
+  graphics_context_mask, graphics_context_values);
+
+cursor_font = xcb_generate_id(connection);
+xcb_open_font(connection, cursor_font, strlen("cursor"), "cursor");
+cursor = xcb_generate_id(connection);
+xcb_create_glyph_cursor(connection, cursor, cursor_font, cursor_font,
+CROSSHAIR_CURSOR, CROSSHAIR_CURSOR + 1, 0, 0, 0,
+0x, 0x, 0x);
+xcb_grab_pointer(connection, 0, root_window,
+ XCB_EVENT_MASK_BUTTON_PRESS |
+ XCB_EVENT_MASK_BUTTON_RELEASE |
+ XCB_EVENT_MASK_BUTTON_MOTION,
+ XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
+ root_wind

Re: [FFmpeg-devel] [PATCH v2] avcodec/mpeg12dec: switch to AVBufferRef buffer for a53 caption

2020-06-25 Thread lance . lmwang
On Sun, Jun 21, 2020 at 09:30:12PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
> It's old patch, rebase with master, now have tested with the mpeg2 sample
> for ticket 6105, the output srt is same.
> 
>  libavcodec/mpeg12dec.c | 85 
> --
>  1 file changed, 40 insertions(+), 45 deletions(-)
> 
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 1253bde..f0f92ac 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -57,8 +57,7 @@ typedef struct Mpeg1Context {
>  AVPanScan pan_scan; /* some temporary storage for the panscan */
>  AVStereo3D stereo3d;
>  int has_stereo3d;
> -uint8_t *a53_caption;
> -int a53_caption_size;
> +AVBufferRef *a53_buf_ref;
>  uint8_t afd;
>  int has_afd;
>  int slice_count;
> @@ -1635,13 +1634,13 @@ static int mpeg_field_start(MpegEncContext *s, const 
> uint8_t *buf, int buf_size)
>  return AVERROR(ENOMEM);
>  memcpy(pan_scan->data, &s1->pan_scan, sizeof(s1->pan_scan));
>  
> -if (s1->a53_caption) {
> -AVFrameSideData *sd = av_frame_new_side_data(
> +if (s1->a53_buf_ref) {
> +AVFrameSideData *sd = av_frame_new_side_data_from_buf(
>  s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC,
> -s1->a53_caption_size);
> -if (sd)
> -memcpy(sd->data, s1->a53_caption, s1->a53_caption_size);
> -av_freep(&s1->a53_caption);
> +s1->a53_buf_ref);
> +if (!sd)
> +av_buffer_unref(&s1->a53_buf_ref);
> +s1->a53_buf_ref = NULL;
>  }
>  
>  if (s1->has_stereo3d) {
> @@ -2242,26 +2241,18 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
>  /* extract A53 Part 4 CC data */
>  int cc_count = p[5] & 0x1f;
>  if (cc_count > 0 && buf_size >= 7 + cc_count * 3) {
> -if (s1->a53_caption && s1->a53_caption_size > 0) {
> -uint8_t *old_a53_caption = s1->a53_caption;
> -int old_a53_caption_size = s1->a53_caption_size;
> -
> -s1->a53_caption_size = old_a53_caption_size + cc_count * 3;
> -s1->a53_caption  = av_malloc(s1->a53_caption_size);
> -if (s1->a53_caption) {
> -memcpy(s1->a53_caption, old_a53_caption, 
> old_a53_caption_size);
> -memcpy(s1->a53_caption + old_a53_caption_size, p + 7, 
> cc_count * 3);
> -}
> -av_freep(&old_a53_caption);
> -} else {
> -s1->a53_caption_size = cc_count * 3;
> -s1->a53_caption  = av_malloc(s1->a53_caption_size);
> -if (s1->a53_caption)
> -memcpy(s1->a53_caption, p + 7, s1->a53_caption_size);
> -}
> -if (!s1->a53_caption) {
> -s1->a53_caption_size = 0;
> -}
> +int old_size = s1->a53_buf_ref ? s1->a53_buf_ref->size : 0;
> +const uint64_t new_size = (old_size + cc_count
> +* UINT64_C(3));
> +int ret;
> +
> +if (new_size > INT_MAX)
> +return AVERROR(EINVAL);
> +
> +ret = av_buffer_realloc(&s1->a53_buf_ref, new_size);
> +if (ret >= 0)
> +memcpy(s1->a53_buf_ref->data + old_size, p + 7, cc_count * 
> UINT64_C(3));
> +
>  avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
>  }
>  return 1;
> @@ -2270,19 +2261,21 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
>  /* extract SCTE-20 CC data */
>  GetBitContext gb;
>  int cc_count = 0;
> -int i;
> +int i, ret;
>  
>  init_get_bits(&gb, p + 2, buf_size - 2);
>  cc_count = get_bits(&gb, 5);
>  if (cc_count > 0) {
> -av_freep(&s1->a53_caption);
> -s1->a53_caption_size = cc_count * 3;
> -s1->a53_caption  = av_mallocz(s1->a53_caption_size);
> -if (!s1->a53_caption) {
> -s1->a53_caption_size = 0;
> -} else {
> +int old_size = s1->a53_buf_ref ? s1->a53_buf_ref->size : 0;
> +const uint64_t new_size = (old_size + cc_count
> +* UINT64_C(3));
> +if (new_size > INT_MAX)
> +return AVERROR(EINVAL);
> +
> +ret = av_buffer_realloc(&s1->a53_buf_ref, new_size);
> +if (ret >= 0) {
>  uint8_t field, cc1, cc2;
> -uint8_t *cap = s1->a53_caption;
> +uint8_t *cap = s1->a53_buf_ref->data;
>  for (i = 0; i < cc_count && get_bits_left(&gb) >= 26; i++) {
>  skip_bits(&gb, 2); // priority
>  field = get_bits(&gb, 2);
> @@ -23

[FFmpeg-devel] [PATCH]libavfilter/asrc_atone.c : generate algorithmic music

2020-06-25 Thread Ashutosh Pradhan
Generate algorithmic riff music. Changed to activate api.

 Changelog|   2 +-
 configure|   4 +
 doc/filters.texi |  56 ++
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/asrc_atone.c | 474 +++
 libavfilter/notedef.h| 264 ++
 libavfilter/version.h|   2 +-
 8 files changed, 802 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index a60e7d2eb8..ec12027740 100644
--- a/Changelog
+++ b/Changelog
@@ -80,7 +80,7 @@ version 4.3:
 - PFM decoder
 - dblur video filter
 - Real War KVAG muxer
-
+- atone filter
 
 version 4.2:
 - tpad filter
diff --git a/configure b/configure
index 7495f35faa..825e38a4b0 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable libfluidsynth support for fluidsynth [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1772,6 +1773,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3486,6 +3488,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+atone_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6307,6 +6310,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index 3c2dd2eb90..8733b52a2f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6128,6 +6128,62 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
 @end example
 @end itemize
 
+@section atone
+
+Generate algorithmic riff music.
+To compile filter configure ffmpeg with @code{--enable-libfluidsynth} 
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Specify the sample rate. Default value is 44100 Hz.
+
+@item sfont
+Specify the location of soundfont file. Default value is 
+"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for linux).
+
+@item duration, d
+Specify the duration of the generated audio stream. Not specifying this option
+results in playing tones for infinite length.
+
+@item velocity, v
+Specify the velocity of key press. Default value is 80.
+
+@item percussion_velocity
+Specify the velocity of key press for percussion track. Default value is 127.
+
+@item bpm
+Specify the beats per minute. Default is 100.
+
+@item instrument
+Specify the instrument. Available instruments are Acoustic-Grand, 
+Bright-Acoustic, ... as defined in the General Midi specifications. Default is 
Trumpet.
+
+@item percussion
+Specify the percussion track for beats. Available options are Jazz1, 
+Jazz2, ..., Jazz6, Rock1...4, Shuffle, Metronome. Default is Metronome.
+
+@item numbars
+Set the number of bars in which riff energy will change between 0 to 8. 
Default is 2.
+
+@item samples_per_frame
+Set the number of samples per each output frame. Default is 1024.
+@end table
+
+@subsection Examples
+
+@itemize
+
+@item
+Generate 10 seconds of riff music, with a key velocity of 100, instrument as 
Electric Guitar(jazz) 
+and percussion track as Jazz3:
+@example
+atone=d=10:v=100:sfont="example.sf2":instrument=Electric-Guitar-Jazz:percussion=Jazz3
+atone=duration=10:velocity=100:sfont="example.sf2":instrument=Electric-Guitar-Jazz:percussion=Jazz3
+@end example
+@end itemize
+
 @section hilbert
 
 Generate odd-tap Hilbert transform FIR coefficients.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5123540653..b0938830f2 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -152,6 +152,7 @@ OBJS-$(CONFIG_FLITE_FILTER)  += asrc_flite.o
 OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
 OBJS-$(CONFIG_SINC_FIL

[FFmpeg-devel] [PATCH v3] avcodec/libaomenc.c: Add super-resolution options to libaom wrapper

2020-06-25 Thread Wang Cao
From: Wang Cao 

Signed-off-by: Wang Cao 
---
Updated to use the enum defined in libaom for super-resolution.
 doc/encoders.texi  | 39 +++
 libavcodec/libaomenc.c | 38 ++
 libavcodec/version.h   |  2 +-
 3 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 17a0f4c821..045535accb 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1599,6 +1599,45 @@ Enable the use of global motion for block prediction. 
Default is true.
 Enable block copy mode for intra block prediction. This mode is
 useful for screen content. Default is true.
 
+@item enable-superres (@emph{boolean})
+Enable super-resolution during the encoding process.
+
+@item superres-mode (@emph{mode})
+Select super-resolution mode.
+
+@table @option
+@item none (@emph{0})
+No frame superres allowed.
+
+@item fixed (@emph{1})
+All frames are coded at the specified scale and super-resolved.
+
+@item random (@emph{2})
+All frames are coded at a random scale and super-resolved.
+
+@item qthresh (@emph{3})
+Superres scale for a frame is determined based on q_index.
+
+@item auto (@emph{4})
+Automatically select superres for appropriate frames.
+@end table
+
+@item superres_denominator
+The denominator for superres to use when @option{superres-mode} is 
@option{fixed}.
+Valid value ranges from 8 to 16.
+
+@item superres_kf_denominator
+The denominator for superres to use on key frames when
+@option{superres-mode} is @option{fixed}. Valid value ranges from 8 to 16.
+
+@item superres_qthresh
+The q level threshold after which superres is used when @option{superres-mode}
+is @option{qthresh}. Valid value ranges from 1 to 63.
+
+@item superres_kf_qthresh
+The q level threshold after which superres is used for key frames when
+@option{superres-mode} is @option{qthresh}. Valid value ranges from 1 to 63.
+
 @end table
 
 @section libkvazaar
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 1c78da719a..17e130d8ec 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -96,6 +96,12 @@ typedef struct AOMEncoderContext {
 int enable_restoration;
 int usage;
 int tune;
+int enable_superres;
+int superres_mode;
+int superres_denominator;
+int superres_qthresh;
+int superres_kf_denominator;
+int superres_kf_qthresh;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -135,6 +141,7 @@ static const char *const ctlidstr[] = {
 #endif
 [AV1E_SET_ENABLE_CDEF]  = "AV1E_SET_ENABLE_CDEF",
 [AOME_SET_TUNING]   = "AOME_SET_TUNING",
+[AV1E_SET_ENABLE_SUPERRES]  = "AV1E_SET_ENABLE_SUPERRES",
 };
 
 static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -204,6 +211,13 @@ static av_cold void dump_enc_cfg(AVCodecContext *avctx,
width, "tile_width_count:",  cfg->tile_width_count,
width, "tile_height_count:", cfg->tile_height_count);
 av_log(avctx, level, "\n");
+av_log(avctx, level, "super resolution settings\n"
+ "  %*s%u\n  %*s%u\n  %*s%u\n  %*s%u\n  %*s%u\n  ",
+   width, "rc_superres_mode:",   cfg->rc_superres_mode,
+   width, "rc_superres_denominator:",cfg->rc_superres_denominator,
+   width, "rc_superres_qthresh:",cfg->rc_superres_qthresh,
+   width, "rc_superres_kf_denominator:", 
cfg->rc_superres_kf_denominator,
+   width, "rc_superres_kf_qthresh:", cfg->rc_superres_kf_qthresh);
 }
 
 static void coded_frame_add(void *list, struct FrameListData *cx_frame)
@@ -546,6 +560,17 @@ static av_cold int aom_init(AVCodecContext *avctx,
 return AVERROR(EINVAL);
 }
 
+if (ctx->superres_mode >= 0)
+enccfg.rc_superres_mode = ctx->superres_mode;
+if (ctx->superres_qthresh > 0)
+enccfg.rc_superres_qthresh = ctx->superres_qthresh;
+if (ctx->superres_kf_qthresh > 0)
+enccfg.rc_superres_kf_qthresh = ctx->superres_kf_qthresh;
+if (ctx->superres_denominator >= 8)
+enccfg.rc_superres_denominator = ctx->superres_denominator;
+if (ctx->superres_kf_denominator >= 8)
+enccfg.rc_superres_kf_denominator = ctx->superres_kf_denominator;
+
 dump_enc_cfg(avctx, &enccfg);
 
 enccfg.g_w= avctx->width;
@@ -688,6 +713,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
 // codec control failures are currently treated only as warnings
 av_log(avctx, AV_LOG_DEBUG, "aom_codec_control\n");
 codecctl_int(avctx, AOME_SET_CPUUSED, ctx->cpu_used);
+if (ctx->enable_superres >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_SUPERRES, ctx->enable_superres);
 if (ctx->auto_alt_ref >= 0)
 codecctl_int(avctx, AOME_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref);
 if (ctx->arnr_max_frames >= 0)
@@ -1107,6 +1134,17 @@ static const AVOption options[] = {
 { "tune","The metric that the encoder tunes for. Automati

[FFmpeg-devel] [PATCH] avcodec/pngdec: Check for fctl after idat

2020-06-25 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
23554/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-4796622520451072.fuzz

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

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index ff3882a58d..647e7f0a74 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -984,6 +984,11 @@ static int decode_fctl_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 return AVERROR_INVALIDDATA;
 }
 
+if (s->pic_state & PNG_IDAT) {
+av_log(avctx, AV_LOG_ERROR, "fctl after IDAT\n");
+return AVERROR_INVALIDDATA;
+}
+
 s->last_w = s->cur_w;
 s->last_h = s->cur_h;
 s->last_x_offset = s->x_offset;
-- 
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".

[FFmpeg-devel] [PATCH 3/3] fftools/ffmpeg: get EOF timestamp from filter.

2020-06-25 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 fftools/ffmpeg.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)


This breaks fate-lagarith-ticket4119-cfr. I have decided to leave it.

The new output is more correct. The input ends with:
pts_time=2.00
duration_time=0.04
It is right that the output file ends at 2.04, not at 3.00.

I did not change the ref file, because it was there for something: there
may be a bug to fix for ticket 4119, but the fix that was done was
wrong.

In fact, I suspect 9f6d48d696d679de77e8cb513d5f64cd708ed86f should be
reverted entirely.

Or we could just drop this chunk of code and insert the fps filter.


diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 3919f2ab62..b1c7745d93 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1075,7 +1075,7 @@ static void do_video_out(OutputFile *of,
 duration = lrintf(next_picture->pkt_duration * 
av_q2d(ist->st->time_base) / av_q2d(enc->time_base));
 }
 
-if (!next_picture) {
+if (!next_picture && sync_ipts == AV_NOPTS_VALUE) {
 //end, flushing
 nb0_frames = nb_frames = mid_pred(ost->last_nb0_frames[0],
   ost->last_nb0_frames[1],
@@ -1152,6 +1152,8 @@ static void do_video_out(OutputFile *of,
 default:
 av_assert0(0);
 }
+if (!next_picture)
+nb0_frames = FFMAX(nb_frames, 1) - 1;
 }
 
 nb_frames = FFMIN(nb_frames, ost->max_frames - ost->frame_number);
@@ -1477,8 +1479,11 @@ static int reap_filters(int flush)
 av_log(NULL, AV_LOG_WARNING,
"Error in av_buffersink_get_frame_flags(): %s\n", 
av_err2str(ret));
 } else if (flush && ret == AVERROR_EOF) {
-if (av_buffersink_get_type(filter) == AVMEDIA_TYPE_VIDEO)
-do_video_out(of, ost, NULL, AV_NOPTS_VALUE);
+if (av_buffersink_get_type(filter) == AVMEDIA_TYPE_VIDEO) {
+int64_t pts = av_buffersink_get_pts(filter);
+float_pts = 
compute_encoder_pts_from_filter_pts(filter, of, enc, &pts);
+do_video_out(of, ost, NULL, float_pts);
+}
 }
 break;
 }
-- 
2.27.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] fftools/ffmpeg: move filter/encoder PTS computation to a separate function.

2020-06-25 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 fftools/ffmpeg.c | 45 +++--
 1 file changed, 27 insertions(+), 18 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 2e9448ea2b..3919f2ab62 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1404,6 +1404,32 @@ static void finish_output_stream(OutputStream *ost)
 }
 }
 
+static double compute_encoder_pts_from_filter_pts(AVFilterContext *filter, 
OutputFile *of,
+  AVCodecContext *enc, int64_t 
*filtered_frame_pts)
+{
+double float_pts = AV_NOPTS_VALUE;
+
+if (*filtered_frame_pts != AV_NOPTS_VALUE) {
+int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : 
of->start_time;
+AVRational filter_tb = av_buffersink_get_time_base(filter);
+AVRational tb = enc->time_base;
+int extra_bits = av_clip(29 - av_log2(tb.den), 0, 16);
+
+tb.den <<= extra_bits;
+float_pts =
+av_rescale_q(*filtered_frame_pts, filter_tb, tb) -
+av_rescale_q(start_time, AV_TIME_BASE_Q, tb);
+float_pts /= 1 << extra_bits;
+// avoid exact midoints to reduce the chance of rounding differences, 
this can be removed in case the fps code is changed to work with integers
+float_pts += FFSIGN(float_pts) * 1.0 / (1<<17);
+
+*filtered_frame_pts =
+av_rescale_q(*filtered_frame_pts, filter_tb, enc->time_base) -
+av_rescale_q(start_time, AV_TIME_BASE_Q, enc->time_base);
+}
+return float_pts;
+}
+
 /**
  * Get and encode new output from any of the filtergraphs, without causing
  * activity.
@@ -1460,24 +1486,7 @@ static int reap_filters(int flush)
 av_frame_unref(filtered_frame);
 continue;
 }
-if (filtered_frame->pts != AV_NOPTS_VALUE) {
-int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : 
of->start_time;
-AVRational filter_tb = av_buffersink_get_time_base(filter);
-AVRational tb = enc->time_base;
-int extra_bits = av_clip(29 - av_log2(tb.den), 0, 16);
-
-tb.den <<= extra_bits;
-float_pts =
-av_rescale_q(filtered_frame->pts, filter_tb, tb) -
-av_rescale_q(start_time, AV_TIME_BASE_Q, tb);
-float_pts /= 1 << extra_bits;
-// avoid exact midoints to reduce the chance of rounding 
differences, this can be removed in case the fps code is changed to work with 
integers
-float_pts += FFSIGN(float_pts) * 1.0 / (1<<17);
-
-filtered_frame->pts =
-av_rescale_q(filtered_frame->pts, filter_tb, 
enc->time_base) -
-av_rescale_q(start_time, AV_TIME_BASE_Q, enc->time_base);
-}
+float_pts = compute_encoder_pts_from_filter_pts(filter, of, enc, 
&filtered_frame->pts);
 
 switch (av_buffersink_get_type(filter)) {
 case AVMEDIA_TYPE_VIDEO:
-- 
2.27.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] lavfi/buffersink: add av_buffersink_get_pts().

2020-06-25 Thread Nicolas George
TODO APIChange & bump

Signed-off-by: Nicolas George 
---
 libavfilter/buffersink.c | 5 +
 libavfilter/buffersink.h | 5 +
 2 files changed, 10 insertions(+)

diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index 76a46f6678..c65a5051a4 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -125,6 +125,11 @@ int attribute_align_arg 
av_buffersink_get_samples(AVFilterContext *ctx,
 return get_frame_internal(ctx, frame, 0, nb_samples);
 }
 
+int64_t av_buffersink_get_pts(AVFilterContext *ctx)
+{
+return ctx->inputs[0]->current_pts;
+}
+
 #if FF_API_NEXT
 AVBufferSinkParams *av_buffersink_params_alloc(void)
 {
diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h
index 2ec821c685..b3e3cc0f29 100644
--- a/libavfilter/buffersink.h
+++ b/libavfilter/buffersink.h
@@ -59,6 +59,11 @@ int av_buffersink_get_frame_flags(AVFilterContext *ctx, 
AVFrame *frame, int flag
  */
 #define AV_BUFFERSINK_FLAG_NO_REQUEST 2
 
+/**
+ * Get the current PTS, i.e. the PTS of the last frame or the end of stream.
+ */
+int64_t av_buffersink_get_pts(AVFilterContext *ctx);
+
 #if FF_API_NEXT
 /**
  * Struct to use for initializing a buffersink context.
-- 
2.27.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 v2] avfilter: add nonlinearstretch filter.

2020-06-25 Thread Mathias Rasmussen
---
 Changelog  |   1 +
 doc/filters.texi   |  34 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/version.h  |   2 +-
 libavfilter/vf_nonlinearstretch.c  | 268 +
 tests/fate/filter-video.mak|   3 +
 tests/ref/fate/filter-nonlinearstretch |   0
 8 files changed, 309 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/vf_nonlinearstretch.c
 create mode 100644 tests/ref/fate/filter-nonlinearstretch

diff --git a/Changelog b/Changelog
index a60e7d2eb8..d6f0b0ac74 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
within each release,
 releases are sorted from youngest to oldest.
 
 version :
+- Nonlinear stretch filter
 - AudioToolbox output device
 - MacCaption demuxer
 
diff --git a/doc/filters.texi b/doc/filters.texi
index 551604a143..5657814c13 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -13989,6 +13989,40 @@ Add temporal and uniform noise to input video:
 noise=alls=20:allf=t+u
 @end example
 
+@section nonlinearstretch
+
+Nonlinear stretch video input frame.
+
+The filter stretches the input horizonatally to a given target width by 
gradually increasing
+the stretching amount from the middle towards the sides.
+
+Commonly used to stretch videos from 4:3 to 16:9 aspect ratio.
+
+The filter accepts the following options:
+
+@table @option
+@item width
+Set output width.
+@item a
+Set stretch factor exponent. Defaults to @code{2.0}.
+A larger value retains more of the original proportions around center, while 
increasing stretching along the sides.
+A value of 1.0 relaxes the filter to a linear stretch.
+@item interpolate
+Enable/disable linear interpolation. Enabled by default.
+@end table
+
+@subsection Examples
+
+Stretch input width to 2560 with less stretching around the middle of the 
frame.
+@example
+nonlinearstretch=width=2560:a=2.5
+@end example
+
+Stretch input width to 1920 with default stretch factor and no interpolation.
+@example
+nonlinearstretch=width=1920:interpolate=0
+@end example
+
 @section normalize
 
 Normalize RGB video (aka histogram stretching, contrast stretching).
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5123540653..469c4ca66f 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -321,6 +321,7 @@ OBJS-$(CONFIG_NLMEANS_OPENCL_FILTER) += 
vf_nlmeans_opencl.o opencl.o ope
 OBJS-$(CONFIG_NNEDI_FILTER)  += vf_nnedi.o
 OBJS-$(CONFIG_NOFORMAT_FILTER)   += vf_format.o
 OBJS-$(CONFIG_NOISE_FILTER)  += vf_noise.o
+OBJS-$(CONFIG_NONLINEARSTRETCH_FILTER)   += vf_nonlinearstretch.o
 OBJS-$(CONFIG_NORMALIZE_FILTER)  += vf_normalize.o
 OBJS-$(CONFIG_NULL_FILTER)   += vf_null.o
 OBJS-$(CONFIG_OCR_FILTER)+= vf_ocr.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 1183e40267..d7be2a2ca2 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -306,6 +306,7 @@ extern AVFilter ff_vf_nlmeans_opencl;
 extern AVFilter ff_vf_nnedi;
 extern AVFilter ff_vf_noformat;
 extern AVFilter ff_vf_noise;
+extern AVFilter ff_vf_nonlinearstretch;
 extern AVFilter ff_vf_normalize;
 extern AVFilter ff_vf_null;
 extern AVFilter ff_vf_ocr;
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 37015085fa..308fbe07c3 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR   7
-#define LIBAVFILTER_VERSION_MINOR  86
+#define LIBAVFILTER_VERSION_MINOR  87
 #define LIBAVFILTER_VERSION_MICRO 100
 
 
diff --git a/libavfilter/vf_nonlinearstretch.c 
b/libavfilter/vf_nonlinearstretch.c
new file mode 100644
index 00..f6c7f46bc6
--- /dev/null
+++ b/libavfilter/vf_nonlinearstretch.c
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2020 Mathias V. Rasmussen
+ *
+ * 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
+ * Nonlinear stretch filter
+ */
+
+#include "libavutil/pixdesc.h"
+#include "libavutil/opt.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "

Re: [FFmpeg-devel] [PATCH 5/5] libavcodec/jpeg2000dec.c: Remove log2_chroma check in pixel format selection

2020-06-25 Thread Gautam Ramakrishnan
On Tue, Jun 23, 2020 at 8:04 AM Gautam Ramakrishnan
 wrote:
>
> On Tue, Jun 23, 2020 at 2:55 AM Carl Eugen Hoyos  wrote:
> >
> > Am Mo., 22. Juni 2020 um 04:57 Uhr schrieb Gautam Ramakrishnan
> > :
> > >
> > > On Mon, Jun 22, 2020 at 1:54 AM Carl Eugen Hoyos  
> > > wrote:
> > > >
> > > > Am So., 21. Juni 2020 um 21:11 Uhr schrieb :
> > > > >
> > > > > From: Gautam Ramakrishnan 
> > > > >
> > > > > The log2_chroma_wh is derived from the sample separations of the
> > > > > codestream if the file is a j2k codestream. Not sure if sample
> > > > > separation is same is subsampling and whether using sample
> > > > > separation values from the codestream to determine pixel format.
> > > >
> > > > What would get fixed by this change?
> > > >
> > > The p1_01.j2k image was not getting recognized by the native
> > > decoder due to this condition.
> >
> > In any case, this was missing from the commit message.
> >
> > > It would now get recognized. If this patch is fine,
> >
> > I wanted to suggest to add the following two lines after
> > the calls to pix_fmt_guess():
> > if (s->avctx->pix_fmt == AV_PIX_FMT_NONE && ncomponents == 1)
> > s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
> >
> I had tried this for testing initially. I placed this inside the
> if (i == possible_fmts_nb) check. It seemed to work correctly.
> I could possibly resend with this also, but I did not know this would
> be a good solution.
> > But p1_01.j2k does not get decoded with the change either here.
> >
> > > I would preferably remove this check at all places.
> >
> > I thought the check is needed but if fuzzing does not produce
> > invalid memory access for you, it may be ok.
> >
> I'll run the fuzzer again carefully.
I ran the fuzzer (zzuf) where I ran ffmpeg with input files p1_01.j2k
and p1_07.j2k.
I tried with seeds from 0 to 1.
I tried error rates of 0.01, 0.1 and 0.5. There was no segfault. I
used the -c option as
I only wanted it to fuzz the .j2k files. I hope my configuration while
using zzuf was correct.
> > Carl Eugen
> > ___
>
>
>
>
> --
> -
> Gautam |



-- 
-
Gautam |
___
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] libavfilter/vf_codecview: enable qp visualization for H264 and VP9

2020-06-25 Thread Yongle Lin
Add qp visualization in codecview filter which supports H264 and VP9 codecs. 
Add options for luma/chroma qp and AC/DC qp as well. There is a old way to 
visualize it but it's deprecated since version 58.
example command line to visualize qp:
./ffmpeg -export_side_data +venc_params -i input.mp4 -vf codecview=qp=true 
output.mp4
---
 doc/filters.texi   |  6 
 libavfilter/vf_codecview.c | 69 +-
 2 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 84567dec16..f4a57e993f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7285,6 +7285,12 @@ backward predicted MVs of B-frames
 @item qp
 Display quantization parameters using the chroma planes.
 
+@item chroma_qp
+Display chroma quantization parameters (default luma qp) using the chroma 
planes. Should use with qp option. (e.g. codecview=qp=true:chroma_qp=true)
+
+@item dc_qp
+Display DC quantization parameters (default AC qp) using the chroma planes. 
Should use with qp option. (e.g. codecview=qp=true:dc_qp=true)
+
 @item mv_type, mvt
 Set motion vectors type to visualize. Includes MVs from all frames unless 
specified by @var{frame_type} option.
 
diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c
index 331bfba777..f585dfe28e 100644
--- a/libavfilter/vf_codecview.c
+++ b/libavfilter/vf_codecview.c
@@ -34,6 +34,7 @@
 #include "libavutil/opt.h"
 #include "avfilter.h"
 #include "internal.h"
+#include "libavutil/video_enc_params.h"
 
 #define MV_P_FOR  (1<<0)
 #define MV_B_FOR  (1<<1)
@@ -51,6 +52,8 @@ typedef struct CodecViewContext {
 unsigned mv_type;
 int hsub, vsub;
 int qp;
+int chroma_qp;
+int dc_qp;
 } CodecViewContext;
 
 #define OFFSET(x) offsetof(CodecViewContext, x)
@@ -63,6 +66,8 @@ static const AVOption codecview_options[] = {
 CONST("bf", "forward predicted MVs of B-frames",  MV_B_FOR,  "mv"),
 CONST("bb", "backward predicted MVs of B-frames", MV_B_BACK, "mv"),
 { "qp", NULL, OFFSET(qp), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags = FLAGS 
},
+{ "chroma_qp", NULL, OFFSET(chroma_qp), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, 
.flags = FLAGS },
+{ "dc_qp", NULL, OFFSET(dc_qp), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags = 
FLAGS },
 { "mv_type", "set motion vectors type", OFFSET(mv_type), 
AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, "mv_type" },
 { "mvt", "set motion vectors type", OFFSET(mv_type), 
AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, "mv_type" },
 CONST("fp", "forward predicted MVs",  MV_TYPE_FOR,  "mv_type"),
@@ -212,6 +217,52 @@ static void draw_arrow(uint8_t *buf, int sx, int sy, int 
ex,
 draw_line(buf, sx, sy, ex, ey, w, h, stride, color);
 }
 
+static int qp_color_calculate(int qp, enum AVVideoEncParamsType type) {
+return type == AV_VIDEO_ENC_PARAMS_H264 ? qp * 128 / 31 : qp;
+}
+
+static void get_block_color(AVVideoEncParams *par, AVVideoBlockParams *b, 
CodecViewContext *s, enum AVColorRange color_range, int *cu, int *cv)
+{
+const int plane_qp_cu_index = s->chroma_qp ? 1 : 0;
+const int plane_qp_cv_index = s->chroma_qp ? 2 : 0;
+const int ac_dc_index = s->dc_qp ? 0 : 1;
+*cu = qp_color_calculate(par->qp + 
par->delta_qp[plane_qp_cu_index][ac_dc_index] + b->delta_qp, par->type);
+*cv = qp_color_calculate(par->qp + 
par->delta_qp[plane_qp_cv_index][ac_dc_index] + b->delta_qp, par->type);
+if (color_range == AVCOL_RANGE_MPEG) {
+// map jpeg color range(0-255) to mpeg color range(16-235)
+*cu = av_rescale(*cu, 73, 85) + 16;
+*cv = av_rescale(*cv, 73, 85) + 16;
+}
+}
+
+static void color_block(AVFrame *frame, CodecViewContext *s, const int src_x, 
const int src_y, const int b_w, const int b_h, const int cu, const int cv)
+{
+const int w = AV_CEIL_RSHIFT(frame->width,  s->hsub);
+const int h = AV_CEIL_RSHIFT(frame->height, s->vsub);
+const int lzu = frame->linesize[1];
+const int lzv = frame->linesize[2];
+
+const int plane_src_x = src_x >> s->hsub;
+const int plane_src_y = src_y >> s->vsub;
+const int plane_b_w = b_w >> s->hsub;
+const int plane_b_h = b_h >> s->vsub;
+uint8_t *pu = frame->data[1] + plane_src_y * lzu;
+uint8_t *pv = frame->data[2] + plane_src_y * lzv;
+
+for (int y = plane_src_y; y < plane_src_y + plane_b_h; y++) {
+for (int x = plane_src_x; x < plane_src_x + plane_b_w; x++) {
+if (x >= w)
+break;
+pu[x] = cu;
+pv[x] = cv;
+}
+if (y >= h)
+break;
+pu += lzu;
+pv += lzv;
+}
+}
+
 static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
 {
 AVFilterContext *ctx = inlink->dst;
@@ -240,8 +291,24 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 pv += lzv;
 }
 }
-}
 
+AVFrameSideData *sd = av_frame_get_side_data(frame, 
AV_FRAME_DATA_VIDEO_ENC_PARAMS);
+if 

Re: [FFmpeg-devel] [PATCH 1/2] lavc/vdpau_hevc: add function to find exact vdp_profile for REXT

2020-06-25 Thread Philip Langdale
On Thu, 25 Jun 2020 16:53:01 +0530
ManojGuptaBonda  wrote:

> Add vdpau_parse_rext_profile and use profile constraint flags to
> determine the exact vdp_profile for HEVC_REXT.
> 
> If profile mismatch is allowed, select Main profile by default.
> 
> Add build object in Makefile for h265_profile_level dependency.
> ---
>  libavcodec/Makefile |  2 +-
>  libavcodec/vdpau_hevc.c | 83
> - 2 files changed, 83
> insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 5a6ea59715..4f28cb0f2a 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -910,7 +910,7 @@ OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) +=
> dxva2_hevc.o OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o
>  OBJS-$(CONFIG_HEVC_QSV_HWACCEL)   += qsvdec_h2645.o
>  OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o
> h265_profile_level.o -OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) +=
> vdpau_hevc.o +OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) +=
> vdpau_hevc.o h265_profile_level.o OBJS-$(CONFIG_MJPEG_NVDEC_HWACCEL)
>   += nvdec_mjpeg.o OBJS-$(CONFIG_MJPEG_VAAPI_HWACCEL)+=
> vaapi_mjpeg.o OBJS-$(CONFIG_MPEG1_NVDEC_HWACCEL)+=
> nvdec_mpeg12.o diff --git a/libavcodec/vdpau_hevc.c
> b/libavcodec/vdpau_hevc.c index 29cb2da078..1ee781c685 100644
> --- a/libavcodec/vdpau_hevc.c
> +++ b/libavcodec/vdpau_hevc.c
> @@ -29,6 +29,8 @@
>  #include "hwconfig.h"
>  #include "vdpau.h"
>  #include "vdpau_internal.h"
> +#include "h265_profile_level.h"
> +
>  
>  static int vdpau_hevc_start_frame(AVCodecContext *avctx,
>const uint8_t *buffer, uint32_t
> size) @@ -429,10 +431,87 @@ static int
> vdpau_hevc_end_frame(AVCodecContext *avctx) return 0;
>  }
>  
> +
> +
> +static int ptl_convert(const PTLCommon *general_ptl,
> H265RawProfileTierLevel *h265_raw_ptl) +{
> +h265_raw_ptl->general_profile_space = general_ptl->profile_space;
> +h265_raw_ptl->general_tier_flag = general_ptl->tier_flag;
> +h265_raw_ptl->general_profile_idc   = general_ptl->profile_idc;
> +
> +memcpy(h265_raw_ptl->general_profile_compatibility_flag,
> +
> general_ptl->profile_compatibility_flag, 32 * sizeof(uint8_t)); +
> +#define copy_field(name) h265_raw_ptl->general_ ## name =
> general_ptl->name
> +copy_field(progressive_source_flag);
> +copy_field(interlaced_source_flag);
> +copy_field(non_packed_constraint_flag);
> +copy_field(frame_only_constraint_flag);
> +copy_field(max_12bit_constraint_flag);
> +copy_field(max_10bit_constraint_flag);
> +copy_field(max_8bit_constraint_flag);
> +copy_field(max_422chroma_constraint_flag);
> +copy_field(max_420chroma_constraint_flag);
> +copy_field(max_monochrome_constraint_flag);
> +copy_field(intra_constraint_flag);
> +copy_field(one_picture_only_constraint_flag);
> +copy_field(lower_bit_rate_constraint_flag);
> +copy_field(max_14bit_constraint_flag);
> +copy_field(inbld_flag);
> +copy_field(level_idc);
> +#undef copy_field
> +
> +return 0;
> +}
> +
> +/*
> + * Find exact vdpau_profile for HEVC Range Extension
> + */
> +static int vdpau_hevc_parse_rext_profile(AVCodecContext *avctx,
> VdpDecoderProfile *vdp_profile) +{
> +const HEVCContext *h = avctx->priv_data;
> +const HEVCSPS *sps = h->ps.sps;
> +const PTL *ptl = &sps->ptl;
> +const PTLCommon *general_ptl = &ptl->general_ptl;
> +const H265ProfileDescriptor *profile;
> +H265RawProfileTierLevel h265_raw_ptl = {0};
> +
> +/* convert PTLCommon to H265RawProfileTierLevel */
> +ptl_convert(general_ptl, &h265_raw_ptl);
> +
> +profile = ff_h265_get_profile(&h265_raw_ptl);
> +if (!profile) {
> +av_log(avctx, AV_LOG_WARNING, "HEVC profile is not
> found.\n");
> +if (avctx->hwaccel_flags &
> AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH) {
> +// Default to selecting Main profile if profile mismatch
> is allowed
> +*vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN;
> +return 0;
> +} else
> +return AVERROR(ENOTSUP);
> +}
> +
> +if (!strcmp(profile->name, "Main 12") ||
> +!strcmp(profile->name, "Main 12 Intra"))
> +*vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN_12;
> +else if (!strcmp(profile->name, "Main 4:4:4") ||
> + !strcmp(profile->name, "Main 4:4:4 Intra"))
> +*vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN_444;
> +else if (!strcmp(profile->name, "Main 4:4:4 10") ||
> + !strcmp(profile->name, "Main 4:4:4 10 Intra"))
> +*vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN_444_10;
> +else if (!strcmp(profile->name, "Main 4:4:4 12") ||
> + !strcmp(profile->name, "Main 4:4:4 12 Intra"))
> +*vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN_444_12;
> +
> +return 0;
> +}
> +
> +
>  static int vdpau_hevc_init(AVCodecContext *avctx)
>  {
>  VdpDecoderProfile profile;
>  uint32_t leve

Re: [FFmpeg-devel] [PATCH 2/2] Add VDPAU to list of supported formats

2020-06-25 Thread Philip Langdale
On Thu, 25 Jun 2020 16:53:02 +0530
ManojGuptaBonda  wrote:

> Added VDPAU to list of supported formats for HEVC10 and 12 bit formats
> also added 42010 bit to surface_parameters and new VDP chroma formats
> to VDPAUPixFmtMaps
> 
> Add HEVC 420 10/12 Bit  and 444 10/12 Bit support for VDPAU
> 
> 
> YUV444P10 is defined as the 444 surface with 10bit valid data in LSBs
> but H/w returns Data in MSBs Hence if we map output as YUV444p16 it
> is filtering out the LSB to convert to p10 format.
> ---
>  libavcodec/hevcdec.c|  6 ++
>  libavcodec/vdpau.c  |  4 
>  libavutil/hwcontext_vdpau.c | 13 +++--
>  3 files changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index c9e28f5826..e576cce5de 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -414,6 +414,9 @@ static enum AVPixelFormat get_format(HEVCContext
> *s, const HEVCSPS *sps) #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
>  *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
>  #endif
> +#if CONFIG_HEVC_VDPAU_HWACCEL
> +*fmt++ = AV_PIX_FMT_VDPAU;
> +#endif
>  #if CONFIG_HEVC_NVDEC_HWACCEL
>  *fmt++ = AV_PIX_FMT_CUDA;
>  #endif
> @@ -435,6 +438,9 @@ static enum AVPixelFormat get_format(HEVCContext
> *s, const HEVCSPS *sps) case AV_PIX_FMT_YUV420P12:
>  case AV_PIX_FMT_YUV444P10:
>  case AV_PIX_FMT_YUV444P12:
> +#if CONFIG_HEVC_VDPAU_HWACCEL
> +*fmt++ = AV_PIX_FMT_VDPAU;
> +#endif
>  #if CONFIG_HEVC_NVDEC_HWACCEL
>  *fmt++ = AV_PIX_FMT_CUDA;
>  #endif
> diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
> index 167f06d7ae..fa10905c75 100644
> --- a/libavcodec/vdpau.c
> +++ b/libavcodec/vdpau.c
> @@ -83,6 +83,8 @@ int av_vdpau_get_surface_parameters(AVCodecContext
> *avctx, switch (avctx->sw_pix_fmt) {
>  case AV_PIX_FMT_YUV420P:
>  case AV_PIX_FMT_YUVJ420P:
> +case AV_PIX_FMT_YUV420P10:
> +case AV_PIX_FMT_YUV420P12:
>  t = VDP_CHROMA_TYPE_420;
>  w = (w + 1) & ~1;
>  h = (h + 3) & ~3;
> @@ -95,6 +97,8 @@ int av_vdpau_get_surface_parameters(AVCodecContext
> *avctx, break;
>  case AV_PIX_FMT_YUV444P:
>  case AV_PIX_FMT_YUVJ444P:
> +case AV_PIX_FMT_YUV444P10:
> +case AV_PIX_FMT_YUV444P12:
>  t = VDP_CHROMA_TYPE_444;
>  h = (h + 1) & ~1;
>  break;
> diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c
> index 6b8c1d5f76..6061476094 100644
> --- a/libavutil/hwcontext_vdpau.c
> +++ b/libavutil/hwcontext_vdpau.c
> @@ -39,8 +39,8 @@ typedef struct VDPAUDeviceContext {
>  VdpVideoSurfaceCreate   *surf_create;
>  VdpVideoSurfaceDestroy  *surf_destroy;
>  
> -enum AVPixelFormat *pix_fmts[3];
> -int  nb_pix_fmts[3];
> +enum AVPixelFormat *pix_fmts[8];
> +int  nb_pix_fmts[8];
>  } VDPAUDeviceContext;
>  
>  typedef struct VDPAUFramesContext {
> @@ -61,6 +61,8 @@ typedef struct VDPAUPixFmtMap {
>  static const VDPAUPixFmtMap pix_fmts_420[] = {
>  { VDP_YCBCR_FORMAT_NV12, AV_PIX_FMT_NV12},
>  { VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV420P },
> +{ VDP_YCBCR_FORMAT_P016, AV_PIX_FMT_P016},
> +{ VDP_YCBCR_FORMAT_P010, AV_PIX_FMT_P010},
>  { 0, AV_PIX_FMT_NONE,   },
>  };
>  
> @@ -75,6 +77,7 @@ static const VDPAUPixFmtMap pix_fmts_422[] = {
>  static const VDPAUPixFmtMap pix_fmts_444[] = {
>  #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
>  { VDP_YCBCR_FORMAT_Y_U_V_444, AV_PIX_FMT_YUV444P },
> +{VDP_YCBCR_FORMAT_Y_U_V_444_16, AV_PIX_FMT_YUV444P16},
>  #endif
>  { 0,  AV_PIX_FMT_NONE,   },
>  };
> @@ -87,6 +90,11 @@ static const struct {
>  { VDP_CHROMA_TYPE_420, AV_PIX_FMT_YUV420P, pix_fmts_420 },
>  { VDP_CHROMA_TYPE_422, AV_PIX_FMT_YUV422P, pix_fmts_422 },
>  { VDP_CHROMA_TYPE_444, AV_PIX_FMT_YUV444P, pix_fmts_444 },
> +{ VDP_CHROMA_TYPE_420_16, AV_PIX_FMT_YUV420P10, pix_fmts_420 },
> +{ VDP_CHROMA_TYPE_420_16, AV_PIX_FMT_YUV420P12, pix_fmts_420 },
> +{ VDP_CHROMA_TYPE_422_16, AV_PIX_FMT_YUV422P, pix_fmts_422 },

Is this right? That's the 8bit ffmpeg format.

> +{ VDP_CHROMA_TYPE_444_16, AV_PIX_FMT_YUV444P10, pix_fmts_444 },
> +{ VDP_CHROMA_TYPE_444_16, AV_PIX_FMT_YUV444P12, pix_fmts_444 },
>  };
>  
>  static int count_pixfmts(const VDPAUPixFmtMap *map)
> @@ -354,6 +362,7 @@ static int
> vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, if
> ((vdpau_format == VDP_YCBCR_FORMAT_YV12) #ifdef
> VDP_YCBCR_FORMAT_Y_U_V_444 || (vdpau_format ==
> VDP_YCBCR_FORMAT_Y_U_V_444)
> +|| (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444_16)
>  #endif
>  )
>  FFSWAP(void*, data[1], data[2]);




--phil
___
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 "u

Re: [FFmpeg-devel] [PATCH 5/5] libavcodec/jpeg2000dec.c: Remove log2_chroma check in pixel format selection

2020-06-25 Thread Carl Eugen Hoyos
Am Do., 25. Juni 2020 um 20:52 Uhr schrieb Gautam Ramakrishnan
:

> I ran the fuzzer (zzuf) where I ran ffmpeg with input files p1_01.j2k
> and p1_07.j2k.
> I tried with seeds from 0 to 1.
> I tried error rates of 0.01, 0.1 and 0.5. There was no segfault. I
> used the -c option as
> I only wanted it to fuzz the .j2k files. I hope my configuration while
> using zzuf was correct.

You don't have to show all lines you tested, but one (or two)
might help to answer this...

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 5/5] libavcodec/jpeg2000dec.c: Remove log2_chroma check in pixel format selection

2020-06-25 Thread Michael Niedermayer
On Fri, Jun 26, 2020 at 12:22:22AM +0530, Gautam Ramakrishnan wrote:
> On Tue, Jun 23, 2020 at 8:04 AM Gautam Ramakrishnan
>  wrote:
> >
> > On Tue, Jun 23, 2020 at 2:55 AM Carl Eugen Hoyos  wrote:
> > >
> > > Am Mo., 22. Juni 2020 um 04:57 Uhr schrieb Gautam Ramakrishnan
> > > :
> > > >
> > > > On Mon, Jun 22, 2020 at 1:54 AM Carl Eugen Hoyos  
> > > > wrote:
> > > > >
> > > > > Am So., 21. Juni 2020 um 21:11 Uhr schrieb :
> > > > > >
> > > > > > From: Gautam Ramakrishnan 
> > > > > >
> > > > > > The log2_chroma_wh is derived from the sample separations of the
> > > > > > codestream if the file is a j2k codestream. Not sure if sample
> > > > > > separation is same is subsampling and whether using sample
> > > > > > separation values from the codestream to determine pixel format.
> > > > >
> > > > > What would get fixed by this change?
> > > > >
> > > > The p1_01.j2k image was not getting recognized by the native
> > > > decoder due to this condition.
> > >
> > > In any case, this was missing from the commit message.
> > >
> > > > It would now get recognized. If this patch is fine,
> > >
> > > I wanted to suggest to add the following two lines after
> > > the calls to pix_fmt_guess():
> > > if (s->avctx->pix_fmt == AV_PIX_FMT_NONE && ncomponents == 1)
> > > s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
> > >
> > I had tried this for testing initially. I placed this inside the
> > if (i == possible_fmts_nb) check. It seemed to work correctly.
> > I could possibly resend with this also, but I did not know this would
> > be a good solution.
> > > But p1_01.j2k does not get decoded with the change either here.
> > >
> > > > I would preferably remove this check at all places.
> > >
> > > I thought the check is needed but if fuzzing does not produce
> > > invalid memory access for you, it may be ok.
> > >
> > I'll run the fuzzer again carefully.
> I ran the fuzzer (zzuf) where I ran ffmpeg with input files p1_01.j2k
> and p1_07.j2k.
> I tried with seeds from 0 to 1.
> I tried error rates of 0.01, 0.1 and 0.5. There was no segfault. I
> used the -c option as
> I only wanted it to fuzz the .j2k files. I hope my configuration while
> using zzuf was correct.

from my command line history, i tested
zzuf -C9 -s 0:100 ./ffmpeg -v -99 -i p1_07.j2k

zzuf[s=8,r=0.004]: signal 11 (SIGSEGV)
zzuf[s=12,r=0.004]: signal 11 (SIGSEGV)
zzuf[s=52,r=0.004]: signal 11 (SIGSEGV)
zzuf[s=81,r=0.004]: signal 11 (SIGSEGV)
zzuf[s=93,r=0.004]: signal 11 (SIGSEGV)
zzuf[s=97,r=0.004]: signal 11 (SIGSEGV)

i didnt investigate these at all yet so they may be unrelated to the j2k
decoder, but there where segfaults ...

thx

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


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/2] lavc/vdpau_hevc: add function to find exact vdp_profile for REXT

2020-06-25 Thread Philip Langdale
On Thu, 25 Jun 2020 09:17:19 -0700
Philip Langdale  wrote:
> 
> 
> LGTM.
> 

I have been reminded that this only compiles cleanly with the latest
vdpau. We need #ifdef guards to continue compiling with older releases.

--phil
___
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] libavcodec/pgx: Added pgx decoder

2020-06-25 Thread Carl Eugen Hoyos
Am Do., 25. Juni 2020 um 09:23 Uhr schrieb Gautam Ramakrishnan
:
>
> On Thu, Jun 25, 2020 at 12:50 AM Carl Eugen Hoyos  wrote:

> > > +for (i = 0; i < 6; i++) {
> > > +if (header_start[i] != (char)bytestream2_get_byteu(&s->g)) {
> > > +return AVERROR_INVALIDDATA;
> > > +}
> >
> > Use memcmp() or consider to drop this check:
> > If a user forces this decoder, it should not be necessary to depend on this.
> >
> I did not understand this

My personal believe is - although some decoders are doing this - that
this check is not useful.
If you keep the check, it should be done with memcmp().

[...]

> > > diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> >
> > I believe other developers will request that you split the demuxer
> > and the decoder patch.
> >
> The only issue is the demuxer refers to the decoder. How do I do this?

If you decide to split the patch, the first patch adds the decoder,
the second the demuxer.
Please increase MINOR versions for both libraries in the appropriate
patches.

[...]

> > > +static int pgx_probe(const AVProbeData *p)
> > > +{
> > > +const uint8_t *b = p->buf;
> > > +int ret = (AV_RB32(b) & 0xFF00) == 0x50472000;
> >
> > if (AV_RB24(b) != ...)
> > return 0;
> >
> > > +ret = ret && av_match_ext(p->filename, "pgx");
> > > +if (ret)
> > > +return AVPROBE_SCORE_EXTENSION + 1;
> >
> > You should instead check if the file internally looks like pgx,
> > checking the extension is a final possibility for things that
> > are impossible to detect (which I think is not the case here).
> >
> The previous check does that. It checks if the first 3 bytes are PG and space.

Please check more than three bytes - use memcmp() - and please
remove the usage of av_match_ext(), it should only be used in rare
cases, this is not one of them.

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".

[FFmpeg-devel] [PATCH 1/6] avcodec/dvbsubdec: simplify code by using OFFSET() macro

2020-06-25 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavcodec/dvbsubdec.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index f63a1f3..af6c78a 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -1730,10 +1730,11 @@ end:
 }
 
 #define DS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_SUBTITLE_PARAM
+#define OFFSET(x) offsetof(DVBSubContext, x)
 static const AVOption options[] = {
-{"compute_edt", "compute end of time using pts or timeout", 
offsetof(DVBSubContext, compute_edt), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DS},
-{"compute_clut", "compute clut when not available(-1) or always(1) or 
never(0)", offsetof(DVBSubContext, compute_clut), AV_OPT_TYPE_BOOL, {.i64 = 
-1}, -1, 1, DS},
-{"dvb_substream", "", offsetof(DVBSubContext, substream), AV_OPT_TYPE_INT, 
{.i64 = -1}, -1, 63, DS},
+{"compute_edt", "compute end of time using pts or timeout", 
OFFSET(compute_edt), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DS},
+{"compute_clut", "compute clut when not available(-1) or always(1) or 
never(0)", OFFSET(compute_clut), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, DS},
+{"dvb_substream", "", OFFSET(substream), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 
63, DS},
 {NULL}
 };
 static const AVClass dvbsubdec_class = {
-- 
1.8.3.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".

[FFmpeg-devel] [PATCH 4/6] avutil/bprint: use AV_BPRINT_SIZE_AUTOMATIC instead of 1

2020-06-25 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavutil/bprint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index 2f059c5..148b7bb 100644
--- a/libavutil/bprint.c
+++ b/libavutil/bprint.c
@@ -71,7 +71,7 @@ void av_bprint_init(AVBPrint *buf, unsigned size_init, 
unsigned size_max)
 unsigned size_auto = (char *)buf + sizeof(*buf) -
  buf->reserved_internal_buffer;
 
-if (size_max == 1)
+if (size_max == AV_BPRINT_SIZE_AUTOMATIC)
 size_max = size_auto;
 buf->str  = buf->reserved_internal_buffer;
 buf->len  = 0;
-- 
1.8.3.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".

[FFmpeg-devel] [PATCH 2/6] avcodec/dvbsubdec: prefer to use variable instead of type for sizeof

2020-06-25 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavcodec/dvbsubdec.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index af6c78a..263ba59 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -813,7 +813,7 @@ static int save_subtitle_set(AVCodecContext *avctx, 
AVSubtitle *sub, int *got_ou
 ret = AVERROR(ENOMEM);
 goto fail;
 }
-memcpy(rect->data[1], clut_table, (1 << region->depth) * 
sizeof(uint32_t));
+memcpy(rect->data[1], clut_table, (1 << region->depth) * 
sizeof(*clut_table));
 
 rect->data[0] = av_malloc(region->buf_size);
 if (!rect->data[0]) {
@@ -1073,11 +1073,11 @@ static int dvbsub_parse_clut_segment(AVCodecContext 
*avctx,
 clut = get_clut(ctx, clut_id);
 
 if (!clut) {
-clut = av_malloc(sizeof(DVBSubCLUT));
+clut = av_malloc(sizeof(*clut));
 if (!clut)
 return AVERROR(ENOMEM);
 
-memcpy(clut, &default_clut, sizeof(DVBSubCLUT));
+memcpy(clut, &default_clut, sizeof(*clut));
 
 clut->id = clut_id;
 clut->version = -1;
@@ -1163,7 +1163,7 @@ static int dvbsub_parse_region_segment(AVCodecContext 
*avctx,
 region = get_region(ctx, region_id);
 
 if (!region) {
-region = av_mallocz(sizeof(DVBSubRegion));
+region = av_mallocz(sizeof(*region));
 if (!region)
 return AVERROR(ENOMEM);
 
@@ -1244,7 +1244,7 @@ static int dvbsub_parse_region_segment(AVCodecContext 
*avctx,
 object = get_object(ctx, object_id);
 
 if (!object) {
-object = av_mallocz(sizeof(DVBSubObject));
+object = av_mallocz(sizeof(*object));
 if (!object)
 return AVERROR(ENOMEM);
 
@@ -1255,7 +1255,7 @@ static int dvbsub_parse_region_segment(AVCodecContext 
*avctx,
 
 object->type = (*buf) >> 6;
 
-display = av_mallocz(sizeof(DVBSubObjectDisplay));
+display = av_mallocz(sizeof(*display));
 if (!display)
 return AVERROR(ENOMEM);
 
@@ -1352,7 +1352,7 @@ static int dvbsub_parse_page_segment(AVCodecContext 
*avctx,
 }
 
 if (!display) {
-display = av_mallocz(sizeof(DVBSubRegionDisplay));
+display = av_mallocz(sizeof(*display));
 if (!display)
 return AVERROR(ENOMEM);
 }
-- 
1.8.3.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".

[FFmpeg-devel] [PATCH 3/6] avcodec/dvbsubdec: Cosmetics

2020-06-25 Thread lance . lmwang
From: Limin Wang 

reindent code and fix the if( style

Signed-off-by: Limin Wang 
---
 libavcodec/dvbsubdec.c | 90 +-
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 263ba59..d151288 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -737,7 +737,7 @@ static int save_subtitle_set(AVCodecContext *avctx, 
AVSubtitle *sub, int *got_ou
 }
 
 /* Not touching AVSubtitles again*/
-if(sub->num_rects) {
+if (sub->num_rects) {
 avpriv_request_sample(ctx, "Different Version of Segment asked Twice");
 return AVERROR_PATCHWELCOME;
 }
@@ -747,7 +747,7 @@ static int save_subtitle_set(AVCodecContext *avctx, 
AVSubtitle *sub, int *got_ou
 sub->num_rects++;
 }
 
-if(ctx->compute_edt == 0) {
+if (ctx->compute_edt == 0) {
 sub->end_display_time = ctx->time_out * 1000;
 *got_output = 1;
 } else if (ctx->prev_start != AV_NOPTS_VALUE) {
@@ -851,7 +851,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return 0;
 fail:
 if (sub->rects) {
-for(i=0; inum_rects; i++) {
+for (i=0; inum_rects; i++) {
 rect = sub->rects[i];
 if (rect) {
 av_freep(&rect->data[0]);
@@ -1088,53 +1088,53 @@ static int dvbsub_parse_clut_segment(AVCodecContext 
*avctx,
 
 if (clut->version != version) {
 
-clut->version = version;
+clut->version = version;
 
-while (buf + 4 < buf_end) {
-entry_id = *buf++;
+while (buf + 4 < buf_end) {
+entry_id = *buf++;
 
-depth = (*buf) & 0xe0;
+depth = (*buf) & 0xe0;
 
-if (depth == 0) {
-av_log(avctx, AV_LOG_ERROR, "Invalid clut depth 0x%x!\n", *buf);
-}
+if (depth == 0) {
+av_log(avctx, AV_LOG_ERROR, "Invalid clut depth 0x%x!\n", 
*buf);
+}
 
-full_range = (*buf++) & 1;
+full_range = (*buf++) & 1;
 
-if (full_range) {
-y = *buf++;
-cr = *buf++;
-cb = *buf++;
-alpha = *buf++;
-} else {
-y = buf[0] & 0xfc;
-cr = (((buf[0] & 3) << 2) | ((buf[1] >> 6) & 3)) << 4;
-cb = (buf[1] << 2) & 0xf0;
-alpha = (buf[1] << 6) & 0xc0;
+if (full_range) {
+y = *buf++;
+cr = *buf++;
+cb = *buf++;
+alpha = *buf++;
+} else {
+y = buf[0] & 0xfc;
+cr = (((buf[0] & 3) << 2) | ((buf[1] >> 6) & 3)) << 4;
+cb = (buf[1] << 2) & 0xf0;
+alpha = (buf[1] << 6) & 0xc0;
 
-buf += 2;
-}
+buf += 2;
+}
 
-if (y == 0)
-alpha = 0xff;
+if (y == 0)
+alpha = 0xff;
 
-YUV_TO_RGB1_CCIR(cb, cr);
-YUV_TO_RGB2_CCIR(r, g, b, y);
+YUV_TO_RGB1_CCIR(cb, cr);
+YUV_TO_RGB2_CCIR(r, g, b, y);
 
-ff_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha);
-if (!!(depth & 0x80) + !!(depth & 0x40) + !!(depth & 0x20) > 1) {
-ff_dlog(avctx, "More than one bit level marked: %x\n", depth);
-if (avctx->strict_std_compliance > FF_COMPLIANCE_NORMAL)
-return AVERROR_INVALIDDATA;
-}
+ff_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, 
alpha);
+if (!!(depth & 0x80) + !!(depth & 0x40) + !!(depth & 0x20) > 1) {
+ff_dlog(avctx, "More than one bit level marked: %x\n", depth);
+if (avctx->strict_std_compliance > FF_COMPLIANCE_NORMAL)
+return AVERROR_INVALIDDATA;
+}
 
-if (depth & 0x80 && entry_id < 4)
-clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha);
-else if (depth & 0x40 && entry_id < 16)
-clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha);
-else if (depth & 0x20)
-clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha);
-}
+if (depth & 0x80 && entry_id < 4)
+clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha);
+else if (depth & 0x40 && entry_id < 16)
+clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha);
+else if (depth & 0x20)
+clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha);
+}
 }
 
 return 0;
@@ -1210,7 +1210,7 @@ static int dvbsub_parse_region_segment(AVCodecContext 
*avctx,
 }
 
 region->depth = 1 << (((*buf++) >> 2) & 7);
-if(region->depth<2 || region->depth>8){
+if (region->depth<2 || region->depth>8){
 av_log(avctx, AV_LOG_ERROR, "region depth %d is invalid\n", 
region->depth);
 region->depth= 4;
 }
@@ -1318,7 +1318,7 @@ static int dvbsub_parse_page_segment(AVCodecContext 
*avctx,
 
 ff_dlog(avctx, "Page time out %ds

[FFmpeg-devel] [PATCH 5/6] avformat/aviobuf: INT_MAX -> AV_BPRINT_SIZE_UNLIMITED

2020-06-25 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/aviobuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index a77517d..1e32c0c 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1191,7 +1191,7 @@ int avio_printf(AVIOContext *s, const char *fmt, ...)
 va_list ap;
 AVBPrint bp;
 
-av_bprint_init(&bp, 0, INT_MAX);
+av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED);
 va_start(ap, fmt);
 av_vbprintf(&bp, fmt, ap);
 va_end(ap);
-- 
1.8.3.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".

[FFmpeg-devel] [PATCH 6/6] avformat/gifdec: -1 -> AV_BPRINT_SIZE_UNLIMITED

2020-06-25 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/gifdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c
index a31644c..d617de5 100644
--- a/libavformat/gifdec.c
+++ b/libavformat/gifdec.c
@@ -144,7 +144,7 @@ static int gif_read_header(AVFormatContext *s)
 AVBPrint bp;
 int block_size;
 
-av_bprint_init(&bp, 0, -1);
+av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED);
 while ((block_size = avio_r8(pb)) != 0) {
 avio_read_to_bprint(pb, &bp, block_size);
 }
-- 
1.8.3.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".

[FFmpeg-devel] [PATCH 1/5] avcodec/libaomenc.c: Add super-resolution options to libaom wrapper

2020-06-25 Thread Wang Cao
From: Wang Cao 

Signed-off-by: Wang Cao 
---
 doc/encoders.texi  | 39 +++
 libavcodec/libaomenc.c | 38 ++
 libavcodec/version.h   |  2 +-
 3 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 17a0f4c821..045535accb 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1599,6 +1599,45 @@ Enable the use of global motion for block prediction. 
Default is true.
 Enable block copy mode for intra block prediction. This mode is
 useful for screen content. Default is true.
 
+@item enable-superres (@emph{boolean})
+Enable super-resolution during the encoding process.
+
+@item superres-mode (@emph{mode})
+Select super-resolution mode.
+
+@table @option
+@item none (@emph{0})
+No frame superres allowed.
+
+@item fixed (@emph{1})
+All frames are coded at the specified scale and super-resolved.
+
+@item random (@emph{2})
+All frames are coded at a random scale and super-resolved.
+
+@item qthresh (@emph{3})
+Superres scale for a frame is determined based on q_index.
+
+@item auto (@emph{4})
+Automatically select superres for appropriate frames.
+@end table
+
+@item superres_denominator
+The denominator for superres to use when @option{superres-mode} is 
@option{fixed}.
+Valid value ranges from 8 to 16.
+
+@item superres_kf_denominator
+The denominator for superres to use on key frames when
+@option{superres-mode} is @option{fixed}. Valid value ranges from 8 to 16.
+
+@item superres_qthresh
+The q level threshold after which superres is used when @option{superres-mode}
+is @option{qthresh}. Valid value ranges from 1 to 63.
+
+@item superres_kf_qthresh
+The q level threshold after which superres is used for key frames when
+@option{superres-mode} is @option{qthresh}. Valid value ranges from 1 to 63.
+
 @end table
 
 @section libkvazaar
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 1c78da719a..17e130d8ec 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -96,6 +96,12 @@ typedef struct AOMEncoderContext {
 int enable_restoration;
 int usage;
 int tune;
+int enable_superres;
+int superres_mode;
+int superres_denominator;
+int superres_qthresh;
+int superres_kf_denominator;
+int superres_kf_qthresh;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -135,6 +141,7 @@ static const char *const ctlidstr[] = {
 #endif
 [AV1E_SET_ENABLE_CDEF]  = "AV1E_SET_ENABLE_CDEF",
 [AOME_SET_TUNING]   = "AOME_SET_TUNING",
+[AV1E_SET_ENABLE_SUPERRES]  = "AV1E_SET_ENABLE_SUPERRES",
 };
 
 static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -204,6 +211,13 @@ static av_cold void dump_enc_cfg(AVCodecContext *avctx,
width, "tile_width_count:",  cfg->tile_width_count,
width, "tile_height_count:", cfg->tile_height_count);
 av_log(avctx, level, "\n");
+av_log(avctx, level, "super resolution settings\n"
+ "  %*s%u\n  %*s%u\n  %*s%u\n  %*s%u\n  %*s%u\n  ",
+   width, "rc_superres_mode:",   cfg->rc_superres_mode,
+   width, "rc_superres_denominator:",cfg->rc_superres_denominator,
+   width, "rc_superres_qthresh:",cfg->rc_superres_qthresh,
+   width, "rc_superres_kf_denominator:", 
cfg->rc_superres_kf_denominator,
+   width, "rc_superres_kf_qthresh:", cfg->rc_superres_kf_qthresh);
 }
 
 static void coded_frame_add(void *list, struct FrameListData *cx_frame)
@@ -546,6 +560,17 @@ static av_cold int aom_init(AVCodecContext *avctx,
 return AVERROR(EINVAL);
 }
 
+if (ctx->superres_mode >= 0)
+enccfg.rc_superres_mode = ctx->superres_mode;
+if (ctx->superres_qthresh > 0)
+enccfg.rc_superres_qthresh = ctx->superres_qthresh;
+if (ctx->superres_kf_qthresh > 0)
+enccfg.rc_superres_kf_qthresh = ctx->superres_kf_qthresh;
+if (ctx->superres_denominator >= 8)
+enccfg.rc_superres_denominator = ctx->superres_denominator;
+if (ctx->superres_kf_denominator >= 8)
+enccfg.rc_superres_kf_denominator = ctx->superres_kf_denominator;
+
 dump_enc_cfg(avctx, &enccfg);
 
 enccfg.g_w= avctx->width;
@@ -688,6 +713,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
 // codec control failures are currently treated only as warnings
 av_log(avctx, AV_LOG_DEBUG, "aom_codec_control\n");
 codecctl_int(avctx, AOME_SET_CPUUSED, ctx->cpu_used);
+if (ctx->enable_superres >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_SUPERRES, ctx->enable_superres);
 if (ctx->auto_alt_ref >= 0)
 codecctl_int(avctx, AOME_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref);
 if (ctx->arnr_max_frames >= 0)
@@ -1107,6 +1134,17 @@ static const AVOption options[] = {
 { "tune","The metric that the encoder tunes for. Automatically 
chosen by the encoder by default", OFFSET(tune), AV_OPT_T

[FFmpeg-devel] [PATCH 3/5] libavcodec/libaomenc.c: Add command-line options for intra-coding tools

2020-06-25 Thread Wang Cao
Signed-off-by: Wang Cao 
---
 doc/encoders.texi  | 21 +++
 libavcodec/libaomenc.c | 47 --
 libavcodec/version.h   |  2 +-
 3 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 6513f6c3ef..f052d68c46 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1647,6 +1647,27 @@ Enable 1:4/4:1 partitions. Default is true.
 @item enable-ab-partitions (@emph{boolean})
 Enable AB shape partitions. Default is true.
 
+@item enable-angle-delta (@emph{boolean})
+Enable angle delta intra prediction. Default is true.
+
+@item enable-cfl-intra (@emph{boolean})
+Enable chroma predicted from luma intra prediction. Default is true.
+
+@item enable-filter-intra (@emph{boolean})
+Enable filter intra predictor. Default is true.
+
+@item enable-intra-edge-filter (@emph{boolean})
+Enable intra edge filter. Default is true.
+
+@item enable-smooth-intra (@emph{boolean})
+Enable smooth intra prediction mode. Default is true.
+
+@item enable-paeth-intra (@emph{boolean})
+Enable paeth predictor in intra prediction. Default is true.
+
+@item enable-palette (@emph{boolean})
+Enable palette prediction mode. Default is true.
+
 @end table
 
 
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index ab2f456518..d1615e75c6 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -105,6 +105,13 @@ typedef struct AOMEncoderContext {
 int enable_rect_partitions;
 int enable_1to4_partitions;
 int enable_ab_partitions;
+int enable_angle_delta;
+int enable_cfl_intra;
+int enable_paeth_intra;
+int enable_smooth_intra;
+int enable_intra_edge_filter;
+int enable_palette;
+int enable_filter_intra;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -142,12 +149,19 @@ static const char *const ctlidstr[] = {
 #ifdef AOM_CTRL_AV1E_SET_ENABLE_INTRABC
 [AV1E_SET_ENABLE_INTRABC]   = "AV1E_SET_ENABLE_INTRABC",
 #endif
-[AV1E_SET_ENABLE_CDEF]  = "AV1E_SET_ENABLE_CDEF",
-[AOME_SET_TUNING]   = "AOME_SET_TUNING",
-[AV1E_SET_ENABLE_SUPERRES]  = "AV1E_SET_ENABLE_SUPERRES",
-[AV1E_SET_ENABLE_1TO4_PARTITIONS] = "AV1E_SET_ENABLE_1TO4_PARTITIONS",
-[AV1E_SET_ENABLE_AB_PARTITIONS]   = "AV1E_SET_ENABLE_AB_PARTITIONS",
-[AV1E_SET_ENABLE_RECT_PARTITIONS] = "AV1E_SET_ENABLE_RECT_PARTITIONS",
+[AV1E_SET_ENABLE_CDEF]  = "AV1E_SET_ENABLE_CDEF",
+[AOME_SET_TUNING]   = "AOME_SET_TUNING",
+[AV1E_SET_ENABLE_SUPERRES]  = "AV1E_SET_ENABLE_SUPERRES",
+[AV1E_SET_ENABLE_1TO4_PARTITIONS]   = "AV1E_SET_ENABLE_1TO4_PARTITIONS",
+[AV1E_SET_ENABLE_AB_PARTITIONS] = "AV1E_SET_ENABLE_AB_PARTITIONS",
+[AV1E_SET_ENABLE_RECT_PARTITIONS]   = "AV1E_SET_ENABLE_RECT_PARTITIONS",
+[AV1E_SET_ENABLE_ANGLE_DELTA]   = "AV1E_SET_ENABLE_ANGLE_DELTA",
+[AV1E_SET_ENABLE_CFL_INTRA] = "AV1E_SET_ENABLE_CFL_INTRA",
+[AV1E_SET_ENABLE_FILTER_INTRA]  = "AV1E_SET_ENABLE_FILTER_INTRA",
+[AV1E_SET_ENABLE_INTRA_EDGE_FILTER] = "AV1E_SET_ENABLE_INTRA_EDGE_FILTER",
+[AV1E_SET_ENABLE_PAETH_INTRA]   = "AV1E_SET_ENABLE_PAETH_INTRA",
+[AV1E_SET_ENABLE_SMOOTH_INTRA]  = "AV1E_SET_ENABLE_SMOOTH_INTRA",
+[AV1E_SET_ENABLE_PALETTE]   = "AV1E_SET_ENABLE_PALETTE",
 };
 
 static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -737,6 +751,20 @@ static av_cold int aom_init(AVCodecContext *avctx,
 codecctl_int(avctx, AV1E_SET_ENABLE_1TO4_PARTITIONS, 
ctx->enable_1to4_partitions);
 if (ctx->enable_ab_partitions >= 0)
 codecctl_int(avctx, AV1E_SET_ENABLE_AB_PARTITIONS, 
ctx->enable_ab_partitions);
+if (ctx->enable_angle_delta >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_ANGLE_DELTA, 
ctx->enable_angle_delta);
+if (ctx->enable_cfl_intra >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_CFL_INTRA, ctx->enable_cfl_intra);
+if (ctx->enable_filter_intra >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_FILTER_INTRA, 
ctx->enable_filter_intra);
+if (ctx->enable_intra_edge_filter >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_INTRA_EDGE_FILTER, 
ctx->enable_intra_edge_filter);
+if (ctx->enable_paeth_intra >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_PAETH_INTRA, 
ctx->enable_paeth_intra);
+if (ctx->enable_smooth_intra >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTRA, 
ctx->enable_smooth_intra);
+if (ctx->enable_palette >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_PALETTE, ctx->enable_palette);
 
 codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
 if (ctx->crf >= 0)
@@ -1160,6 +1188,13 @@ static const AVOption options[] = {
 { "enable-rect-partitions", "Enable rectangular partitions", 
OFFSET(enable_rect_partitions), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
 { "enable-1to4-partitions", "Enable 1:4/4:1 partitions", 
OFFSET(enable_1to4_partitions), AV

[FFmpeg-devel] [PATCH 4/5] libavcodec/libaomenc.c: Add command-line options for tx tools.

2020-06-25 Thread Wang Cao
Signed-off-by: Wang Cao 
---
 doc/encoders.texi  | 21 +
 libavcodec/libaomenc.c | 31 +++
 libavcodec/version.h   |  2 +-
 3 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index f052d68c46..329c887ce0 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1668,6 +1668,27 @@ Enable paeth predictor in intra prediction. Default is 
true.
 @item enable-palette (@emph{boolean})
 Enable palette prediction mode. Default is true.
 
+@item enable-flip-idtx (@emph{boolean})
+Enable extended transform type (0: false, 1: true (default))
+including FLIPADST_DCT, DCT_FLIPADST, FLIPADST_FLIPADST,
+ADST_FLIPADST, FLIPADST_ADST, IDTX, V_DCT, H_DCT, V_ADST,
+ H_ADST, V_FLIPADST, H_FLIPADST
+
+@item enable-tx64 (@emph{boolean})
+Enable 64-pt transform (0: false, 1: true (default))
+
+@item reduced-tx-type-set (@emph{boolean})
+Use reduced set of transform types. Default is false.
+
+@item use-intra-dct-only (@emph{boolean})
+Use DCT only for INTRA modes. Default is false.
+
+@item use-inter-dct-only (@emph{boolean})
+Use DCT only for INTER modes. Default is false.
+
+@item use-intra-default-tx-only (@emph{boolean})
+Use Default-transform only for INTRA modes. Default is false.
+
 @end table
 
 
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index d1615e75c6..745d7e09fc 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -112,6 +112,12 @@ typedef struct AOMEncoderContext {
 int enable_intra_edge_filter;
 int enable_palette;
 int enable_filter_intra;
+int enable_flip_idtx;
+int enable_tx64;
+int reduced_tx_type_set;
+int use_intra_dct_only;
+int use_inter_dct_only;
+int use_intra_default_tx_only;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -162,6 +168,12 @@ static const char *const ctlidstr[] = {
 [AV1E_SET_ENABLE_PAETH_INTRA]   = "AV1E_SET_ENABLE_PAETH_INTRA",
 [AV1E_SET_ENABLE_SMOOTH_INTRA]  = "AV1E_SET_ENABLE_SMOOTH_INTRA",
 [AV1E_SET_ENABLE_PALETTE]   = "AV1E_SET_ENABLE_PALETTE",
+[AV1E_SET_ENABLE_FLIP_IDTX]  = "AV1E_SET_ENABLE_FLIP_IDTX",
+[AV1E_SET_ENABLE_TX64]   = "AV1E_SET_ENABLE_TX64",
+[AV1E_SET_INTRA_DCT_ONLY]= "AV1E_SET_INTRA_DCT_ONLY",
+[AV1E_SET_INTER_DCT_ONLY]= "AV1E_SET_INTER_DCT_ONLY",
+[AV1E_SET_INTRA_DEFAULT_TX_ONLY] = "AV1E_SET_INTRA_DEFAULT_TX_ONLY",
+[AV1E_SET_REDUCED_TX_TYPE_SET]   = "AV1E_SET_REDUCED_TX_TYPE_SET",
 };
 
 static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -765,6 +777,19 @@ static av_cold int aom_init(AVCodecContext *avctx,
 codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTRA, 
ctx->enable_smooth_intra);
 if (ctx->enable_palette >= 0)
 codecctl_int(avctx, AV1E_SET_ENABLE_PALETTE, ctx->enable_palette);
+if (ctx->enable_tx64 >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_TX64, ctx->enable_tx64);
+if (ctx->enable_flip_idtx >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_FLIP_IDTX, ctx->enable_flip_idtx);
+if (ctx->use_intra_dct_only >= 0)
+codecctl_int(avctx, AV1E_SET_INTRA_DCT_ONLY, ctx->use_intra_dct_only);
+if (ctx->use_inter_dct_only >= 0)
+codecctl_int(avctx, AV1E_SET_INTER_DCT_ONLY, ctx->use_inter_dct_only);
+if (ctx->use_intra_default_tx_only >= 0)
+codecctl_int(avctx, AV1E_SET_INTRA_DEFAULT_TX_ONLY, 
ctx->use_intra_default_tx_only);
+if (ctx->reduced_tx_type_set >= 0)
+codecctl_int(avctx, AV1E_SET_REDUCED_TX_TYPE_SET, 
ctx->reduced_tx_type_set);
+
 
 codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
 if (ctx->crf >= 0)
@@ -1195,6 +1220,12 @@ static const AVOption options[] = {
 { "enable-smooth-intra",  "Enable smooth intra prediction mode",   
 OFFSET(enable_smooth_intra),  AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 
1, VE},
 { "enable-paeth-intra",   "Enable paeth predictor in intra 
prediction", OFFSET(enable_paeth_intra),   AV_OPT_TYPE_BOOL, {.i64 
= -1}, -1, 1, VE},
 { "enable-palette",   "Enable palette prediction mode",
 OFFSET(enable_palette),   AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 
1, VE},
+{ "enable-flip-idtx",  "Enable extended transform type",   
OFFSET(enable_flip_idtx),  AV_OPT_TYPE_BOOL, {.i64 = -1}, 
-1, 1, VE},
+{ "enable-tx64",   "Enable 64-pt transform",   
OFFSET(enable_tx64),   AV_OPT_TYPE_BOOL, {.i64 = -1}, 
-1, 1, VE},
+{ "reduced-tx-type-set",   "Use reduced set of transform types. 
Default is false", OFFSET(reduced_tx_type_set),   AV_OPT_TYPE_BOOL, {.i64 = 
-1}, -1, 1, VE},
+{ "use-intra-dct-only","Use DCT only for INTRA modes", 
OFFSET(use_intra_dct_only),AV_OPT_TYPE_BOOL, {.i64 = -1}, 
-1, 1, VE},
+{ "use-inter-dct-only","Us

[FFmpeg-devel] [PATCH 5/5] libavcodec/libaomenc.c: Add command-line options for inter-coding tools

2020-06-25 Thread Wang Cao
Signed-off-by: Wang Cao 
---
 doc/encoders.texi  | 36 +
 libavcodec/libaomenc.c | 61 ++
 libavcodec/version.h   |  2 +-
 3 files changed, 98 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 329c887ce0..c1c5a9c9ca 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1689,6 +1689,42 @@ Use DCT only for INTER modes. Default is false.
 @item use-intra-default-tx-only (@emph{boolean})
 Use Default-transform only for INTRA modes. Default is false.
 
+@item enable-ref-frame-mvs (@emph{boolean})
+Enable temporal mv prediction (default is 1)
+
+@item enable-reduced-reference-set (@emph{boolean})
+Use reduced set of single and compound references  (0: off (default), 1: on)
+
+@item enable-obmc (@emph{boolean})
+Enable obmc (0: false, 1: true (default))
+
+@item enable-dual-filter (@emph{boolean})
+Enable dual filter (0: false, 1: true (default))
+
+@item enable-diff-wtd-comp (@emph{boolean})
+Enable difference-weighted compound (0: false, 1: true (default))
+
+@item enable-dist-wtd-comp (@emph{boolean})
+Enable distance-weighted compound (0: false, 1: true (default))
+
+@item enable-onesided-comp (@emph{boolean})
+Enable one sided compound (0: false, 1: true (default))
+
+@item enable-interinter-wedge (@emph{boolean})
+Enable interinter wedge compound (0: false, 1: true (default))
+
+@item enable-interintra-wedge (@emph{boolean})
+Enable interintra wedge compound (0: false, 1: true (default))
+
+@item enable-masked-comp (@emph{boolean})
+Enable masked compound (0: false, 1: true (default))
+
+@item enable-interintra-comp (@emph{boolean})
+Enable interintra compound (0: false, 1: true (default))
+
+@item enable-smooth-interintra (@emph{boolean})
+Enable smooth interintra mode (0: false, 1: true (default))
+
 @end table
 
 
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 745d7e09fc..3eed019ef3 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -118,6 +118,18 @@ typedef struct AOMEncoderContext {
 int use_intra_dct_only;
 int use_inter_dct_only;
 int use_intra_default_tx_only;
+int enable_ref_frame_mvs;
+int enable_interinter_wedge;
+int enable_interintra_wedge;
+int enable_interintra_comp;
+int enable_masked_comp;
+int enable_obmc;
+int enable_onesided_comp;
+int enable_reduced_reference_set;
+int enable_smooth_interintra;
+int enable_diff_wtd_comp;
+int enable_dist_wtd_comp;
+int enable_dual_filter;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -174,6 +186,19 @@ static const char *const ctlidstr[] = {
 [AV1E_SET_INTER_DCT_ONLY]= "AV1E_SET_INTER_DCT_ONLY",
 [AV1E_SET_INTRA_DEFAULT_TX_ONLY] = "AV1E_SET_INTRA_DEFAULT_TX_ONLY",
 [AV1E_SET_REDUCED_TX_TYPE_SET]   = "AV1E_SET_REDUCED_TX_TYPE_SET",
+[AV1E_SET_ALLOW_WARPED_MOTION]  = "AV1E_SET_ALLOW_WARPED_MOTION",
+[AV1E_SET_ENABLE_DIFF_WTD_COMP] = "AV1E_SET_ENABLE_DIFF_WTD_COMP",
+[AV1E_SET_ENABLE_DIST_WTD_COMP] = "AV1E_SET_ENABLE_DIST_WTD_COMP",
+[AV1E_SET_ENABLE_DUAL_FILTER]   = "AV1E_SET_ENABLE_DUAL_FILTER",
+[AV1E_SET_ENABLE_INTERINTER_WEDGE]  = "AV1E_SET_ENABLE_INTERINTER_WEDGE",
+[AV1E_SET_ENABLE_INTERINTRA_WEDGE]  = "AV1E_SET_ENABLE_INTERINTRA_WEDGE",
+[AV1E_SET_ENABLE_MASKED_COMP]   = "AV1E_SET_ENABLE_MASKED_COMP",
+[AV1E_SET_ENABLE_INTERINTRA_COMP]   = "AV1E_SET_ENABLE_INTERINTRA_COMP",
+[AV1E_SET_ENABLE_OBMC]  = "AV1E_SET_ENABLE_OBMC",
+[AV1E_SET_ENABLE_ONESIDED_COMP] = "AV1E_SET_ENABLE_ONESIDED_COMP",
+[AV1E_SET_REDUCED_REFERENCE_SET]= "AV1E_SET_REDUCED_REFERENCE_SET",
+[AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
+[AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
 };
 
 static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -789,6 +814,30 @@ static av_cold int aom_init(AVCodecContext *avctx,
 codecctl_int(avctx, AV1E_SET_INTRA_DEFAULT_TX_ONLY, 
ctx->use_intra_default_tx_only);
 if (ctx->reduced_tx_type_set >= 0)
 codecctl_int(avctx, AV1E_SET_REDUCED_TX_TYPE_SET, 
ctx->reduced_tx_type_set);
+if (ctx->enable_ref_frame_mvs >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_REF_FRAME_MVS, 
ctx->enable_ref_frame_mvs);
+if (ctx->enable_reduced_reference_set >= 0)
+codecctl_int(avctx, AV1E_SET_REDUCED_REFERENCE_SET, 
ctx->enable_reduced_reference_set);
+if (ctx->enable_diff_wtd_comp >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_DIFF_WTD_COMP, 
ctx->enable_diff_wtd_comp);
+if (ctx->enable_dist_wtd_comp >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_DIST_WTD_COMP, 
ctx->enable_dist_wtd_comp);
+if (ctx->enable_dual_filter >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_DUAL_FILTER, 
ctx->enable_dual_filter);
+if (ctx->enable_interinter_wedge >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_INTERINTER_W

[FFmpeg-devel] [PATCH 2/5] libavcodec/libaomenc: Add command-line options to control the use of partition tools.

2020-06-25 Thread Wang Cao
This patch adds the control for enabling rectangular partitions, 1:4/4:1
partitions and AB shape partitions.

Signed-off-by: Wang Cao 
---
 doc/encoders.texi  | 10 ++
 libavcodec/libaomenc.c | 15 +++
 libavcodec/version.h   |  2 +-
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 045535accb..6513f6c3ef 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1638,8 +1638,18 @@ is @option{qthresh}. Valid value ranges from 1 to 63.
 The q level threshold after which superres is used for key frames when
 @option{superres-mode} is @option{qthresh}. Valid value ranges from 1 to 63.
 
+@item enable-rect-partitions (@emph{boolean})
+Enable rectangular partitions. Default is true.
+
+@item enable-1to4-partitions (@emph{boolean})
+Enable 1:4/4:1 partitions. Default is true.
+
+@item enable-ab-partitions (@emph{boolean})
+Enable AB shape partitions. Default is true.
+
 @end table
 
+
 @section libkvazaar
 
 Kvazaar H.265/HEVC encoder.
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 17e130d8ec..ab2f456518 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -102,6 +102,9 @@ typedef struct AOMEncoderContext {
 int superres_qthresh;
 int superres_kf_denominator;
 int superres_kf_qthresh;
+int enable_rect_partitions;
+int enable_1to4_partitions;
+int enable_ab_partitions;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -142,6 +145,9 @@ static const char *const ctlidstr[] = {
 [AV1E_SET_ENABLE_CDEF]  = "AV1E_SET_ENABLE_CDEF",
 [AOME_SET_TUNING]   = "AOME_SET_TUNING",
 [AV1E_SET_ENABLE_SUPERRES]  = "AV1E_SET_ENABLE_SUPERRES",
+[AV1E_SET_ENABLE_1TO4_PARTITIONS] = "AV1E_SET_ENABLE_1TO4_PARTITIONS",
+[AV1E_SET_ENABLE_AB_PARTITIONS]   = "AV1E_SET_ENABLE_AB_PARTITIONS",
+[AV1E_SET_ENABLE_RECT_PARTITIONS] = "AV1E_SET_ENABLE_RECT_PARTITIONS",
 };
 
 static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -725,6 +731,12 @@ static av_cold int aom_init(AVCodecContext *avctx,
 codecctl_int(avctx, AV1E_SET_ENABLE_CDEF, ctx->enable_cdef);
 if (ctx->enable_restoration >= 0)
 codecctl_int(avctx, AV1E_SET_ENABLE_RESTORATION, 
ctx->enable_restoration);
+if (ctx->enable_rect_partitions >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_RECT_PARTITIONS, 
ctx->enable_rect_partitions);
+if (ctx->enable_1to4_partitions >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_1TO4_PARTITIONS, 
ctx->enable_1to4_partitions);
+if (ctx->enable_ab_partitions >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_AB_PARTITIONS, 
ctx->enable_ab_partitions);
 
 codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
 if (ctx->crf >= 0)
@@ -1145,6 +1157,9 @@ static const AVOption options[] = {
 { "superres-qthresh","The q level threshold after which superres 
is used, range [1, 63]",OFFSET(superres_qthresh),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 63, VE},
 { "superres-kf-denominator", "The denominator for superres to use on key 
frames, range [8, 16]", OFFSET(superres_kf_denominator), 
AV_OPT_TYPE_INT, {.i64 = 8}, 8, 16, VE},
 { "superres-kf-qthresh", "The q level threshold after which superres 
is used for key frames, range [1, 63]", OFFSET(superres_kf_qthresh), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 63, VE},
+{ "enable-rect-partitions", "Enable rectangular partitions", 
OFFSET(enable_rect_partitions), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+{ "enable-1to4-partitions", "Enable 1:4/4:1 partitions", 
OFFSET(enable_1to4_partitions), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+{ "enable-ab-partitions",   "Enable ab shape partitions",
OFFSET(enable_ab_partitions),   AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
 { NULL },
 };
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 05f59901ff..c9ce7981b5 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  93
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
-- 
2.27.0.111.gc72c7da667-goog

___
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 5/6] avformat/aviobuf: INT_MAX -> AV_BPRINT_SIZE_UNLIMITED

2020-06-25 Thread Andreas Rheinhardt
lance.lmw...@gmail.com:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavformat/aviobuf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index a77517d..1e32c0c 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -1191,7 +1191,7 @@ int avio_printf(AVIOContext *s, const char *fmt, ...)
>  va_list ap;
>  AVBPrint bp;
>  
> -av_bprint_init(&bp, 0, INT_MAX);
> +av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED);
>  va_start(ap, fmt);
>  av_vbprintf(&bp, fmt, ap);
>  va_end(ap);
> 
This function returns an int containing either the number of bytes
written or an error code. Ergo the number of bytes written must be in
the range 0..INT_MAX.

- Andreas
___
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 4/6] avutil/bprint: use AV_BPRINT_SIZE_AUTOMATIC instead of 1

2020-06-25 Thread Nicolas George
lance.lmw...@gmail.com (12020-06-26):
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavutil/bprint.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

No to gratuitous changes that pollute the log for no benefit:
AV_BPRINT_SIZE_AUTOMATIC = 1 is documented and part of the API.

Regards,

-- 
  Nicolas George


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 4/6] avutil/bprint: use AV_BPRINT_SIZE_AUTOMATIC instead of 1

2020-06-25 Thread Soft Works


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Nicolas George
> Sent: Friday, June 26, 2020 7:17 AM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Cc: Limin Wang 
> Subject: Re: [FFmpeg-devel] [PATCH 4/6] avutil/bprint: use
> AV_BPRINT_SIZE_AUTOMATIC instead of 1
> 
> lance.lmw...@gmail.com (12020-06-26):
> > From: Limin Wang 
> >
> > Signed-off-by: Limin Wang 
> > ---
> >  libavutil/bprint.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> No to gratuitous changes that pollute the log for no benefit:
> AV_BPRINT_SIZE_AUTOMATIC = 1 is documented and part of the API.

Isn't it a clear benefit to have a named constant where the name
of the constant indicates a meaning while a plain number does not?

softworkz
___
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 5/5] libavcodec/jpeg2000dec.c: Remove log2_chroma check in pixel format selection

2020-06-25 Thread Gautam Ramakrishnan
On Fri, Jun 26, 2020 at 3:14 AM Michael Niedermayer
 wrote:
>
> On Fri, Jun 26, 2020 at 12:22:22AM +0530, Gautam Ramakrishnan wrote:
> > On Tue, Jun 23, 2020 at 8:04 AM Gautam Ramakrishnan
> >  wrote:
> > >
> > > On Tue, Jun 23, 2020 at 2:55 AM Carl Eugen Hoyos  
> > > wrote:
> > > >
> > > > Am Mo., 22. Juni 2020 um 04:57 Uhr schrieb Gautam Ramakrishnan
> > > > :
> > > > >
> > > > > On Mon, Jun 22, 2020 at 1:54 AM Carl Eugen Hoyos  
> > > > > wrote:
> > > > > >
> > > > > > Am So., 21. Juni 2020 um 21:11 Uhr schrieb :
> > > > > > >
> > > > > > > From: Gautam Ramakrishnan 
> > > > > > >
> > > > > > > The log2_chroma_wh is derived from the sample separations of the
> > > > > > > codestream if the file is a j2k codestream. Not sure if sample
> > > > > > > separation is same is subsampling and whether using sample
> > > > > > > separation values from the codestream to determine pixel format.
> > > > > >
> > > > > > What would get fixed by this change?
> > > > > >
> > > > > The p1_01.j2k image was not getting recognized by the native
> > > > > decoder due to this condition.
> > > >
> > > > In any case, this was missing from the commit message.
> > > >
> > > > > It would now get recognized. If this patch is fine,
> > > >
> > > > I wanted to suggest to add the following two lines after
> > > > the calls to pix_fmt_guess():
> > > > if (s->avctx->pix_fmt == AV_PIX_FMT_NONE && ncomponents == 1)
> > > > s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
> > > >
> > > I had tried this for testing initially. I placed this inside the
> > > if (i == possible_fmts_nb) check. It seemed to work correctly.
> > > I could possibly resend with this also, but I did not know this would
> > > be a good solution.
> > > > But p1_01.j2k does not get decoded with the change either here.
> > > >
> > > > > I would preferably remove this check at all places.
> > > >
> > > > I thought the check is needed but if fuzzing does not produce
> > > > invalid memory access for you, it may be ok.
> > > >
> > > I'll run the fuzzer again carefully.
> > I ran the fuzzer (zzuf) where I ran ffmpeg with input files p1_01.j2k
> > and p1_07.j2k.
> > I tried with seeds from 0 to 1.
> > I tried error rates of 0.01, 0.1 and 0.5. There was no segfault. I
> > used the -c option as
> > I only wanted it to fuzz the .j2k files. I hope my configuration while
> > using zzuf was correct.
>
> from my command line history, i tested
> zzuf -C9 -s 0:100 ./ffmpeg -v -99 -i p1_07.j2k
>
> zzuf[s=8,r=0.004]: signal 11 (SIGSEGV)
> zzuf[s=12,r=0.004]: signal 11 (SIGSEGV)
> zzuf[s=52,r=0.004]: signal 11 (SIGSEGV)
> zzuf[s=81,r=0.004]: signal 11 (SIGSEGV)
> zzuf[s=93,r=0.004]: signal 11 (SIGSEGV)
> zzuf[s=97,r=0.004]: signal 11 (SIGSEGV)
>
> i didnt investigate these at all yet so they may be unrelated to the j2k
> decoder, but there where segfaults ...

I tried the same command. However, even if I remove the input file from ffmpeg,
i.e run
zzuf -C9 -s 0:100 ./ffmpeg -v -99, I get segfaults.
Is it possible that ffmpeg reads some other files which is getting fuzzed?
In a tutorial, I saw that using -c command line option with zzuf will ensure
only files which show up on command line will get fuzzed. When I run with
the -c argument, I get no segfaults
>
> thx
>





--
-
Gautam |
___
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".