[FFmpeg-cvslog] avcodec/exr: initialize axmax and bxmin to 0

2020-09-12 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Sep 12 10:06:35 
2020 +0200| [a406dde1d21b9f253f996e94a2fd2045898f9c37] | committer: Paul B Mahol

avcodec/exr: initialize axmax and bxmin to 0

They can be used uninitialized.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a406dde1d21b9f253f996e94a2fd2045898f9c37
---

 libavcodec/exr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index d5f12cb22a..829d38143d 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -999,7 +999,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
 uint64_t tile_x, tile_y, tile_level_x, tile_level_y;
 const uint8_t *src;
 int step = s->desc->flags & AV_PIX_FMT_FLAG_FLOAT ? 4 : 2 * 
s->desc->nb_components;
-int bxmin, axmax, window_xoffset = 0;
+int bxmin = 0, axmax = 0, window_xoffset = 0;
 int window_xmin, window_xmax, window_ymin, window_ymax;
 int data_xoffset, data_yoffset, data_window_offset, xsize, ysize;
 int i, x, buf_size = s->buf_size;

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

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

[FFmpeg-cvslog] dnn/openvino: add input/output name info

2020-09-12 Thread Ting Fu
ffmpeg | branch: master | Ting Fu  | Wed Sep  9 09:52:19 
2020 +0800| [dc16aeb3904654c95d613d6277c27a9461ef1991] | committer: Guo, Yejun

dnn/openvino: add input/output name info

show all input/output names when the input or output name not correct

Signed-off-by: Ting Fu 
Signed-off-by: Guo, Yejun 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dc16aeb3904654c95d613d6277c27a9461ef1991
---

 libavfilter/dnn/dnn_backend_openvino.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/libavfilter/dnn/dnn_backend_openvino.c 
b/libavfilter/dnn/dnn_backend_openvino.c
index 2f0998046a..e5842906d1 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -79,6 +79,7 @@ static DNNReturnType get_input_ov(void *model, DNNData 
*input, const char *input
 OVModel *ov_model = (OVModel *)model;
 OVContext *ctx = &ov_model->ctx;
 char *model_input_name = NULL;
+char *all_input_names = NULL;
 IEStatusCode status;
 size_t model_input_count = 0;
 dimensions_t dims;
@@ -118,12 +119,15 @@ static DNNReturnType get_input_ov(void *model, DNNData 
*input, const char *input
 input->width= dims.dims[3];
 input->dt   = precision_to_datatype(precision);
 return DNN_SUCCESS;
+} else {
+//incorrect input name
+APPEND_STRING(all_input_names, model_input_name)
 }
 
 ie_network_name_free(&model_input_name);
 }
 
-av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model\n", 
model_input_name);
+av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model, all input(s) 
are: \"%s\"\n", input_name, all_input_names);
 return DNN_ERROR;
 }
 
@@ -246,12 +250,15 @@ err:
 
 DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, DNNData *outputs, 
const char **output_names, uint32_t nb_output)
 {
+char *model_output_name = NULL;
+char *all_output_names = NULL;
 dimensions_t dims;
 precision_e precision;
 ie_blob_buffer_t blob_buffer;
 OVModel *ov_model = (OVModel *)model->model;
 OVContext *ctx = &ov_model->ctx;
 IEStatusCode status = ie_infer_request_infer(ov_model->infer_request);
+size_t model_output_count = 0;
 if (status != OK) {
 av_log(ctx, AV_LOG_ERROR, "Failed to start synchronous model 
inference\n");
 return DNN_ERROR;
@@ -262,7 +269,16 @@ DNNReturnType ff_dnn_execute_model_ov(const DNNModel 
*model, DNNData *outputs, c
 ie_blob_t *output_blob = NULL;
 status = ie_infer_request_get_blob(ov_model->infer_request, 
output_name, &output_blob);
 if (status != OK) {
+//incorrect output name
 av_log(ctx, AV_LOG_ERROR, "Failed to get model output data\n");
+status = ie_network_get_outputs_number(ov_model->network, 
&model_output_count);
+for (size_t i = 0; i < model_output_count; i++) {
+status = ie_network_get_output_name(ov_model->network, i, 
&model_output_name);
+APPEND_STRING(all_output_names, model_output_name)
+}
+av_log(ctx, AV_LOG_ERROR,
+   "output \"%s\" may not correct, all output(s) are: 
\"%s\"\n",
+   output_name, all_output_names);
 return DNN_ERROR;
 }
 

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

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

[FFmpeg-cvslog] dnn/openvino: support run inference via GPU

2020-09-12 Thread Ting Fu
ffmpeg | branch: master | Ting Fu  | Wed Sep  9 09:52:18 
2020 +0800| [87cb24a1ca4a76e5a5a9969e3058a94d952e1b37] | committer: Guo, Yejun

dnn/openvino: support run inference via GPU

for enabling OpenVINO GPU please:
1. install required OpenCL drivers, see: 
https://github.com/intel/compute-runtime/releases/tag/19.41.14441
2. build OpenVINO c lib with GPU enabled: use cmake config with: 
-DENABLE_CLDNN=ON
3. then make, and include the OpenVINO c lib in environment variables
detailed steps please refer: 
https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md

inference model with GPU please add: optioins=device=GPU

Signed-off-by: Ting Fu 
Signed-off-by: Guo, Yejun 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=87cb24a1ca4a76e5a5a9969e3058a94d952e1b37
---

 libavfilter/dnn/dnn_backend_openvino.c | 52 --
 1 file changed, 44 insertions(+), 8 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_openvino.c 
b/libavfilter/dnn/dnn_backend_openvino.c
index 5d6d3ed542..2f0998046a 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -26,10 +26,18 @@
 #include "dnn_backend_openvino.h"
 #include "libavformat/avio.h"
 #include "libavutil/avassert.h"
+#include "libavutil/opt.h"
+#include "libavutil/avstring.h"
+#include "../internal.h"
 #include 
 
+typedef struct OVOptions{
+char *device_type;
+} OVOptions;
+
 typedef struct OVContext {
 const AVClass *class;
+OVOptions options;
 } OVContext;
 
 typedef struct OVModel{
@@ -41,14 +49,19 @@ typedef struct OVModel{
 ie_blob_t *input_blob;
 } OVModel;
 
-static const AVClass dnn_openvino_class = {
-.class_name = "dnn_openvino",
-.item_name  = av_default_item_name,
-.option = NULL,
-.version= LIBAVUTIL_VERSION_INT,
-.category   = AV_CLASS_CATEGORY_FILTER,
+#define APPEND_STRING(generated_string, iterate_string)
\
+generated_string = generated_string ? av_asprintf("%s %s", 
generated_string, iterate_string) : \
+  av_asprintf("%s", iterate_string);
+
+#define OFFSET(x) offsetof(OVContext, x)
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM
+static const AVOption dnn_openvino_options[] = {
+{ "device", "device to run model", OFFSET(options.device_type), 
AV_OPT_TYPE_STRING, { .str = "CPU" }, 0, 0, FLAGS },
+{ NULL }
 };
 
+AVFILTER_DEFINE_CLASS(dnn_openvino);
+
 static DNNDataType precision_to_datatype(precision_e precision)
 {
 switch (precision)
@@ -159,10 +172,13 @@ err:
 
 DNNModel *ff_dnn_load_model_ov(const char *model_filename, const char *options)
 {
+char *all_dev_names = NULL;
 DNNModel *model = NULL;
 OVModel *ov_model = NULL;
+OVContext *ctx = NULL;
 IEStatusCode status;
 ie_config_t config = {NULL, NULL, NULL};
+ie_available_devices_t a_dev;
 
 model = av_malloc(sizeof(DNNModel));
 if (!model){
@@ -173,6 +189,14 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename, 
const char *options)
 if (!ov_model)
 goto err;
 ov_model->ctx.class = &dnn_openvino_class;
+ctx = &ov_model->ctx;
+
+//parse options
+av_opt_set_defaults(ctx);
+if (av_opt_set_from_string(ctx, options, NULL, "=", "&") < 0) {
+av_log(ctx, AV_LOG_ERROR, "Failed to parse options \"%s\"\n", options);
+goto err;
+}
 
 status = ie_core_create("", &ov_model->core);
 if (status != OK)
@@ -182,9 +206,21 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename, 
const char *options)
 if (status != OK)
 goto err;
 
-status = ie_core_load_network(ov_model->core, ov_model->network, "CPU", 
&config, &ov_model->exe_network);
-if (status != OK)
+status = ie_core_load_network(ov_model->core, ov_model->network, 
ctx->options.device_type, &config, &ov_model->exe_network);
+if (status != OK) {
+av_log(ctx, AV_LOG_ERROR, "Failed to init OpenVINO model\n");
+status = ie_core_get_available_devices(ov_model->core, &a_dev);
+if (status != OK) {
+av_log(ctx, AV_LOG_ERROR, "Failed to get available devices\n");
+goto err;
+}
+for (int i = 0; i < a_dev.num_devices; i++) {
+APPEND_STRING(all_dev_names, a_dev.devices[i])
+}
+av_log(ctx, AV_LOG_ERROR,"device %s may not be supported, all 
available devices are: \"%s\"\n",
+   ctx->options.device_type, all_dev_names);
 goto err;
+}
 
 model->model = (void *)ov_model;
 model->set_input = &set_input_ov;

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

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

[FFmpeg-cvslog] lavf/mov: Remove redundant code

2020-09-12 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Fri Aug  7 
20:48:42 2020 +0800| [856363710f035b128767b1deb3926b38a089fd91] | committer: 
Jun Zhao

lavf/mov: Remove redundant code

Signed-off-by: Jun Zhao 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=856363710f035b128767b1deb3926b38a089fd91
---

 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 690beb10ce..9462af743a 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -587,7 +587,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 entries >  (atom.size - 1) / MIN_DATA_ENTRY_BOX_SIZE + 1 ||
 entries >= UINT_MAX / sizeof(*sc->drefs))
 return AVERROR_INVALIDDATA;
-sc->drefs_count = 0;
+
 av_free(sc->drefs);
 sc->drefs_count = 0;
 sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));

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

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

[FFmpeg-cvslog] avformat/brstm: fix decoding brstm with custom coeff offsets

2020-09-12 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Sep 12 14:45:31 
2020 +0200| [3382b0290a31a9e462d3f19e9590fa091b23fd4f] | committer: Paul B Mahol

avformat/brstm: fix decoding brstm with custom coeff offsets

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3382b0290a31a9e462d3f19e9590fa091b23fd4f
---

 libavformat/brstm.c | 31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index a63c7ee5ab..c4230a63bf 100644
--- a/libavformat/brstm.c
+++ b/libavformat/brstm.c
@@ -24,6 +24,11 @@
 #include "avformat.h"
 #include "internal.h"
 
+typedef struct BRSTMCoeffOffset {
+uint8_t  channel;
+uint32_t offset;
+} BRSTMCoeffOffset;
+
 typedef struct BRSTMDemuxContext {
 uint32_tblock_size;
 uint32_tblock_count;
@@ -35,6 +40,7 @@ typedef struct BRSTMDemuxContext {
 uint32_tdata_start;
 uint8_t *table;
 uint8_t *adpc;
+BRSTMCoeffOffset offsets[256];
 int little_endian;
 } BRSTMDemuxContext;
 
@@ -67,6 +73,13 @@ static int read_close(AVFormatContext *s)
 return 0;
 }
 
+static int sort_offsets(const void *a, const void *b)
+{
+const BRSTMCoeffOffset *s1 = a;
+const BRSTMCoeffOffset *s2 = b;
+return FFDIFFSIGN(s1->offset, s2->offset);
+}
+
 static av_always_inline unsigned int read16(AVFormatContext *s)
 {
 BRSTMDemuxContext *b = s->priv_data;
@@ -259,17 +272,33 @@ static int read_header(AVFormatContext *s)
 if (toffset > size)
 return AVERROR_INVALIDDATA;
 
+if (!bfstm) {
+avio_skip(s->pb, pos + toffset - avio_tell(s->pb) - 8LL * 
(st->codecpar->channels + 1));
+for (ch = 0; ch < st->codecpar->channels; ch++) {
+avio_skip(s->pb, 4);
+b->offsets[ch].channel = ch;
+b->offsets[ch].offset = read32(s);
+}
+
+qsort(b->offsets, st->codecpar->channels, sizeof(*b->offsets), 
sort_offsets);
+}
+
 avio_skip(s->pb, pos + toffset - avio_tell(s->pb));
 b->table = av_mallocz(32 * st->codecpar->channels);
 if (!b->table)
 return AVERROR(ENOMEM);
 
 for (ch = 0; ch < st->codecpar->channels; ch++) {
+if (!bfstm)
+avio_skip(s->pb, pos + 16LL + b->offsets[ch].offset - 
avio_tell(s->pb));
+
 if (avio_read(s->pb, b->table + ch * 32, 32) != 32) {
 ret = AVERROR_INVALIDDATA;
 goto fail;
 }
-avio_skip(s->pb, bfstm ? 14 : 24);
+
+if (bfstm)
+avio_skip(s->pb, 14);
 }
 }
 

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

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

[FFmpeg-cvslog] avcodec/adpcm: take into account block_align when decoding ADPCM_PSX

2020-09-12 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Sep 11 13:28:12 
2020 +0200| [ca49476ace90ddebc5f92d9d82297f77e528c21e] | committer: Paul B Mahol

avcodec/adpcm: take into account block_align when decoding ADPCM_PSX

Should reduce decoding overhead.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ca49476ace90ddebc5f92d9d82297f77e528c21e
---

 libavcodec/adpcm.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 71e37efde7..e409a3aa6a 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1966,11 +1966,13 @@ static int adpcm_decode_frame(AVCodecContext *avctx, 
void *data,
 }
 break;
 case AV_CODEC_ID_ADPCM_PSX:
+for (int block = 0; block < avpkt->size / FFMAX(avctx->block_align, 16 
* avctx->channels); block++) {
+int nb_samples_per_block = 28 * FFMAX(avctx->block_align, 16 * 
avctx->channels) / (16 * avctx->channels);
 for (channel = 0; channel < avctx->channels; channel++) {
-samples = samples_p[channel];
+samples = samples_p[channel] + block * nb_samples_per_block;
 
 /* Read in every sample for this channel.  */
-for (i = 0; i < nb_samples / 28; i++) {
+for (i = 0; i < nb_samples_per_block / 28; i++) {
 int filter, shift, flag, byte;
 
 filter = bytestream2_get_byteu(&gb);
@@ -2001,6 +2003,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void 
*data,
 }
 }
 }
+}
 break;
 case AV_CODEC_ID_ADPCM_ARGO:
 /*

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

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

[FFmpeg-cvslog] fate: use correct uint32 layer

2020-09-12 Thread Mark Reid
ffmpeg | branch: master | Mark Reid  | Sat Sep 12 02:07:13 
2020 -0700| [61d767f3a3a9b6c7cdeb509d1839b40233c2115d] | committer: Paul B Mahol

fate: use correct uint32 layer

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61d767f3a3a9b6c7cdeb509d1839b40233c2115d
---

 tests/fate/image.mak   | 2 +-
 tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index 756d01c667..69b4ea5431 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -221,7 +221,7 @@ FATE_EXR += fate-exr-rgb-scanline-pxr24-float-half-l2
 fate-exr-rgb-scanline-pxr24-float-half-l2: CMD = framecrc -layer 
"VRaySamplerInfo" -i $(TARGET_SAMPLES)/exr/rgb_scanline_pxr24_float_half.exr 
-pix_fmt gbrapf32le
 
 FATE_EXR += fate-exr-rgb-scanline-pxr24-half-uint32-13x9
-fate-exr-rgb-scanline-pxr24-half-uint32-13x9: CMD = framecrc -i 
$(TARGET_SAMPLES)/exr/rgb_scanline_pxr24_half_uint32_13x9.exr -pix_fmt rgb48le 
-vf scale
+fate-exr-rgb-scanline-pxr24-half-uint32-13x9: CMD = framecrc -layer 
"VRaySamplerInfo" -i 
$(TARGET_SAMPLES)/exr/rgb_scanline_pxr24_half_uint32_13x9.exr -pix_fmt rgb48le 
-vf scale
 
 FATE_EXR += fate-exr-rgb-scanline-zip-half-float-l1
 fate-exr-rgb-scanline-zip-half-float-l1: CMD = framecrc -i 
$(TARGET_SAMPLES)/exr/rgb_scanline_zip_half_float.exr -pix_fmt gbrpf32le
diff --git a/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 
b/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9
index 523ed9c88b..2d209d8a63 100644
--- a/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9
+++ b/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9
@@ -3,4 +3,4 @@
 #codec_id 0: rawvideo
 #dimensions 0: 13x9
 #sar 0: 9/10
-0,  0,  0,1,  702, 0x68c1450d
+0,  0,  0,1,  702, 0x86132f10

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

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

[FFmpeg-cvslog] avformat/brstm: remove custom allocation of table to hold coeffs

2020-09-12 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Sep 12 14:49:15 
2020 +0200| [60c4459075c947244961dac5d372ab6bd6591ac2] | committer: Paul B Mahol

avformat/brstm: remove custom allocation of table to hold coeffs

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=60c4459075c947244961dac5d372ab6bd6591ac2
---

 libavformat/brstm.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index c4230a63bf..6754c1712e 100644
--- a/libavformat/brstm.c
+++ b/libavformat/brstm.c
@@ -38,7 +38,7 @@ typedef struct BRSTMDemuxContext {
 uint32_tlast_block_size;
 uint32_tlast_block_samples;
 uint32_tdata_start;
-uint8_t *table;
+uint8_t table[256 * 32];
 uint8_t *adpc;
 BRSTMCoeffOffset offsets[256];
 int little_endian;
@@ -67,7 +67,6 @@ static int read_close(AVFormatContext *s)
 {
 BRSTMDemuxContext *b = s->priv_data;
 
-av_freep(&b->table);
 av_freep(&b->adpc);
 
 return 0;
@@ -284,9 +283,6 @@ static int read_header(AVFormatContext *s)
 }
 
 avio_skip(s->pb, pos + toffset - avio_tell(s->pb));
-b->table = av_mallocz(32 * st->codecpar->channels);
-if (!b->table)
-return AVERROR(ENOMEM);
 
 for (ch = 0; ch < st->codecpar->channels; ch++) {
 if (!bfstm)
@@ -422,11 +418,6 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
 av_log(s, AV_LOG_ERROR, "adpcm_thp requires ADPC chunk, but none 
was found.\n");
 return AVERROR_INVALIDDATA;
 }
-if (!b->table) {
-b->table = av_mallocz(32 * par->channels);
-if (!b->table)
-return AVERROR(ENOMEM);
-}
 
 if (size > (INT_MAX - 32 - 4) ||
 (32 + 4 + size) > (INT_MAX / par->channels) ||

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

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

[FFmpeg-cvslog] avcodec/mobiclip: Check quantizer before table setup

2020-09-12 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Sep 10 23:59:53 2020 +0200| [bad8b17a3da219777341acafd3e3113ea2477484] | 
committer: Michael Niedermayer

avcodec/mobiclip: Check quantizer before table setup

Fixes: index -1 out of bounds for type 'const uint8_t [6][16]'
Fixes: out of array read
Fixes: shift exponent -21 is negative
Fixes: 
25422/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5748258226569216
Fixes: shift exponent 8039082 is too large for 32-bit type 'int'
Fixes: 
25430/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5698567770210304

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bad8b17a3da219777341acafd3e3113ea2477484
---

 libavcodec/mobiclip.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index d147eddbae..13f0edc89d 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -1323,6 +1323,10 @@ static int mobiclip_decode(AVCodecContext *avctx, void 
*data,
 }
 } else {
 MotionXY *motion = s->motion;
+int quantizer = s->quantizer + get_se_golomb(gb);
+
+if (quantizer < 12 || quantizer > 161)
+return AVERROR_INVALIDDATA;
 
 memset(motion, 0, s->motion_size);
 
@@ -1330,7 +1334,7 @@ static int mobiclip_decode(AVCodecContext *avctx, void 
*data,
 frame->key_frame = 0;
 s->dct_tab_idx = 0;
 
-setup_qtables(avctx, s->quantizer + get_se_golomb(gb));
+setup_qtables(avctx, quantizer);
 for (int y = 0; y < avctx->height; y += 16) {
 for (int x = 0; x < avctx->width; x += 16) {
 int idx;

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

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

[FFmpeg-cvslog] avcodec/mpc: Fix multiple numerical overflows in ff_mpc_dequantize_and_synth()

2020-09-12 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
May 10 19:04:23 2020 +0200| [2b9f39689ab19c68ff37b5a4ac71e8fb7f58c487] | 
committer: Michael Niedermayer

avcodec/mpc: Fix multiple numerical overflows in ff_mpc_dequantize_and_synth()

Fixes: -2.4187e+09 is outside the range of representable values of type 'int'
Fixes: signed integer overflow: -14512205 + -2147483648 cannot be represented 
in type 'int'
Fixes: 
20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPC7_fuzzer-5747263166480384
Fixes: 
23528/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPC7_fuzzer-5747263166480384

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2b9f39689ab19c68ff37b5a4ac71e8fb7f58c487
---

 libavcodec/mpc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpc.c b/libavcodec/mpc.c
index 6cf9b9d520..e56b608d8c 100644
--- a/libavcodec/mpc.c
+++ b/libavcodec/mpc.c
@@ -75,17 +75,17 @@ void ff_mpc_dequantize_and_synth(MPCContext * c, int 
maxband, int16_t **out,
 j = 0;
 mul = (mpc_CC+1)[bands[i].res[ch]] * 
mpc_SCF[bands[i].scf_idx[ch][0] & 0xFF];
 for(; j < 12; j++)
-c->sb_samples[ch][j][i] = mul * c->Q[ch][j + off];
+c->sb_samples[ch][j][i] = av_clipf(mul * c->Q[ch][j + 
off], INT32_MIN, INT32_MAX);
 mul = (mpc_CC+1)[bands[i].res[ch]] * 
mpc_SCF[bands[i].scf_idx[ch][1] & 0xFF];
 for(; j < 24; j++)
-c->sb_samples[ch][j][i] = mul * c->Q[ch][j + off];
+c->sb_samples[ch][j][i] = av_clipf(mul * c->Q[ch][j + 
off], INT32_MIN, INT32_MAX);
 mul = (mpc_CC+1)[bands[i].res[ch]] * 
mpc_SCF[bands[i].scf_idx[ch][2] & 0xFF];
 for(; j < 36; j++)
-c->sb_samples[ch][j][i] = mul * c->Q[ch][j + off];
+c->sb_samples[ch][j][i] = av_clipf(mul * c->Q[ch][j + 
off], INT32_MIN, INT32_MAX);
 }
 }
 if(bands[i].msf){
-int t1, t2;
+unsigned t1, t2;
 for(j = 0; j < SAMPLES_PER_BAND; j++){
 t1 = c->sb_samples[0][j][i];
 t2 = c->sb_samples[1][j][i];

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

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

[FFmpeg-cvslog] avcodec/av1dec: use av_cmp_q() to compare aspect ratio

2020-09-12 Thread James Almer
ffmpeg | branch: master | James Almer  | Wed Sep  9 16:57:50 
2020 -0300| [b7a06885f1a7ac1d7f1ac4aec0fa329cbf3c524b] | committer: James Almer

avcodec/av1dec: use av_cmp_q() to compare aspect ratio

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b7a06885f1a7ac1d7f1ac4aec0fa329cbf3c524b
---

 libavcodec/av1dec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index c22606c3ef..9e71a2e5f6 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -451,8 +451,7 @@ static int update_context_with_frame_header(AVCodecContext 
*avctx,
   (int64_t)width * r_height,
   INT_MAX);
 
-if (avctx->sample_aspect_ratio.num != aspect_ratio.num ||
-avctx->sample_aspect_ratio.den != aspect_ratio.den) {
+if (av_cmp_q(avctx->sample_aspect_ratio, aspect_ratio)) {
 ret = ff_set_sar(avctx, aspect_ratio);
 if (ret < 0)
 return ret;

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

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

[FFmpeg-cvslog] avcodec: add AV1 hardware accelerated decoder

2020-09-12 Thread Fei Wang
ffmpeg | branch: master | Fei Wang  | Wed Sep  9 11:39:55 
2020 +0800| [47be5a505657f478636ff08cef45f5c4c201ad23] | committer: James Almer

avcodec: add AV1 hardware accelerated decoder

This AV1 decoder is currently only used for hardware accelerated decoding.
It can be extended into a native decoder in the future, so set its name to
"av1" and temporarily give it the lowest priority in the codec list.

Signed-off-by: Fei Wang 
Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=47be5a505657f478636ff08cef45f5c4c201ad23
---

 Changelog   |   1 +
 configure   |   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   2 +
 libavcodec/av1dec.c | 852 
 libavcodec/av1dec.h |  75 
 libavcodec/version.h|   2 +-
 tests/ref/fate/av1-annexb-demux |   2 +-
 tests/ref/lavf-fate/av1.mkv |   4 +-
 tests/ref/lavf-fate/av1.mp4 |   4 +-
 10 files changed, 938 insertions(+), 6 deletions(-)

diff --git a/Changelog b/Changelog
index cd8be931ef..b058d912ea 100644
--- a/Changelog
+++ b/Changelog
@@ -22,6 +22,7 @@ version :
 - MODS demuxer
 - PhotoCD decoder
 - MCA demuxer
+- AV1 decoder (Hardware acceleration used only)
 
 
 version 4.3:
diff --git a/configure b/configure
index ae8c6e61c8..5d68695192 100755
--- a/configure
+++ b/configure
@@ -2685,6 +2685,7 @@ atrac3al_decoder_select="mdct"
 atrac3p_decoder_select="mdct sinewin"
 atrac3pal_decoder_select="mdct sinewin"
 atrac9_decoder_select="mdct"
+av1_decoder_select="cbs_av1"
 avrn_decoder_select="exif jpegtables"
 bink_decoder_select="blockdsp hpeldsp"
 binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 98f31e246b..3239a752ac 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -228,6 +228,7 @@ OBJS-$(CONFIG_ATRAC3PAL_DECODER)   += atrac3plusdec.o 
atrac3plus.o \
 OBJS-$(CONFIG_ATRAC9_DECODER)  += atrac9dec.o
 OBJS-$(CONFIG_AURA_DECODER)+= cyuv.o
 OBJS-$(CONFIG_AURA2_DECODER)   += aura.o
+OBJS-$(CONFIG_AV1_DECODER) += av1dec.o
 OBJS-$(CONFIG_AVRN_DECODER)+= avrndec.o mjpegdec.o
 OBJS-$(CONFIG_AVRP_DECODER)+= r210dec.o
 OBJS-$(CONFIG_AVRP_ENCODER)+= r210enc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index f3572a47e3..713c5686a4 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -768,6 +768,8 @@ extern AVCodec ff_aac_mf_encoder;
 extern AVCodec ff_ac3_mf_encoder;
 extern AVCodec ff_h263_v4l2m2m_encoder;
 extern AVCodec ff_libaom_av1_decoder;
+/* hwaccel hooks only, so prefer external decoders */
+extern AVCodec ff_av1_decoder;
 extern AVCodec ff_libopenh264_encoder;
 extern AVCodec ff_libopenh264_decoder;
 extern AVCodec ff_h264_amf_encoder;
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
new file mode 100644
index 00..c22606c3ef
--- /dev/null
+++ b/libavcodec/av1dec.c
@@ -0,0 +1,852 @@
+/*
+ * AV1 video decoder
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/pixdesc.h"
+#include "avcodec.h"
+#include "av1dec.h"
+#include "get_bits.h"
+#include "hwconfig.h"
+#include "internal.h"
+#include "profiles.h"
+
+static void setup_past_independence(AV1Frame *f)
+{
+f->loop_filter_delta_enabled = 1;
+
+f->loop_filter_ref_deltas[AV1_REF_FRAME_INTRA] = 1;
+f->loop_filter_ref_deltas[AV1_REF_FRAME_LAST] = 0;
+f->loop_filter_ref_deltas[AV1_REF_FRAME_LAST2] = 0;
+f->loop_filter_ref_deltas[AV1_REF_FRAME_LAST3] = 0;
+f->loop_filter_ref_deltas[AV1_REF_FRAME_GOLDEN] = -1;
+f->loop_filter_ref_deltas[AV1_REF_FRAME_BWDREF] = 0;
+f->loop_filter_ref_deltas[AV1_REF_FRAME_ALTREF2] = -1;
+f->loop_filter_ref_deltas[AV1_REF_FRAME_ALTREF] = -1;
+
+f->loop_filter_mode_deltas[0] = 0;
+f->loop_filter_mode_deltas[1] = 0;
+}
+
+static void load_previous_and_update(AV1DecContext *s)
+{
+uint8_t primary_frame, prev_frame;
+
+primary_frame = s->raw_frame_header->primary_ref_frame;
+prev_frame = s->raw_frame_header->ref_frame_idx[primary_frame];
+memcpy(s->cur_frame.loop_filter_ref_deltas,
+   s->ref[prev_frame

[FFmpeg-cvslog] avcodec/av1_parser: don't set AVCodecContext pixel format

2020-09-12 Thread James Almer
ffmpeg | branch: master | James Almer  | Wed Sep  9 15:22:27 
2020 -0300| [bab3c32351e42f9f7f64947102f871903b2e635c] | committer: James Almer

avcodec/av1_parser: don't set AVCodecContext pixel format

This is a property a decoder must set, not a parser.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bab3c32351e42f9f7f64947102f871903b2e635c
---

 libavcodec/av1_parser.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index ab23195e85..0b8af8aecf 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -155,8 +155,6 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
 color->transfer_characteristics  == AVCOL_TRC_IEC61966_2_1)
 ctx->format = pix_fmts_rgb[color->high_bitdepth + color->twelve_bit];
 
-avctx->pix_fmt = ctx->format;
-
 avctx->profile = seq->seq_profile;
 avctx->level   = seq->seq_level_idx[0];
 

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

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

[FFmpeg-cvslog] avcodec/av1dec: set chroma_sample_location

2020-09-12 Thread James Almer
ffmpeg | branch: master | James Almer  | Wed Sep  9 18:42:00 
2020 -0300| [b80c66bb6b23334666dbbb7b132fa5d49523d461] | committer: James Almer

avcodec/av1dec: set chroma_sample_location

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b80c66bb6b23334666dbbb7b132fa5d49523d461
---

 libavcodec/av1dec.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 9e71a2e5f6..b39a509f31 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -417,6 +417,15 @@ static int set_context_with_sequence(AVCodecContext *avctx,
 avctx->colorspace = seq->color_config.color_primaries;
 avctx->color_trc = seq->color_config.transfer_characteristics;
 
+switch (seq->color_config.chroma_sample_position) {
+case AV1_CSP_VERTICAL:
+avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
+break;
+case AV1_CSP_COLOCATED:
+avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
+break;
+}
+
 if (seq->timing_info.num_units_in_display_tick &&
 seq->timing_info.time_scale) {
 av_reduce(&avctx->framerate.den, &avctx->framerate.num,

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

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

[FFmpeg-cvslog] avcodec/av1dec: update reference frame state on show_existing_frame

2020-09-12 Thread James Almer
ffmpeg | branch: master | James Almer  | Wed Sep  9 19:14:01 
2020 -0300| [9c6026bc72905d40b6628fdbecba35bb1aceb8ce] | committer: James Almer

avcodec/av1dec: update reference frame state on show_existing_frame

As defined in Section 7.4

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9c6026bc72905d40b6628fdbecba35bb1aceb8ce
---

 libavcodec/av1dec.c | 24 +---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index b39a509f31..4a419d69d6 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -580,15 +580,9 @@ static int set_output_frame(AVCodecContext *avctx, AVFrame 
*frame,
 const AVPacket *pkt, int *got_frame)
 {
 AV1DecContext *s = avctx->priv_data;
-const AV1RawFrameHeader *header = s->raw_frame_header;
-const AVFrame *srcframe;
+const AVFrame *srcframe = s->cur_frame.tf.f;
 int ret;
 
-if (header->show_existing_frame)
-srcframe = s->ref[header->frame_to_show_map_idx].tf.f;
-else
-srcframe = s->cur_frame.tf.f;
-
 ret = av_frame_ref(frame, srcframe);
 if (ret < 0)
 return ret;
@@ -733,6 +727,22 @@ static int av1_decode_frame(AVCodecContext *avctx, void 
*frame,
 s->raw_frame_header = &obu->obu.frame_header;
 
 if (s->raw_frame_header->show_existing_frame) {
+if (s->cur_frame.tf.f->buf[0])
+av1_frame_unref(avctx, &s->cur_frame);
+
+ret = av1_frame_ref(avctx, &s->cur_frame,
+
&s->ref[s->raw_frame_header->frame_to_show_map_idx]);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Failed to get reference 
frame.\n");
+goto end;
+}
+
+ret = update_reference_list(avctx);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Failed to update reference 
list.\n");
+goto end;
+}
+
 ret = set_output_frame(avctx, frame, pkt, got_frame);
 if (ret < 0)
 av_log(avctx, AV_LOG_ERROR, "Set output frame error.\n");

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

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

[FFmpeg-cvslog] avcodec/av1_parser: don't set AVCodecContext frame dimensions

2020-09-12 Thread James Almer
ffmpeg | branch: master | James Almer  | Wed Sep  9 15:40:07 
2020 -0300| [5a562f518f3a3fdcf5fe5804c3a63dc95696da28] | committer: James Almer

avcodec/av1_parser: don't set AVCodecContext frame dimensions

Let the internal decoder take care of it, as frame reordering
may result in different values exported by either module.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5a562f518f3a3fdcf5fe5804c3a63dc95696da28
---

 libavcodec/av1_parser.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index 0b8af8aecf..14826d816e 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -163,12 +163,6 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
 avctx->color_trc = (enum AVColorTransferCharacteristic) 
color->transfer_characteristics;
 avctx->color_range = color->color_range ? AVCOL_RANGE_JPEG : 
AVCOL_RANGE_MPEG;
 
-if (ctx->width != avctx->width || ctx->height != avctx->height) {
-ret = ff_set_dimensions(avctx, ctx->width, ctx->height);
-if (ret < 0)
-goto end;
-}
-
 if (avctx->framerate.num)
 avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, 
(AVRational){avctx->ticks_per_frame, 1}));
 

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

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

[FFmpeg-cvslog] avcodec/av1dec: fix setting pix_fmt

2020-09-12 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Sep 12 17:39:45 
2020 -0300| [e46f34e85bf2306894fcaf7e3693dac7c29bc1d6] | committer: James Almer

avcodec/av1dec: fix setting pix_fmt

Fill the array with the software pix_fmt and move the avctx->hwaccel
check back to the proper place.
Also remove the avoid probing flag to ensure an external av1 decoder
will not set a pix_fmt we don't want during format probing.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e46f34e85bf2306894fcaf7e3693dac7c29bc1d6
---

 libavcodec/av1dec.c | 29 +++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 4a419d69d6..bd8acdaafe 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -257,18 +257,7 @@ static int get_pixel_format(AVCodecContext *avctx)
 int ret;
 enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
 #define HWACCEL_MAX (0)
-enum AVPixelFormat pix_fmts[HWACCEL_MAX + 1], *fmtp = pix_fmts;
-
-/**
- * check if the HW accel is inited correctly. If not, return 
un-implemented.
- * Since now the av1 decoder doesn't support native decode, if it will be
- * implemented in the future, need remove this check.
- */
-if (!avctx->hwaccel) {
-av_log(avctx, AV_LOG_ERROR, "Your platform doesn't suppport"
-   " hardware accelerated AV1 decoding.\n");
-return AVERROR(ENOSYS);
-}
+enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
 
 if (seq->seq_profile == 2 && seq->color_config.high_bitdepth)
 bit_depth = seq->color_config.twelve_bit ? 12 : 10;
@@ -328,12 +317,24 @@ static int get_pixel_format(AVCodecContext *avctx)
 return -1;
 s->pix_fmt = pix_fmt;
 
+*fmtp++ = s->pix_fmt;
 *fmtp = AV_PIX_FMT_NONE;
-avctx->sw_pix_fmt = s->pix_fmt;
+
 ret = ff_thread_get_format(avctx, pix_fmts);
 if (ret < 0)
 return ret;
 
+/**
+ * check if the HW accel is inited correctly. If not, return 
un-implemented.
+ * Since now the av1 decoder doesn't support native decode, if it will be
+ * implemented in the future, need remove this check.
+ */
+if (!avctx->hwaccel) {
+av_log(avctx, AV_LOG_ERROR, "Your platform doesn't suppport"
+   " hardware accelerated AV1 decoding.\n");
+return AVERROR(ENOSYS);
+}
+
 avctx->pix_fmt = ret;
 
 return 0;
@@ -858,7 +859,7 @@ AVCodec ff_av1_decoder = {
 .init  = av1_decode_init,
 .close = av1_decode_free,
 .decode= av1_decode_frame,
-.capabilities  = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING,
+.capabilities  = AV_CODEC_CAP_DR1,
 .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
  FF_CODEC_CAP_INIT_CLEANUP |
  FF_CODEC_CAP_SETS_PKT_DTS,

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

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

[FFmpeg-cvslog] avcodec/crystalhd: Remove unused packet

2020-09-12 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri Sep 11 16:28:25 2020 +0200| [f5a61a1728cba3fdd19370e8a020063676604efa] | 
committer: Andreas Rheinhardt

avcodec/crystalhd: Remove unused packet

Unused since 41b0561dc7246b72a834067da539ae98b1ec6631.

Reviewed-by: James Almer 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f5a61a1728cba3fdd19370e8a020063676604efa
---

 libavcodec/crystalhd.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c
index e3c5955969..228803183a 100644
--- a/libavcodec/crystalhd.c
+++ b/libavcodec/crystalhd.c
@@ -657,7 +657,6 @@ static int crystalhd_decode_packet(AVCodecContext *avctx, 
const AVPacket *avpkt)
 BC_STATUS bc_ret;
 CHDContext *priv   = avctx->priv_data;
 HANDLE dev = priv->dev;
-AVPacket filtered_packet = { 0 };
 int ret = 0;
 
 av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: decode_packet\n");
@@ -700,7 +699,6 @@ static int crystalhd_decode_packet(AVCodecContext *avctx, 
const AVPacket *avpkt)
 goto exit;
 }
  exit:
-av_packet_unref(&filtered_packet);
 return ret;
 }
 

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

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