Re: [FFmpeg-devel] [PATCH V3] avfilter/vf_bilateral: process command to set the parameter at runtime
Good weekend. Is it ok or any more suggestions? Tao Zhang 于2019年10月28日周一 下午2:53写道: > > ping > > leozhang 于2019年10月24日周四 下午5:18写道: > > > > Reviewed-by: Paul B Mahol > > Reviewed-by: Jun Zhao > > Signed-off-by: leozhang > > --- > > libavfilter/vf_bilateral.c | 57 > > ++ > > 1 file changed, 43 insertions(+), 14 deletions(-) > > > > diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c > > index 3c9d800..4d7bf68 100644 > > --- a/libavfilter/vf_bilateral.c > > +++ b/libavfilter/vf_bilateral.c > > @@ -29,6 +29,8 @@ > > #include "internal.h" > > #include "video.h" > > > > +#include > > + > > typedef struct BilateralContext { > > const AVClass *class; > > > > @@ -54,7 +56,7 @@ typedef struct BilateralContext { > > } BilateralContext; > > > > #define OFFSET(x) offsetof(BilateralContext, x) > > -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM > > +#define FLAGS > > AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM > > > > static const AVOption bilateral_options[] = { > > { "sigmaS", "set spatial sigma",OFFSET(sigmaS), AV_OPT_TYPE_FLOAT, > > {.dbl=0.1}, 0.0, 10, FLAGS }, > > @@ -91,19 +93,27 @@ static int query_formats(AVFilterContext *ctx) > > return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); > > } > > > > -static int config_input(AVFilterLink *inlink) > > +static int init_lut(BilateralContext *s) > > { > > -BilateralContext *s = inlink->dst->priv; > > -const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); > > float inv_sigma_range; > > > > -s->depth = desc->comp[0].depth; > > inv_sigma_range = 1.0f / (s->sigmaR * ((1 << s->depth) - 1)); > > > > //compute a lookup table > > for (int i = 0; i < (1 << s->depth); i++) > > s->range_table[i] = expf(-i * inv_sigma_range); > > > > +return 0; > > +} > > + > > +static int config_input(AVFilterLink *inlink) > > +{ > > +BilateralContext *s = inlink->dst->priv; > > +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); > > + > > +s->depth = desc->comp[0].depth; > > +init_lut(s); > > + > > s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, > > desc->log2_chroma_w); > > s->planewidth[0] = s->planewidth[3] = inlink->w; > > s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, > > desc->log2_chroma_h); > > @@ -325,6 +335,24 @@ static int filter_frame(AVFilterLink *inlink, AVFrame > > *in) > > return ff_filter_frame(outlink, out); > > } > > > > +static int process_command(AVFilterContext *ctx, const char *cmd, const > > char *args, > > + char *res, int res_len, int flags) > > +{ > > +BilateralContext *s = ctx->priv; > > +int ret; > > +float old_sigmaR = s->sigmaR; > > + > > +if ((ret = ff_filter_process_command(ctx, cmd, args, res, res_len, > > flags)) < 0) { > > +return ret; > > +} > > + > > +if (fabs(old_sigmaR - s->sigmaR) > FLT_EPSILON && (ret = init_lut(s)) > > < 0) { > > +s->sigmaR = old_sigmaR; > > +} > > + > > +return ret; > > +} > > + > > static av_cold void uninit(AVFilterContext *ctx) > > { > > BilateralContext *s = ctx->priv; > > @@ -358,13 +386,14 @@ static const AVFilterPad bilateral_outputs[] = { > > }; > > > > AVFilter ff_vf_bilateral = { > > -.name = "bilateral", > > -.description = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."), > > -.priv_size = sizeof(BilateralContext), > > -.priv_class= &bilateral_class, > > -.uninit= uninit, > > -.query_formats = query_formats, > > -.inputs= bilateral_inputs, > > -.outputs = bilateral_outputs, > > -.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, > > +.name= "bilateral", > > +.description = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."), > > +.priv_size = sizeof(BilateralContext), > > +.priv_class = &bilateral_class, > > +.uninit = uninit, > > +.query_formats = query_formats, > > +.inputs = bilateral_inputs, > > +.outputs = bilateral_outputs, > > +.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, > > +.process_command = process_command, > > }; > > -- > > 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 mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH V3] avfilter/vf_bilateral: process command to set the parameter at runtime
You mixed functional and non-functional changes in single patch. This is big no. On 11/2/19, Tao Zhang wrote: > Good weekend. Is it ok or any more suggestions? > > Tao Zhang 于2019年10月28日周一 下午2:53写道: >> >> ping >> >> leozhang 于2019年10月24日周四 下午5:18写道: >> > >> > Reviewed-by: Paul B Mahol >> > Reviewed-by: Jun Zhao >> > Signed-off-by: leozhang >> > --- >> > libavfilter/vf_bilateral.c | 57 >> > ++ >> > 1 file changed, 43 insertions(+), 14 deletions(-) >> > >> > diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c >> > index 3c9d800..4d7bf68 100644 >> > --- a/libavfilter/vf_bilateral.c >> > +++ b/libavfilter/vf_bilateral.c >> > @@ -29,6 +29,8 @@ >> > #include "internal.h" >> > #include "video.h" >> > >> > +#include >> > + >> > typedef struct BilateralContext { >> > const AVClass *class; >> > >> > @@ -54,7 +56,7 @@ typedef struct BilateralContext { >> > } BilateralContext; >> > >> > #define OFFSET(x) offsetof(BilateralContext, x) >> > -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM >> > +#define FLAGS >> > AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM >> > >> > static const AVOption bilateral_options[] = { >> > { "sigmaS", "set spatial sigma",OFFSET(sigmaS), >> > AV_OPT_TYPE_FLOAT, {.dbl=0.1}, 0.0, 10, FLAGS }, >> > @@ -91,19 +93,27 @@ static int query_formats(AVFilterContext *ctx) >> > return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); >> > } >> > >> > -static int config_input(AVFilterLink *inlink) >> > +static int init_lut(BilateralContext *s) >> > { >> > -BilateralContext *s = inlink->dst->priv; >> > -const AVPixFmtDescriptor *desc = >> > av_pix_fmt_desc_get(inlink->format); >> > float inv_sigma_range; >> > >> > -s->depth = desc->comp[0].depth; >> > inv_sigma_range = 1.0f / (s->sigmaR * ((1 << s->depth) - 1)); >> > >> > //compute a lookup table >> > for (int i = 0; i < (1 << s->depth); i++) >> > s->range_table[i] = expf(-i * inv_sigma_range); >> > >> > +return 0; >> > +} >> > + >> > +static int config_input(AVFilterLink *inlink) >> > +{ >> > +BilateralContext *s = inlink->dst->priv; >> > +const AVPixFmtDescriptor *desc = >> > av_pix_fmt_desc_get(inlink->format); >> > + >> > +s->depth = desc->comp[0].depth; >> > +init_lut(s); >> > + >> > s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, >> > desc->log2_chroma_w); >> > s->planewidth[0] = s->planewidth[3] = inlink->w; >> > s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, >> > desc->log2_chroma_h); >> > @@ -325,6 +335,24 @@ static int filter_frame(AVFilterLink *inlink, >> > AVFrame *in) >> > return ff_filter_frame(outlink, out); >> > } >> > >> > +static int process_command(AVFilterContext *ctx, const char *cmd, const >> > char *args, >> > + char *res, int res_len, int flags) >> > +{ >> > +BilateralContext *s = ctx->priv; >> > +int ret; >> > +float old_sigmaR = s->sigmaR; >> > + >> > +if ((ret = ff_filter_process_command(ctx, cmd, args, res, res_len, >> > flags)) < 0) { >> > +return ret; >> > +} >> > + >> > +if (fabs(old_sigmaR - s->sigmaR) > FLT_EPSILON && (ret = >> > init_lut(s)) < 0) { >> > +s->sigmaR = old_sigmaR; >> > +} >> > + >> > +return ret; >> > +} >> > + >> > static av_cold void uninit(AVFilterContext *ctx) >> > { >> > BilateralContext *s = ctx->priv; >> > @@ -358,13 +386,14 @@ static const AVFilterPad bilateral_outputs[] = { >> > }; >> > >> > AVFilter ff_vf_bilateral = { >> > -.name = "bilateral", >> > -.description = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."), >> > -.priv_size = sizeof(BilateralContext), >> > -.priv_class= &bilateral_class, >> > -.uninit= uninit, >> > -.query_formats = query_formats, >> > -.inputs= bilateral_inputs, >> > -.outputs = bilateral_outputs, >> > -.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, >> > +.name= "bilateral", >> > +.description = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."), >> > +.priv_size = sizeof(BilateralContext), >> > +.priv_class = &bilateral_class, >> > +.uninit = uninit, >> > +.query_formats = query_formats, >> > +.inputs = bilateral_inputs, >> > +.outputs = bilateral_outputs, >> > +.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, >> > +.process_command = process_command, >> > }; >> > -- >> > 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 mailing
Re: [FFmpeg-devel] [PATCH 5/5] avformat/Makefile: add missing pcm dependency to sdx demuxer
Am Fr., 1. Nov. 2019 um 23:37 Uhr schrieb Lou Logan : [...] Set lgtm. Thank you, 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 V3] avfilter/vf_bilateral: process command to set the parameter at runtime
Paul B Mahol 于2019年11月2日周六 下午6:34写道: > > You mixed functional and non-functional changes in single patch. Lesson learned. I'll submit a new patch. Thanks a lot. Today is a good day. > This is big no. > > On 11/2/19, Tao Zhang wrote: > > Good weekend. Is it ok or any more suggestions? > > > > Tao Zhang 于2019年10月28日周一 下午2:53写道: > >> > >> ping > >> > >> leozhang 于2019年10月24日周四 下午5:18写道: > >> > > >> > Reviewed-by: Paul B Mahol > >> > Reviewed-by: Jun Zhao > >> > Signed-off-by: leozhang > >> > --- > >> > libavfilter/vf_bilateral.c | 57 > >> > ++ > >> > 1 file changed, 43 insertions(+), 14 deletions(-) > >> > > >> > diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c > >> > index 3c9d800..4d7bf68 100644 > >> > --- a/libavfilter/vf_bilateral.c > >> > +++ b/libavfilter/vf_bilateral.c > >> > @@ -29,6 +29,8 @@ > >> > #include "internal.h" > >> > #include "video.h" > >> > > >> > +#include > >> > + > >> > typedef struct BilateralContext { > >> > const AVClass *class; > >> > > >> > @@ -54,7 +56,7 @@ typedef struct BilateralContext { > >> > } BilateralContext; > >> > > >> > #define OFFSET(x) offsetof(BilateralContext, x) > >> > -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM > >> > +#define FLAGS > >> > AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM > >> > > >> > static const AVOption bilateral_options[] = { > >> > { "sigmaS", "set spatial sigma",OFFSET(sigmaS), > >> > AV_OPT_TYPE_FLOAT, {.dbl=0.1}, 0.0, 10, FLAGS }, > >> > @@ -91,19 +93,27 @@ static int query_formats(AVFilterContext *ctx) > >> > return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); > >> > } > >> > > >> > -static int config_input(AVFilterLink *inlink) > >> > +static int init_lut(BilateralContext *s) > >> > { > >> > -BilateralContext *s = inlink->dst->priv; > >> > -const AVPixFmtDescriptor *desc = > >> > av_pix_fmt_desc_get(inlink->format); > >> > float inv_sigma_range; > >> > > >> > -s->depth = desc->comp[0].depth; > >> > inv_sigma_range = 1.0f / (s->sigmaR * ((1 << s->depth) - 1)); > >> > > >> > //compute a lookup table > >> > for (int i = 0; i < (1 << s->depth); i++) > >> > s->range_table[i] = expf(-i * inv_sigma_range); > >> > > >> > +return 0; > >> > +} > >> > + > >> > +static int config_input(AVFilterLink *inlink) > >> > +{ > >> > +BilateralContext *s = inlink->dst->priv; > >> > +const AVPixFmtDescriptor *desc = > >> > av_pix_fmt_desc_get(inlink->format); > >> > + > >> > +s->depth = desc->comp[0].depth; > >> > +init_lut(s); > >> > + > >> > s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, > >> > desc->log2_chroma_w); > >> > s->planewidth[0] = s->planewidth[3] = inlink->w; > >> > s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, > >> > desc->log2_chroma_h); > >> > @@ -325,6 +335,24 @@ static int filter_frame(AVFilterLink *inlink, > >> > AVFrame *in) > >> > return ff_filter_frame(outlink, out); > >> > } > >> > > >> > +static int process_command(AVFilterContext *ctx, const char *cmd, const > >> > char *args, > >> > + char *res, int res_len, int flags) > >> > +{ > >> > +BilateralContext *s = ctx->priv; > >> > +int ret; > >> > +float old_sigmaR = s->sigmaR; > >> > + > >> > +if ((ret = ff_filter_process_command(ctx, cmd, args, res, res_len, > >> > flags)) < 0) { > >> > +return ret; > >> > +} > >> > + > >> > +if (fabs(old_sigmaR - s->sigmaR) > FLT_EPSILON && (ret = > >> > init_lut(s)) < 0) { > >> > +s->sigmaR = old_sigmaR; > >> > +} > >> > + > >> > +return ret; > >> > +} > >> > + > >> > static av_cold void uninit(AVFilterContext *ctx) > >> > { > >> > BilateralContext *s = ctx->priv; > >> > @@ -358,13 +386,14 @@ static const AVFilterPad bilateral_outputs[] = { > >> > }; > >> > > >> > AVFilter ff_vf_bilateral = { > >> > -.name = "bilateral", > >> > -.description = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."), > >> > -.priv_size = sizeof(BilateralContext), > >> > -.priv_class= &bilateral_class, > >> > -.uninit= uninit, > >> > -.query_formats = query_formats, > >> > -.inputs= bilateral_inputs, > >> > -.outputs = bilateral_outputs, > >> > -.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, > >> > +.name= "bilateral", > >> > +.description = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."), > >> > +.priv_size = sizeof(BilateralContext), > >> > +.priv_class = &bilateral_class, > >> > +.uninit = uninit, > >> > +.query_formats = query_formats, > >> > +.inputs = bilateral_inputs, > >> > +.outputs = bilateral_outputs, > >> > +.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, > >> > +.process_command = process_command, > >> > }; > >
[FFmpeg-devel] [PATCH V1 1/5] lavf/hls: fix the log context setting in log message
From: Jun Zhao Fix the log context setting in log message Signed-off-by: Jun Zhao --- libavformat/hls.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index ac151d5..8ce1ad9 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -476,20 +476,20 @@ static struct rendition *new_rendition(HLSContext *c, struct rendition_info *inf return NULL; if (type == AVMEDIA_TYPE_UNKNOWN) { -av_log(c, AV_LOG_WARNING, "Can't support the type: %s\n", info->type); +av_log(c->ctx, AV_LOG_WARNING, "Can't support the type: %s\n", info->type); return NULL; } /* URI is mandatory for subtitles as per spec */ if (type == AVMEDIA_TYPE_SUBTITLE && !info->uri[0]) { -av_log(c, AV_LOG_ERROR, "The URI tag is REQUIRED for subtitle.\n"); +av_log(c->ctx, AV_LOG_ERROR, "The URI tag is REQUIRED for subtitle.\n"); return NULL; } /* TODO: handle subtitles (each segment has to parsed separately) */ if (c->ctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) if (type == AVMEDIA_TYPE_SUBTITLE) { -av_log(c, AV_LOG_WARNING, "Can't support the subtitle(uri: %s)\n", info->uri); +av_log(c->ctx, AV_LOG_WARNING, "Can't support the subtitle(uri: %s)\n", info->uri); return NULL; } @@ -1067,7 +1067,7 @@ static void handle_id3(AVIOContext *pb, struct playlist *pls) } else { if (!pls->id3_changed && id3_has_changed_values(pls, metadata, apic)) { -avpriv_report_missing_feature(pls->ctx, "Changing ID3 metadata in HLS audio elementary stream"); +avpriv_report_missing_feature(pls->parent, "Changing ID3 metadata in HLS audio elementary stream"); pls->id3_changed = 1; } av_dict_free(&metadata); @@ -1118,7 +1118,7 @@ static void intercept_id3(struct playlist *pls, uint8_t *buf, int remaining = taglen - tag_got_bytes; if (taglen > maxsize) { -av_log(pls->ctx, AV_LOG_ERROR, "Too large HLS ID3 tag (%d > %"PRId64" bytes)\n", +av_log(pls->parent, AV_LOG_ERROR, "Too large HLS ID3 tag (%d > %"PRId64" bytes)\n", taglen, maxsize); break; } @@ -1139,14 +1139,14 @@ static void intercept_id3(struct playlist *pls, uint8_t *buf, /* strip the intercepted bytes */ *len -= tag_got_bytes; memmove(buf, buf + tag_got_bytes, *len); -av_log(pls->ctx, AV_LOG_DEBUG, "Stripped %d HLS ID3 bytes\n", tag_got_bytes); +av_log(pls->parent, AV_LOG_DEBUG, "Stripped %d HLS ID3 bytes\n", tag_got_bytes); if (remaining > 0) { /* read the rest of the tag in */ if (read_from_url(pls, seg, pls->id3_buf + id3_buf_pos, remaining) != remaining) break; id3_buf_pos += remaining; -av_log(pls->ctx, AV_LOG_DEBUG, "Stripped additional %d HLS ID3 bytes\n", remaining); +av_log(pls->parent, AV_LOG_DEBUG, "Stripped additional %d HLS ID3 bytes\n", remaining); } } else { -- 1.7.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 V1 2/5] lavf/mov: add log context dump in log message
From: Jun Zhao add log context dump in log message. Signed-off-by: Jun Zhao --- libavformat/mov.c | 30 +++--- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 4f69664..d5c67fb 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1394,14 +1394,14 @@ static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom) return mov_read_default(c, pb, atom); } -static void mov_metadata_creation_time(AVDictionary **metadata, int64_t time) +static void mov_metadata_creation_time(AVDictionary **metadata, int64_t time, void *logctx) { if (time) { if(time >= 2082844800) time -= 2082844800; /* seconds between 1904-01-01 and Epoch */ if ((int64_t)(time * 100ULL) / 100 != time) { -av_log(NULL, AV_LOG_DEBUG, "creation_time is not representable\n"); +av_log(logctx, AV_LOG_DEBUG, "creation_time is not representable\n"); return; } @@ -1441,7 +1441,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) creation_time = avio_rb32(pb); avio_rb32(pb); /* modification time */ } -mov_metadata_creation_time(&st->metadata, creation_time); +mov_metadata_creation_time(&st->metadata, creation_time, c->fc); sc->time_scale = avio_rb32(pb); if (sc->time_scale <= 0) { @@ -1472,7 +1472,7 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) creation_time = avio_rb32(pb); avio_rb32(pb); /* modification time */ } -mov_metadata_creation_time(&c->fc->metadata, creation_time); +mov_metadata_creation_time(&c->fc->metadata, creation_time, c->fc); c->time_scale = avio_rb32(pb); /* time scale */ if (c->time_scale <= 0) { av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d, defaulting to 1\n", c->time_scale); @@ -1621,7 +1621,7 @@ static int mov_read_fiel(MOVContext *c, AVIOContext *pb, MOVAtom atom) } } if (decoded_field_order == AV_FIELD_UNKNOWN && mov_field_order) { -av_log(NULL, AV_LOG_ERROR, "Unknown MOV field order 0x%04x\n", mov_field_order); +av_log(c->fc, AV_LOG_ERROR, "Unknown MOV field order 0x%04x\n", mov_field_order); } st->codecpar->field_order = decoded_field_order; @@ -1798,19 +1798,19 @@ static int mov_read_aclr(MOVContext *c, AVIOContext *pb, MOVAtom atom) par->color_range = AVCOL_RANGE_JPEG; break; default: -av_log(c, AV_LOG_WARNING, "ignored unknown aclr value (%d)\n", range_value); +av_log(c->fc, AV_LOG_WARNING, "ignored unknown aclr value (%d)\n", range_value); break; } -ff_dlog(c, "color_range: %d\n", par->color_range); +ff_dlog(c->fc, "color_range: %d\n", par->color_range); } else { /* For some reason the whole atom was not added to the extradata */ - av_log(c, AV_LOG_ERROR, "aclr not decoded - incomplete atom\n"); + av_log(c->fc, AV_LOG_ERROR, "aclr not decoded - incomplete atom\n"); } } else { -av_log(c, AV_LOG_ERROR, "aclr not decoded - unable to add atom to extradata\n"); +av_log(c->fc, AV_LOG_ERROR, "aclr not decoded - unable to add atom to extradata\n"); } } else { -av_log(c, AV_LOG_WARNING, "aclr not decoded - unexpected size %"PRId64"\n", atom.size); +av_log(c->fc, AV_LOG_WARNING, "aclr not decoded - unexpected size %"PRId64"\n", atom.size); } } @@ -1902,7 +1902,7 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) return mov_read_default(c, pb, atom); } if (st->codecpar->extradata_size > 1 && st->codecpar->extradata) { -av_log(c, AV_LOG_WARNING, "ignoring multiple glbl\n"); +av_log(c->fc, AV_LOG_WARNING, "ignoring multiple glbl\n"); return 0; } av_freep(&st->codecpar->extradata); @@ -2993,11 +2993,11 @@ static int mov_read_sdtp(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } -static void mov_update_dts_shift(MOVStreamContext *sc, int duration) +static void mov_update_dts_shift(MOVStreamContext *sc, int duration, void *logctx) { if (duration < 0) { if (duration == INT_MIN) { -av_log(NULL, AV_LOG_WARNING, "mov_update_dts_shift(): dts_shift set to %d\n", INT_MAX); +av_log(logctx, AV_LOG_WARNING, "mov_update_dts_shift(): dts_shift set to %d\n", INT_MAX); duration++; } sc->dts_shift = FFMAX(sc->dts_shift, -duration); @@ -3055,7 +3055,7 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) } if (i+2fc); } sc->
[FFmpeg-devel] [PATCH V1 4/5] lavf/flvenc: Cosmetics: fix indentation
From: Jun Zhao fix indentation Signed-off-by: Jun Zhao --- libavformat/flvenc.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index fb1dede..9d13275 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -970,10 +970,10 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) } else if (par->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { if (!s->streams[pkt->stream_index]->nb_frames) { -av_log(s, AV_LOG_ERROR, "Malformed AAC bitstream detected: " - "use the audio bitstream filter 'aac_adtstoasc' to fix it " - "('-bsf:a aac_adtstoasc' option with ffmpeg)\n"); -return AVERROR_INVALIDDATA; +av_log(s, AV_LOG_ERROR, "Malformed AAC bitstream detected: " + "use the audio bitstream filter 'aac_adtstoasc' to fix it " + "('-bsf:a aac_adtstoasc' option with ffmpeg)\n"); +return AVERROR_INVALIDDATA; } av_log(s, AV_LOG_WARNING, "aac bitstream error\n"); } -- 1.7.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 V1 3/5] lavf/hls: support probesize/max_analyze_duration when open sub-demuxer
From: Jun Zhao Add probesize/max_analyze_duration support when open the sub-demuxer, it's will be used to minimizing the initial delay. Signed-off-by: Jun Zhao --- libavformat/hls.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 8ce1ad9..17a75e2 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1907,6 +1907,8 @@ static int hls_read_header(AVFormatContext *s) } ffio_init_context(&pls->pb, pls->read_buffer, INITIAL_BUFFER_SIZE, 0, pls, read_data, NULL, NULL); +pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4; +pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? s->max_analyze_duration : 4 * AV_TIME_BASE; ret = av_probe_input_buffer(&pls->pb, &in_fmt, pls->segments[0]->url, NULL, 0, 0); if (ret < 0) { -- 1.7.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 V1 5/5] lavf/dashend: enable probesize/max_analyze_duration setting in sub-demuxer
From: Jun Zhao Enable probesize/max_analyze_duration setting when open the sub-demuxer, it's will be used to minimizing the initial delay. Signed-off-by: Jun Zhao --- libavformat/dashdec.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 7713ee8..facee4e 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1935,8 +1935,8 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation goto fail; pls->ctx->flags = AVFMT_FLAG_CUSTOM_IO; -pls->ctx->probesize = 1024 * 4; -pls->ctx->max_analyze_duration = 4 * AV_TIME_BASE; +pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4;; +pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? s->max_analyze_duration : 4 * AV_TIME_BASE; ret = av_probe_input_buffer(&pls->pb, &in_fmt, "", NULL, 0, 0); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Error when loading first fragment, playlist %d\n", (int)pls->rep_idx); -- 1.7.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] tools/probetest: replace the deprecated API
From: Zhong Li Signed-off-by: Zhong Li --- tools/probetest.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/probetest.c b/tools/probetest.c index 2c6c1de246..cfa309cabd 100644 --- a/tools/probetest.c +++ b/tools/probetest.c @@ -38,9 +38,10 @@ static const char *single_format; static void probe(AVProbeData *pd, int type, int p, int size) { int i = 0; -AVInputFormat *fmt = NULL; +const AVInputFormat *fmt = NULL; +void *fmt_opaque = NULL; -while ((fmt = av_iformat_next(fmt))) { +while ((fmt = av_demuxer_iterate(&fmt_opaque))) { if (fmt->flags & AVFMT_NOFILE) continue; if (fmt->read_probe && @@ -66,8 +67,9 @@ static void print_times(void) { int i = 0; AVInputFormat *fmt = NULL; +void *fmt_opaque = NULL; -while ((fmt = av_iformat_next(fmt))) { +while ((fmt = av_demuxer_iterate(&fmt_opaque))) { if (fmt->flags & AVFMT_NOFILE) continue; if (time_array[i] > 100) { -- 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 2/2] tools/enum_options: replace the deprecated API
From: Zhong Li Signed-off-by: Zhong Li --- tools/enum_options.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/enum_options.c b/tools/enum_options.c index 77e1f9f799..28631d1a6b 100644 --- a/tools/enum_options.c +++ b/tools/enum_options.c @@ -88,20 +88,22 @@ static void show_opts(const AVClass *class) static void show_format_opts(void) { -AVInputFormat *iformat = NULL; -AVOutputFormat *oformat = NULL; +const AVInputFormat *iformat = NULL; +const AVOutputFormat *oformat = NULL; +void *iformat_opaque = NULL; +void *oformat_opaque = NULL; printf("@section Generic format AVOptions\n"); show_opts(avformat_get_class()); printf("@section Format-specific AVOptions\n"); -while ((iformat = av_iformat_next(iformat))) { +while ((iformat = av_demuxer_iterate(&iformat_opaque))) { if (!iformat->priv_class) continue; printf("@subsection %s AVOptions\n", iformat->priv_class->class_name); show_opts(iformat->priv_class); } -while ((oformat = av_oformat_next(oformat))) { +while ((oformat = av_muxer_iterate(&oformat_opaque))) { if (!oformat->priv_class) continue; printf("@subsection %s AVOptions\n", oformat->priv_class->class_name); -- 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 5/5] avcodec/ralf: use multiply instead of shift to avoid undefined behavior in decode_block()
Fixes: left shift of negative value -249 Fixes: 18566/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5649394561187840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/ralf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c index 1d881cf7ae..ca8817aa21 100644 --- a/libavcodec/ralf.c +++ b/libavcodec/ralf.c @@ -408,7 +408,7 @@ static int decode_block(AVCodecContext *avctx, GetBitContext *gb, case 4: for (i = 0; i < len; i++) { t = ch1[i] + ctx->bias[1]; -t2 = ((ch0[i] + ctx->bias[0]) << 1) | (t & 1); +t2 = ((ch0[i] + ctx->bias[0]) * 2) | (t & 1); dst0[i] = (t2 + t) / 2; dst1[i] = (t2 - t) / 2; } -- 2.23.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/5] avcodec/nuv: Move comptype check up
Fixes: Timeout (23sec -> 5ms) Fixes: 18517/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5753135536013312 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/nuv.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c index bb80e3e884..0fa61a239d 100644 --- a/libavcodec/nuv.c +++ b/libavcodec/nuv.c @@ -219,6 +219,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, case NUV_RTJPEG: minsize = c->width/16 * (c->height/16) * 6; break; +case NUV_BLACK: case NUV_COPY_LAST: case NUV_LZO: case NUV_RTJPEG_IN_LZO: +break; +default: +av_log(avctx, AV_LOG_ERROR, "unknown compression\n"); +return AVERROR_INVALIDDATA; } if (buf_size < minsize / 4) return AVERROR_INVALIDDATA; @@ -307,9 +312,6 @@ retry: case NUV_COPY_LAST: /* nothing more to do here */ break; -default: -av_log(avctx, AV_LOG_ERROR, "unknown compression\n"); -return AVERROR_INVALIDDATA; } if ((result = av_frame_ref(picture, c->pic)) < 0) -- 2.23.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] Reimbursement request
On Wed, Oct 30, 2019 at 09:25:24PM +0100, Carl Eugen Hoyos wrote: > Hi! > > I am requesting reimbursement for my travel to the Google mentor summit. > My total travelling expenses were € 90,90 LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/5] avcodec/atrac3: Check for huge block aligns
The largest documented frame size = block align is 1024 bytes (https://wiki.multimedia.cx/index.php/ATRAC3) Without a limit this can allocate arbitrary memory and trigger OOM Fixes: OOM Fixes: 18337/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC3_fuzzer-5763861478637568 Fixes: 18556/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC3AL_fuzzer-5646183334936576 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/atrac3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index dc19a3863e..067aa23f1f 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -964,7 +964,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } -if (avctx->block_align >= UINT_MAX / 2 || avctx->block_align <= 0) +if (avctx->block_align > 1024 || avctx->block_align <= 0) return AVERROR(EINVAL); q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) + -- 2.23.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 3/5] avcodec/wmavoice: Fix integer overflow in synth_frame()
Fixes: left shift of negative value -3 Fixes: 18518/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-6560514359951360 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/wmavoice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index 68bb65986e..14e08c263e 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -1520,7 +1520,7 @@ static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx, /* "pitch-diff-per-sample" for calculation of pitch per sample */ s->pitch_diff_sh16 = -((cur_pitch_val - s->last_pitch_val) << 16) / MAX_FRAMESIZE; +(cur_pitch_val - s->last_pitch_val) * (1 << 16) / MAX_FRAMESIZE; } /* Global gain (if silence) and pitch-adaptive window coordinates */ -- 2.23.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/5] avcodec/agm: Do not allow MVs out of the picture area as no edge is allocated
Fixes: out of array access Fixes: 18499/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5749038406434816 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/agm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/agm.c b/libavcodec/agm.c index 3b2c21e9a7..241e9eeb1b 100644 --- a/libavcodec/agm.c +++ b/libavcodec/agm.c @@ -460,8 +460,8 @@ static int decode_inter_plane(AGMContext *s, GetBitContext *gb, int size, return ret; if (orig_mv_x >= -32) { -if (y * 8 + mv_y < 0 || y * 8 + mv_y >= h || -x * 8 + mv_x < 0 || x * 8 + mv_x >= w) +if (y * 8 + mv_y < 0 || y * 8 + mv_y + 8 > h || +x * 8 + mv_x < 0 || x * 8 + mv_x + 8 > w) return AVERROR_INVALIDDATA; copy_block8(frame->data[plane] + (s->blocks_h - 1 - y) * 8 * frame->linesize[plane] + x * 8, -- 2.23.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] [RFC PATCH] avutil/frame: fix remove_side_data
From: Zhao Zhili remove_side_data is supposed to remove a single instance by design. Since new_side_data() doesn't forbid add multiple instance of the same type, remove_side_data should deal with that. --- libavutil/frame.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/libavutil/frame.c b/libavutil/frame.c index dcf1fc3d17..10d06dd29f 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -805,15 +805,20 @@ int av_frame_copy(AVFrame *dst, const AVFrame *src) void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type) { int i; - -for (i = 0; i < frame->nb_side_data; i++) { -AVFrameSideData *sd = frame->side_data[i]; -if (sd->type == type) { -free_side_data(&frame->side_data[i]); -frame->side_data[i] = frame->side_data[frame->nb_side_data - 1]; -frame->nb_side_data--; +int found; + +do { +found = 0; +for (i = 0; i < frame->nb_side_data; i++) { +AVFrameSideData *sd = frame->side_data[i]; +if (sd->type == type) { +free_side_data(&frame->side_data[i]); +frame->side_data[i] = frame->side_data[frame->nb_side_data - 1]; +frame->nb_side_data--; +found = 1; +} } -} +} while (found); } const char *av_frame_side_data_name(enum AVFrameSideDataType type) -- 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] [PATCHv2 2/6] avcodec/libvpxenc: only allocate alpha U/V planes on size changes
Signed-off-by: Marton Balint --- libavcodec/libvpxenc.c | 60 ++ 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 4c02315fd2..ae3fdf1028 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -347,8 +347,11 @@ static av_cold int vpx_free(AVCodecContext *avctx) #endif vpx_codec_destroy(&ctx->encoder); -if (ctx->is_alpha) +if (ctx->is_alpha) { vpx_codec_destroy(&ctx->encoder_alpha); +av_freep(&ctx->rawimg_alpha.planes[VPX_PLANE_U]); +av_freep(&ctx->rawimg_alpha.planes[VPX_PLANE_V]); +} av_freep(&ctx->twopass_stats.buf); av_freep(&avctx->stats_out); free_frame_list(ctx->coded_frame_list); @@ -872,10 +875,6 @@ FF_ENABLE_DEPRECATION_WARNINGS ctx->rawimg.bit_depth = enccfg.g_bit_depth; #endif -if (ctx->is_alpha) -vpx_img_wrap(&ctx->rawimg_alpha, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1, - (unsigned char*)1); - cpb_props = ff_add_cpb_side_data(avctx); if (!cpb_props) return AVERROR(ENOMEM); @@ -1292,6 +1291,35 @@ static int vp8_encode_set_roi(AVCodecContext *avctx, int frame_width, int frame_ return ret; } +static int realloc_alpha_uv(AVCodecContext *avctx, int width, int height) +{ +VPxContext *ctx = avctx->priv_data; +struct vpx_image *rawimg_alpha = &ctx->rawimg_alpha; +unsigned char **planes = rawimg_alpha->planes; +int *stride = rawimg_alpha->stride; + +if (!planes[VPX_PLANE_U] || +!planes[VPX_PLANE_V] || +width != (int)rawimg_alpha->d_w || +height != (int)rawimg_alpha->d_h) +{ +av_freep(&planes[VPX_PLANE_U]); +av_freep(&planes[VPX_PLANE_V]); + +vpx_img_wrap(rawimg_alpha, VPX_IMG_FMT_I420, width, height, 1, + (unsigned char*)1); +planes[VPX_PLANE_U] = av_malloc_array(stride[VPX_PLANE_U], height); +planes[VPX_PLANE_V] = av_malloc_array(stride[VPX_PLANE_V], height); +if (!planes[VPX_PLANE_U] || !planes[VPX_PLANE_V]) +return AVERROR(ENOMEM); + +memset(planes[VPX_PLANE_U], 0x80, stride[VPX_PLANE_U] * height); +memset(planes[VPX_PLANE_V], 0x80, stride[VPX_PLANE_V] * height); +} + +return 0; +} + static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { @@ -1312,23 +1340,12 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt, rawimg->stride[VPX_PLANE_U] = frame->linesize[1]; rawimg->stride[VPX_PLANE_V] = frame->linesize[2]; if (ctx->is_alpha) { -uint8_t *u_plane, *v_plane; rawimg_alpha = &ctx->rawimg_alpha; +res = realloc_alpha_uv(avctx, frame->width, frame->height); +if (res < 0) +return res; rawimg_alpha->planes[VPX_PLANE_Y] = frame->data[3]; -u_plane = av_malloc(frame->linesize[1] * frame->height); -v_plane = av_malloc(frame->linesize[2] * frame->height); -if (!u_plane || !v_plane) { -av_free(u_plane); -av_free(v_plane); -return AVERROR(ENOMEM); -} -memset(u_plane, 0x80, frame->linesize[1] * frame->height); -rawimg_alpha->planes[VPX_PLANE_U] = u_plane; -memset(v_plane, 0x80, frame->linesize[2] * frame->height); -rawimg_alpha->planes[VPX_PLANE_V] = v_plane; rawimg_alpha->stride[VPX_PLANE_Y] = frame->linesize[3]; -rawimg_alpha->stride[VPX_PLANE_U] = frame->linesize[1]; -rawimg_alpha->stride[VPX_PLANE_V] = frame->linesize[2]; } timestamp = frame->pts; #if VPX_IMAGE_ABI_VERSION >= 4 @@ -1390,11 +1407,6 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt, ctx->twopass_stats.sz); } -if (rawimg_alpha) { -av_freep(&rawimg_alpha->planes[VPX_PLANE_U]); -av_freep(&rawimg_alpha->planes[VPX_PLANE_V]); -} - *got_packet = !!coded_size; return 0; } -- 2.16.4 ___ 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] avfilter: add eval video filter
On Fri, Nov 01, 2019 at 09:38:39PM +0100, Paul B Mahol wrote: > On 11/1/19, Michael Niedermayer wrote: > > On Fri, Nov 01, 2019 at 04:50:38PM +0100, Paul B Mahol wrote: > >> On 11/1/19, Michael Niedermayer wrote: > >> > On Fri, Nov 01, 2019 at 01:09:24PM +0100, Paul B Mahol wrote: > >> >> Signed-off-by: Paul B Mahol > >> >> --- > >> >> doc/filters.texi | 78 + > >> >> libavfilter/Makefile | 1 + > >> >> libavfilter/allfilters.c | 1 + > >> >> libavfilter/vf_eval.c| 687 > >> >> +++ > >> >> 4 files changed, 767 insertions(+) > >> >> create mode 100644 libavfilter/vf_eval.c > >> > > >> > This looks like it duplicates code from vf_geq.c > >> > also this should be integrated with or in vf_geq.c > >> > > >> > IIUC this was written because geq is GPL, but i had already agreed to > >> > relicense the code in it i wrote to LGPL, so iam not sure why you wrote > >> > this. > >> > > >> > Who disagreed to relicnce their contribution to geq to avoid this extra > >> > work you did ? > >> > Or did noone disagree ? then i do not understand why you wrote a > >> > seperate > >> > filter > >> > >> Do I need to contact all on blame list of vf_geq? or also mplayer devs > >> that touched geq in mplayer? > > > > all who touched it MINUS anyone who made a change that is totally not > > in the current version (there are several developers in mplayer who > > made auch changes) > > also in case of mplayer you may need to look at the commit messages > > some developers did apply patches from others. > > > > I took a quick look and these are the people i saw > > carl, ubitux, ivan, ods15, Alexis Ballier, derek, Marc-Antoine Arnaud, > > Nicolas George, Stefano and Paul > > reimar, zuxy and diego > > I do not think I can contact ods15. His change was this below (the others seems obviously not in the ffmpeg geq code) i didnt check the one below before because its big. But if we cannot contact him, then this should be checked Does any of this prevail in the ffmpeg geq code ? (if so tell me what and ill rewrite that) Thanks commit dd09bf52982fef6b29acfbcd5fa5c7cb46994c3b Author: ods15 Date: Fri Oct 27 19:40:48 2006 + update vf_geq to new ff_eval API git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@20471 b3059339-0415-0410-9bf9-f77b7e298cf2 diff --git a/libmpcodecs/vf_geq.c b/libmpcodecs/vf_geq.c index da33eac71..e8b8c0918 100644 --- a/libmpcodecs/vf_geq.c +++ b/libmpcodecs/vf_geq.c @@ -27,18 +27,12 @@ #include "mp_msg.h" #include "cpudetect.h" -#if 1 -double ff_eval(char *s, double *const_value, const char **const_name, - double (**func1)(void *, double), const char **func1_name, - double (**func2)(void *, double, double), char **func2_name, - void *opaque); -#endif - // Needed to bring in lrintf. #define HAVE_AV_CONFIG_H #include "libavcodec/avcodec.h" #include "libavcodec/dsputil.h" +#include "libavcodec/eval.h" #include "libavutil/common.h" /* FIXME: common.h defines printf away when HAVE_AV_CONFIG @@ -57,7 +51,7 @@ double ff_eval(char *s, double *const_value, const char **const_name, struct vf_priv_s { - char eq[3][2000]; +AVEvalExpr * e[3]; int framenum; mp_image_t *mpi; }; @@ -120,25 +114,6 @@ static double cr(struct vf_instance_s* vf, double x, double y){ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; int x,y, plane; -static const char *const_names[]={ -"PI", -"E", -"X", -"Y", -"W", -"H", -"N", -"SW", -"SH", -NULL -}; -static const char *func2_names[]={ -"lum", -"cb", -"cr", -"p", -NULL -}; if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // no DR, so get a new image! hope we'll get DR buffer: @@ -157,13 +132,6 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ int h= mpi->h >> (plane ? mpi->chroma_y_shift : 0); uint8_t *dst = dmpi->planes[plane]; int dst_stride= dmpi->stride[plane]; -double (*func2[])(void *, double, double)={ -lum, -cb, -cr, -plane==0 ? lum : (plane==1 ? cb : cr), -NULL -}; double const_values[]={ M_PI, M_E, @@ -176,11 +144,12 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ h/(double)mpi->h, 0 }; +if (!vf->priv->e[plane]) continue; for(y=0; ypriv->eq[plane], const_values, const_names, NULL, NULL, func2, func2_names, vf); +dst[x+y* dst_stride]= ff_parse_eval(vf->priv->e[plane], const_values, vf)
Re: [FFmpeg-devel] [RFC PATCH] avutil/frame: fix remove_side_data
On Sun, 3 Nov 2019, Zhao Zhili wrote: From: Zhao Zhili remove_side_data is supposed to remove a single instance by design. Since new_side_data() doesn't forbid add multiple instance of the same type, remove_side_data should deal with that. Please update the docs of the function that it removes all side data instances of the specified type. --- libavutil/frame.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/libavutil/frame.c b/libavutil/frame.c index dcf1fc3d17..10d06dd29f 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -805,15 +805,20 @@ int av_frame_copy(AVFrame *dst, const AVFrame *src) void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type) { int i; - -for (i = 0; i < frame->nb_side_data; i++) { -AVFrameSideData *sd = frame->side_data[i]; -if (sd->type == type) { -free_side_data(&frame->side_data[i]); -frame->side_data[i] = frame->side_data[frame->nb_side_data - 1]; -frame->nb_side_data--; +int found; + +do { +found = 0; +for (i = 0; i < frame->nb_side_data; i++) { +AVFrameSideData *sd = frame->side_data[i]; +if (sd->type == type) { +free_side_data(&frame->side_data[i]); +frame->side_data[i] = frame->side_data[frame->nb_side_data - 1]; +frame->nb_side_data--; +found = 1; +} } -} +} while (found); I am sure this can be done in a single loop. (E.g.: decrement i when side data is found) Regards, Marton ___ 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] [RFC PATCH v2] avutil/frame: fix remove_side_data
remove_side_data is supposed to remove a single instance by design. Since new_side_data() doesn't forbid add multiple instances of the same type, remove_side_data should deal with that. --- I'm afraid this patch makes it harder to enforce single entry per type. libavutil/frame.c | 2 +- libavutil/frame.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libavutil/frame.c b/libavutil/frame.c index dcf1fc3d17..e4038096c2 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -806,7 +806,7 @@ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type) { int i; -for (i = 0; i < frame->nb_side_data; i++) { +for (i = frame->nb_side_data - 1; i >= 0; i--) { AVFrameSideData *sd = frame->side_data[i]; if (sd->type == type) { free_side_data(&frame->side_data[i]); diff --git a/libavutil/frame.h b/libavutil/frame.h index 5d3231e7bb..b5afb58634 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -920,8 +920,7 @@ AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type); /** - * If side data of the supplied type exists in the frame, free it and remove it - * from the frame. + * Remove and free all side data instances of the given type. */ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type); -- 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".
Re: [FFmpeg-devel] [PATCH V1 2/5] lavf/mov: add log context dump in log message
On Sat, Nov 02, 2019 at 10:54:58PM +0800, Jun Zhao wrote: > From: Jun Zhao > > add log context dump in log message. > > Signed-off-by: Jun Zhao > --- > libavformat/mov.c | 30 +++--- > 1 files changed, 15 insertions(+), 15 deletions(-) LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates 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 v2] avformat: Add max_probe_packets option
On Fri, Nov 01, 2019 at 01:58:59PM -0400, Andriy Gelman wrote: > Michael, > On Sat, 19. Oct 16:54, Michael Niedermayer wrote: > > On Thu, Oct 17, 2019 at 10:49:20AM -0400, Andriy Gelman wrote: > > > From: Andriy Gelman > > > > > > Allows user to set maximum number of buffered packets when > > > probing a codec. It was a hard-coded parameter before this commit. > > > --- > > > doc/formats.texi| 4 > > > libavformat/avformat.h | 7 +++ > > > libavformat/internal.h | 2 -- > > > libavformat/options_table.h | 1 + > > > libavformat/utils.c | 6 +++--- > > > libavformat/version.h | 2 +- > > > 6 files changed, 16 insertions(+), 6 deletions(-) > > > > LGTM > > > > thx > > > > Can this be pushed? will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus 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] avcodec/dvdec: correctly decode bottom mb row in 1080i field mode
On Wed, Sep 11, 2019 at 12:29 PM Baptiste Coudurier < baptiste.coudur...@gmail.com> wrote: > --- > libavcodec/dv.h| 2 ++ > libavcodec/dvdec.c | 90 +++--- > 2 files changed, 72 insertions(+), 20 deletions(-) > > diff --git a/libavcodec/dv.h b/libavcodec/dv.h > index 0e97bb200e..7ef5b7c552 100644 > --- a/libavcodec/dv.h > +++ b/libavcodec/dv.h > @@ -31,6 +31,7 @@ > #include "dv_profile.h" > #include "me_cmp.h" > #include "vlc.h" > +#include "idctdsp.h" > > typedef struct DVwork_chunk { > uint16_t buf_offset; > @@ -52,6 +53,7 @@ typedef struct DVVideoContext { > me_cmp_func ildct_cmp; > DVwork_chunk work_chunks[4 * 12 * 27]; > uint32_t idct_factor[2 * 4 * 16 * 64]; > +IDCTDSPContext idsp; > > int quant_deadzone; > } DVVideoContext; > diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c > index 89864f2edc..4345cd9e29 100644 > --- a/libavcodec/dvdec.c > +++ b/libavcodec/dvdec.c > @@ -45,7 +45,6 @@ > #include "dv_profile_internal.h" > #include "dvdata.h" > #include "get_bits.h" > -#include "idctdsp.h" > #include "internal.h" > #include "put_bits.h" > #include "simple_idct.h" > @@ -177,24 +176,22 @@ static void dv_init_weight_tables(DVVideoContext > *ctx, const AVDVProfile *d) > static av_cold int dvvideo_decode_init(AVCodecContext *avctx) > { > DVVideoContext *s = avctx->priv_data; > -IDCTDSPContext idsp; > int i; > > -memset(&idsp,0, sizeof(idsp)); > -ff_idctdsp_init(&idsp, avctx); > +ff_idctdsp_init(&s->idsp, avctx); > > for (i = 0; i < 64; i++) > -s->dv_zigzag[0][i] = idsp.idct_permutation[ff_zigzag_direct[i]]; > +s->dv_zigzag[0][i] = > s->idsp.idct_permutation[ff_zigzag_direct[i]]; > > if (avctx->lowres){ > for (i = 0; i < 64; i++){ > int j = ff_dv_zigzag248_direct[i]; > -s->dv_zigzag[1][i] = idsp.idct_permutation[(j & 7) + (j & 8) > * 4 + (j & 48) / 2]; > +s->dv_zigzag[1][i] = s->idsp.idct_permutation[(j & 7) + (j & > 8) * 4 + (j & 48) / 2]; > } > }else > memcpy(s->dv_zigzag[1], ff_dv_zigzag248_direct, > sizeof(s->dv_zigzag[1])); > > -s->idct_put[0] = idsp.idct_put; > +s->idct_put[0] = s->idsp.idct_put; > s->idct_put[1] = ff_simple_idct248_put; > > return ff_dvvideo_init(avctx); > @@ -272,6 +269,49 @@ static inline void bit_copy(PutBitContext *pb, > GetBitContext *gb) > put_bits(pb, bits_left, get_bits(gb, bits_left)); > } > > +static av_always_inline void put_block_8x4(int16_t *block, uint8_t > *restrict p, int stride) > +{ > +int i, j; > +const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; > + > +for (i = 0; i < 4; i++) { > +for (j = 0; j < 8; j++) > +p[j] = cm[block[j]]; > +block += 8; > +p += stride; > +} > +} > + > +static void dv100_idct_put_last_row_field_chroma(DVVideoContext *s, > uint8_t *data, > + int stride, int16_t > *blocks) > +{ > +s->idsp.idct(blocks + 0*64); > +s->idsp.idct(blocks + 1*64); > + > +put_block_8x4(blocks+0*64, data, stride<<1); > +put_block_8x4(blocks+0*64 + 4*8, data + 8, stride<<1); > +put_block_8x4(blocks+1*64, data + stride, stride<<1); > +put_block_8x4(blocks+1*64 + 4*8, data + 8 + stride, stride<<1); > +} > + > +static void dv100_idct_put_last_row_field_luma(DVVideoContext *s, uint8_t > *data, > + int stride, int16_t > *blocks) > +{ > +s->idsp.idct(blocks + 0*64); > +s->idsp.idct(blocks + 1*64); > +s->idsp.idct(blocks + 2*64); > +s->idsp.idct(blocks + 3*64); > + > +put_block_8x4(blocks+0*64, data, stride<<1); > +put_block_8x4(blocks+0*64 + 4*8, data + 16, stride<<1); > +put_block_8x4(blocks+1*64, data + 8, stride<<1); > +put_block_8x4(blocks+1*64 + 4*8, data + 24, stride<<1); > +put_block_8x4(blocks+2*64, data + stride, stride<<1); > +put_block_8x4(blocks+2*64 + 4*8, data + 16 + stride, stride<<1); > +put_block_8x4(blocks+3*64, data + 8 + stride, stride<<1); > +put_block_8x4(blocks+3*64 + 4*8, data + 24 + stride, stride<<1); > +} > + > /* mb_x and mb_y are in units of 8 pixels */ > static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) > { > @@ -443,14 +483,18 @@ retry: > } > y_ptr= s->frame->data[0] + > ((mb_y * s->frame->linesize[0] + mb_x) << > log2_blocksize); > -linesize = s->frame->linesize[0] << is_field_mode[mb_index]; > -mb[0].idct_put(y_ptr, linesize, block + 0 * 64); > -if (s->sys->video_stype == 4) { /* SD 422 */ > -mb[2].idct_put(y_ptr + (1 << log2_blocksize), > linesize, block + 2 * 64); > +if (mb_y == 134 && is_field_mode[mb_index]) { > +dv100_idct_put_last_row_field_luma(s, y_ptr, > s->fram
[FFmpeg-devel] [PATCH] avcodec/dvenc: support encoding dvcprohd
--- libavcodec/dv.h | 1 + libavcodec/dvenc.c| 555 +- tests/fate/vcodec.mak | 14 +- 3 files changed, 514 insertions(+), 56 deletions(-) diff --git a/libavcodec/dv.h b/libavcodec/dv.h index 7ef5b7c552..0205d72347 100644 --- a/libavcodec/dv.h +++ b/libavcodec/dv.h @@ -83,6 +83,7 @@ enum dv_pack_type { #define DV_PROFILE_IS_HD(p) ((p)->video_stype & 0x10) #define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1)) +#define DV_PROFILE_IS_1080i60(p) (((p)->video_stype == 0x14) && ((p)->dsf == 0)) #define DV_PROFILE_IS_720p50(p) (((p)->video_stype == 0x18) && ((p)->dsf == 1)) /** diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c index ce2fc75daa..3afeb5ebb8 100644 --- a/libavcodec/dvenc.c +++ b/libavcodec/dvenc.c @@ -60,10 +60,7 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx) ff_dv_print_profiles(avctx, AV_LOG_ERROR); return AVERROR(EINVAL); } -if (avctx->height > 576) { -av_log(avctx, AV_LOG_ERROR, "DVCPRO HD encoding is not supported.\n"); -return AVERROR_PATCHWELCOME; -} + ret = ff_dv_init_dynamic_tables(s, s->sys); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error initializing work tables.\n"); @@ -90,6 +87,7 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx) } /* bit budget for AC only in 5 MBs */ +static const int vs_total_ac_bits_hd = (68 * 6 + 52*2) * 5; static const int vs_total_ac_bits = (100 * 4 + 68 * 2) * 5; static const int mb_area_start[5] = { 1, 6, 21, 43, 64 }; @@ -158,6 +156,11 @@ typedef struct EncBlockInfo { uint8_t sign[64]; uint8_t partial_bit_count; uint32_t partial_bit_buffer; /* we can't use uint16_t here */ +/* used by DV100 only: a copy of the weighted and classified but + not-yet-quantized AC coefficients. This is necessary for + re-quantizing at different steps. */ +int16_t save[64]; +int min_qlevel; /* DV100 only: minimum qlevel (for AC coefficients >255) */ } EncBlockInfo; static av_always_inline PutBitContext *dv_encode_ac(EncBlockInfo *bi, @@ -243,13 +246,123 @@ static const int dv_weight_248[64] = { 170627, 170627, 153560, 153560, 165371, 165371, 144651, 144651, }; -static av_always_inline int dv_init_enc_block(EncBlockInfo *bi, uint8_t *data, - ptrdiff_t linesize, - DVVideoContext *s, int bias) +/* setting this to 1 results in a faster codec but + * somewhat lower image quality */ +#define DV100_SACRIFICE_QUALITY_FOR_SPEED 1 +#define DV100_ENABLE_FINER 1 + +/* pack combination of QNO and CNO into a single 8-bit value */ +#define DV100_MAKE_QLEVEL(qno,cno) ((qno<<2) | (cno)) +#define DV100_QLEVEL_QNO(qlevel) (qlevel>>2) +#define DV100_QLEVEL_CNO(qlevel) (qlevel&0x3) + +#define DV100_NUM_QLEVELS 31 + +/* The quantization step is determined by a combination of QNO and + CNO. We refer to these combinations as "qlevels" (this term is our + own, it's not mentioned in the spec). We use CNO, a multiplier on + the quantization step, to "fill in the gaps" between quantization + steps associated with successive values of QNO. e.g. there is no + QNO for a quantization step of 10, but we can use QNO=5 CNO=1 to + get the same result. The table below encodes combinations of QNO + and CNO in order of increasing quantization coarseness. */ +static const uint8_t dv100_qlevels[DV100_NUM_QLEVELS] = { +DV100_MAKE_QLEVEL( 1,0), // 1*1= 1 +DV100_MAKE_QLEVEL( 1,0), // 1*1= 1 +DV100_MAKE_QLEVEL( 2,0), // 2*1= 2 +DV100_MAKE_QLEVEL( 3,0), // 3*1= 3 +DV100_MAKE_QLEVEL( 4,0), // 4*1= 4 +DV100_MAKE_QLEVEL( 5,0), // 5*1= 5 +DV100_MAKE_QLEVEL( 6,0), // 6*1= 6 +DV100_MAKE_QLEVEL( 7,0), // 7*1= 7 +DV100_MAKE_QLEVEL( 8,0), // 8*1= 8 +DV100_MAKE_QLEVEL( 5,1), // 5*2=10 +DV100_MAKE_QLEVEL( 6,1), // 6*2=12 +DV100_MAKE_QLEVEL( 7,1), // 7*2=14 +DV100_MAKE_QLEVEL( 9,0), // 16*1=16 +DV100_MAKE_QLEVEL(10,0), // 18*1=18 +DV100_MAKE_QLEVEL(11,0), // 20*1=20 +DV100_MAKE_QLEVEL(12,0), // 22*1=22 +DV100_MAKE_QLEVEL(13,0), // 24*1=24 +DV100_MAKE_QLEVEL(14,0), // 28*1=28 +DV100_MAKE_QLEVEL( 9,1), // 16*2=32 +DV100_MAKE_QLEVEL(10,1), // 18*2=36 +DV100_MAKE_QLEVEL(11,1), // 20*2=40 +DV100_MAKE_QLEVEL(12,1), // 22*2=44 +DV100_MAKE_QLEVEL(13,1), // 24*2=48 +DV100_MAKE_QLEVEL(15,0), // 52*1=52 +DV100_MAKE_QLEVEL(14,1), // 28*2=56 +DV100_MAKE_QLEVEL( 9,2), // 16*4=64 +DV100_MAKE_QLEVEL(10,2), // 18*4=72 +DV100_MAKE_QLEVEL(11,2), // 20*4=80 +DV100_MAKE_QLEVEL(12,2), // 22*4=88 +DV100_MAKE_QLEVEL(13,2), // 24*4=96 +// ... +DV100_MAKE_QLEVEL(15,3), // 52*8=416 +}; + +static const int dv100_min_bias = 0; +static const int dv100_chroma_bias = 0; +static const int dv100_starting_qno = 1; + +#if DV100_SACRIFICE_QUALITY_FOR_SPEED +static const int
Re: [FFmpeg-devel] [PATCH] avcodec/dvdec: correctly set interlaced and tff
On Wed, Sep 11, 2019 at 1:29 PM Baptiste Coudurier < baptiste.coudur...@gmail.com> wrote: > Hey Carl, > > On Sep 11, 2019, at 12:38 PM, Carl Eugen Hoyos wrote: > > Am Mi., 11. Sept. 2019 um 21:31 Uhr schrieb Baptiste Coudurier > : > > > --- > libavcodec/dvdec.c | 13 ++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c > index 4345cd9e29..cfa0fb9905 100644 > --- a/libavcodec/dvdec.c > +++ b/libavcodec/dvdec.c > @@ -592,12 +592,19 @@ static int dvvideo_decode_frame(AVCodecContext > *avctx, void *data, > > if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) > return ret; > -frame.f->interlaced_frame = 1; > -frame.f->top_field_first = 0; > > /* Determine the codec's field order from the packet */ > if ( *vsc_pack == dv_video_control ) { > -frame.f->top_field_first = !(vsc_pack[3] & 0x40); > +if (avctx->height == 720) { > +frame.f->interlaced_frame = 0; > +frame.f->top_field_first = 0; > +} else if (avctx->height == 1080) { > +frame.f->interlaced_frame = 1; > +frame.f->top_field_first = (vsc_pack[3] & 0x40) == 0x40; > +} else { > +frame.f->interlaced_frame = (vsc_pack[3] & 0x10) == 0x10; > +frame.f->top_field_first = !(vsc_pack[3] & 0x40); > > > Does this fix ticket #5092? > > Will apply > > — > Baptiste Coudurier > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/dvenc: support encoding dvcprohd
On Thu, Sep 19, 2019 at 12:34 PM Michael Niedermayer wrote: > On Wed, Sep 11, 2019 at 12:29:57PM -0700, Baptiste Coudurier wrote: > > --- > > libavcodec/dv.h| 1 + > > libavcodec/dvenc.c | 576 - > > 2 files changed, 522 insertions(+), 55 deletions(-) > > a fate test should be added for this if its not already planed or done > I'm having issues with fate on macOS catalina right now :( > [...] > > > +/* LOOP1: weigh AC components and store to save[] */ > > +/* (i=0 is the DC component; we only include it to make the > > + number of loop iterations even, for future possible SIMD > optimization) */ > > +for (i = 0; i < 64; i += 2) { > > +int level0, level1; > > + > > +/* get the AC component (in zig-zag order) */ > > +level0 = blk[zigzag_scan[i+0]]; > > +level1 = blk[zigzag_scan[i+1]]; > > + > > +/* extract sign and make it the lowest bit */ > > +bi->sign[i+0] = (level0>>31)&1; > > +bi->sign[i+1] = (level1>>31)&1; > > + > > +/* take absolute value of the level */ > > +level0 = FFABS(level0); > > +level1 = FFABS(level1); > > + > > +/* weigh it */ > > +level0 = (level0*weight[i+0] + 4096 + (1<<17)) >> 18; > > +level1 = (level1*weight[i+1] + 4096 + (1<<17)) >> 18; > > + > > +/* save unquantized value */ > > +bi->save[i+0] = level0; > > +bi->save[i+1] = level1; > > +} > > + > > +/* find max component */ > > +for (i = 0; i < 64; i++) { > > +int ac = bi->save[i]; > > +if (ac > max) > > +max = ac; > > +} > > these 2 loops can be merged avoiding a 2nd pass > Merged [...] > > +static inline void dv_guess_qnos_hd(EncBlockInfo *blks, int *qnos) > > +{ > > +EncBlockInfo *b; > > +int min_qlevel[5]; > > +int qlevels[5]; > > +int size[5]; > > +int i, j; > > +/* cache block sizes at hypothetical qlevels */ > > +uint16_t size_cache[5*8][DV100_NUM_QLEVELS] = {{0}}; > > + > > +/* get minimum qlevels */ > > +for (i = 0; i < 5; i++) { > > +min_qlevel[i] = 1; > > +for (j = 0; j < 8; j++) { > > +if (blks[8*i+j].min_qlevel > min_qlevel[i]) > > +min_qlevel[i] = blks[8*i+j].min_qlevel; > > +} > > +} > > + > > +/* initialize sizes */ > > +for (i = 0; i < 5; i++) { > > +qlevels[i] = dv100_starting_qno; > > +if (qlevels[i] < min_qlevel[i]) > > +qlevels[i] = min_qlevel[i]; > > + > > +qnos[i] = DV100_QLEVEL_QNO(dv100_qlevels[qlevels[i]]); > > +size[i] = 0; > > +for (j = 0; j < 8; j++) { > > +size_cache[8*i+j][qlevels[i]] = > dv100_actual_quantize(&blks[8*i+j], qlevels[i]); > > +size[i] += size_cache[8*i+j][qlevels[i]]; > > +} > > +} > > + > > +/* must we go coarser? */ > > +if (size[0]+size[1]+size[2]+size[3]+size[4] > vs_total_ac_bits_hd) { > > +int largest = size[0] % 5; /* 'random' number */ > > + > > > +do { > > +/* find the macroblock with the lowest qlevel */ > > +for (i = 0; i < 5; i++) { > > +if (qlevels[i] < DV100_NUM_QLEVELS-1 && > > +qlevels[i] < qlevels[largest]) > > +largest = i; > > +} > > + > > +i = largest; > > +/* ensure that we don't enter infinite loop */ > > +largest = (largest+1) % 5; > > + > > +if (qlevels[i] >= DV100_NUM_QLEVELS-1) { > > +/* can't quantize any more */ > > +continue; > > +} > > + > > +/* quantize a little bit more */ > > +qlevels[i] += dv100_qlevel_inc; > > +if (qlevels[i] > DV100_NUM_QLEVELS-1) > > +qlevels[i] = DV100_NUM_QLEVELS-1; > > + > > +qnos[i] = DV100_QLEVEL_QNO(dv100_qlevels[qlevels[i]]); > > +size[i] = 0; > > + > > +/* for each block */ > > +b = &blks[8*i]; > > +for (j = 0; j < 8; j++, b++) { > > +/* accumulate block size into macroblock */ > > +if(size_cache[8*i+j][qlevels[i]] == 0) { > > +/* it is safe to use actual_quantize() here because > we only go from finer to coarser, > > + and it saves the final actual_quantize() down > below */ > > +size_cache[8*i+j][qlevels[i]] = > dv100_actual_quantize(b, qlevels[i]); > > +} > > +size[i] += size_cache[8*i+j][qlevels[i]]; > > +} /* for each block */ > > + > > +} while (vs_total_ac_bits_hd < size[0] + size[1] + size[2] + > size[3] + size[4] && > > + (qlevels[0] < DV100_NUM_QLEVELS-1 || > > + qlevels[1] < DV100_NUM_QLEVELS-1 || > > + qlevels[2] < DV100_NUM_QLEVELS-1 || > > + qlevels[3] < DV100_N
[FFmpeg-devel] [PATCH] [PATCH] avcodec: Add more kCVImageBufferColorPrimaries to videotoolboxenc
--- libavcodec/videotoolboxenc.c | 8 1 file changed, 8 insertions(+) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 40a7f643e0..cc08cf6a50 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -894,6 +894,14 @@ static int get_cv_color_primaries(AVCodecContext *avctx, *primaries = NULL; break; +case AVCOL_PRI_BT470BG: +*primaries = kCVImageBufferColorPrimaries_EBU_3213; +break; + +case AVCOL_PRI_SMPTE170M: +*primaries = kCVImageBufferColorPrimaries_SMPTE_C; +break; + case AVCOL_PRI_BT709: *primaries = kCVImageBufferColorPrimaries_ITU_R_709_2; break; -- 2.21.0 (Apple Git-122) ___ 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/v4l2_m2m_enc:free v4l2 encode session properly when initialiZzation fails Fix ticket 8285 bug
On Mon, 21. Oct 23:01, Colin NG wrote: > --- > libavcodec/v4l2_m2m_enc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c > index 474e6bef89..17fc3d30cf 100644 > --- a/libavcodec/v4l2_m2m_enc.c > +++ b/libavcodec/v4l2_m2m_enc.c > @@ -312,6 +312,7 @@ static av_cold int v4l2_encode_init(AVCodecContext *avctx) > ret = ff_v4l2_m2m_codec_init(priv); > if (ret) { > av_log(avctx, AV_LOG_ERROR, "can't configure encoder\n"); > +ff_v4l2_m2m_codec_end(priv); Is it better to add .caps_internal = FF_CODEC_CAP_INIT_CLEANUP instead ? This will avoid the same mem leak if v4l2_prepare_encoder() fails below. Also, fix your commit title/message. Thanks, -- Andriy ___ 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] avutil/eval: add function to track variable use
Helps better identification of expr eval failures. Gyan From 19bce329464676f071707b99575f80e5abe1cd4c Mon Sep 17 00:00:00 2001 From: Gyan Doshi Date: Sat, 2 Nov 2019 20:16:42 +0530 Subject: [PATCH] avutil/eval: add function to track variable use Helps avoid multiple evals of cross-referenced expressions and catch the use of non-applicable variables with respect to eval or special mode in filters --- libavutil/eval.c| 21 + libavutil/eval.h| 10 ++ libavutil/version.h | 4 ++-- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/libavutil/eval.c b/libavutil/eval.c index 48832979e2..ed0fe636f7 100644 --- a/libavutil/eval.c +++ b/libavutil/eval.c @@ -735,6 +735,27 @@ end: return ret; } +int av_expr_count_var(AVExpr *e, int var_start, int var_end) +{ +int i, count = 0; + +if (var_start >= var_end) +return AVERROR(EINVAL); + +if (!e) +return AVERROR(EINVAL); + +for (i = 0; e->type != e_const && i < 3 && e->param[i]; i++) +count += av_expr_count_var(e->param[i], var_start, var_end); + +if (e->type == e_const && +e->a.const_index >= var_start && +e->a.const_index < var_end) +count++; + +return count; +} + double av_expr_eval(AVExpr *e, const double *const_values, void *opaque) { Parser p = { 0 }; diff --git a/libavutil/eval.h b/libavutil/eval.h index dacd22b96e..030e5617cc 100644 --- a/libavutil/eval.h +++ b/libavutil/eval.h @@ -86,6 +86,16 @@ int av_expr_parse(AVExpr **expr, const char *s, */ double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); +/** + * Return the number of occurrences of variables within a range in a parsed expression + * + * @param var_start index of the start of the range of variables being seached for in the const_names identifiers + * @param var_end index of the first variable after the range of variables being seached for in the const_names identifiers + * @return the number of occurrences of the variables in the range, a negative value indicates that no expression was passed + * or the range wasn't strictly monotonic + */ +int av_expr_count_var(AVExpr *e, int var_start, int var_end); + /** * Free a parsed expression previously created with av_expr_parse(). */ diff --git a/libavutil/version.h b/libavutil/version.h index 27d663baf1..af3abf7265 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,8 +79,8 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 35 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MINOR 36 +#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ -- 2.23.0___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/dvenc: support encoding dvcprohd
Am Sa., 2. Nov. 2019 um 20:06 Uhr schrieb Baptiste Coudurier : > -if (avctx->height > 576) { > -av_log(avctx, AV_LOG_ERROR, "DVCPRO HD encoding is not > supported.\n"); > -return AVERROR_PATCHWELCOME; > -} Please mention ticket #1370. Thank you for the patch, 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] avcodec/dvdec: correctly decode bottom mb row in 1080i field mode
Am Sa., 2. Nov. 2019 um 20:02 Uhr schrieb Baptiste Coudurier : > > On Wed, Sep 11, 2019 at 12:29 PM Baptiste Coudurier < > baptiste.coudur...@gmail.com> wrote: > > > --- > > libavcodec/dv.h| 2 ++ > > libavcodec/dvdec.c | 90 +++--- > > 2 files changed, 72 insertions(+), 20 deletions(-) > > > > diff --git a/libavcodec/dv.h b/libavcodec/dv.h > > index 0e97bb200e..7ef5b7c552 100644 > > --- a/libavcodec/dv.h > > +++ b/libavcodec/dv.h > > @@ -31,6 +31,7 @@ > > #include "dv_profile.h" > > #include "me_cmp.h" > > #include "vlc.h" > > +#include "idctdsp.h" > > > > typedef struct DVwork_chunk { > > uint16_t buf_offset; > > @@ -52,6 +53,7 @@ typedef struct DVVideoContext { > > me_cmp_func ildct_cmp; > > DVwork_chunk work_chunks[4 * 12 * 27]; > > uint32_t idct_factor[2 * 4 * 16 * 64]; > > +IDCTDSPContext idsp; > > > > int quant_deadzone; > > } DVVideoContext; > > diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c > > index 89864f2edc..4345cd9e29 100644 > > --- a/libavcodec/dvdec.c > > +++ b/libavcodec/dvdec.c > > @@ -45,7 +45,6 @@ > > #include "dv_profile_internal.h" > > #include "dvdata.h" > > #include "get_bits.h" > > -#include "idctdsp.h" > > #include "internal.h" > > #include "put_bits.h" > > #include "simple_idct.h" > > @@ -177,24 +176,22 @@ static void dv_init_weight_tables(DVVideoContext > > *ctx, const AVDVProfile *d) > > static av_cold int dvvideo_decode_init(AVCodecContext *avctx) > > { > > DVVideoContext *s = avctx->priv_data; > > -IDCTDSPContext idsp; > > int i; > > > > -memset(&idsp,0, sizeof(idsp)); > > -ff_idctdsp_init(&idsp, avctx); > > +ff_idctdsp_init(&s->idsp, avctx); > > > > for (i = 0; i < 64; i++) > > -s->dv_zigzag[0][i] = idsp.idct_permutation[ff_zigzag_direct[i]]; > > +s->dv_zigzag[0][i] = > > s->idsp.idct_permutation[ff_zigzag_direct[i]]; > > > > if (avctx->lowres){ > > for (i = 0; i < 64; i++){ > > int j = ff_dv_zigzag248_direct[i]; > > -s->dv_zigzag[1][i] = idsp.idct_permutation[(j & 7) + (j & 8) > > * 4 + (j & 48) / 2]; > > +s->dv_zigzag[1][i] = s->idsp.idct_permutation[(j & 7) + (j & > > 8) * 4 + (j & 48) / 2]; > > } > > }else > > memcpy(s->dv_zigzag[1], ff_dv_zigzag248_direct, > > sizeof(s->dv_zigzag[1])); > > > > -s->idct_put[0] = idsp.idct_put; > > +s->idct_put[0] = s->idsp.idct_put; > > s->idct_put[1] = ff_simple_idct248_put; > > > > return ff_dvvideo_init(avctx); > > @@ -272,6 +269,49 @@ static inline void bit_copy(PutBitContext *pb, > > GetBitContext *gb) > > put_bits(pb, bits_left, get_bits(gb, bits_left)); > > } > > > > +static av_always_inline void put_block_8x4(int16_t *block, uint8_t > > *restrict p, int stride) > > +{ > > +int i, j; > > +const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; > > + > > +for (i = 0; i < 4; i++) { > > +for (j = 0; j < 8; j++) > > +p[j] = cm[block[j]]; > > +block += 8; > > +p += stride; > > +} > > +} > > + > > +static void dv100_idct_put_last_row_field_chroma(DVVideoContext *s, > > uint8_t *data, > > + int stride, int16_t > > *blocks) > > +{ > > +s->idsp.idct(blocks + 0*64); > > +s->idsp.idct(blocks + 1*64); > > + > > +put_block_8x4(blocks+0*64, data, stride<<1); > > +put_block_8x4(blocks+0*64 + 4*8, data + 8, stride<<1); > > +put_block_8x4(blocks+1*64, data + stride, stride<<1); > > +put_block_8x4(blocks+1*64 + 4*8, data + 8 + stride, stride<<1); > > +} > > + > > +static void dv100_idct_put_last_row_field_luma(DVVideoContext *s, uint8_t > > *data, > > + int stride, int16_t > > *blocks) > > +{ > > +s->idsp.idct(blocks + 0*64); > > +s->idsp.idct(blocks + 1*64); > > +s->idsp.idct(blocks + 2*64); > > +s->idsp.idct(blocks + 3*64); > > + > > +put_block_8x4(blocks+0*64, data, stride<<1); > > +put_block_8x4(blocks+0*64 + 4*8, data + 16, stride<<1); > > +put_block_8x4(blocks+1*64, data + 8, stride<<1); > > +put_block_8x4(blocks+1*64 + 4*8, data + 24, stride<<1); > > +put_block_8x4(blocks+2*64, data + stride, stride<<1); > > +put_block_8x4(blocks+2*64 + 4*8, data + 16 + stride, stride<<1); > > +put_block_8x4(blocks+3*64, data + 8 + stride, stride<<1); > > +put_block_8x4(blocks+3*64 + 4*8, data + 24 + stride, stride<<1); > > +} > > + > > /* mb_x and mb_y are in units of 8 pixels */ > > static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) > > { > > @@ -443,14 +483,18 @@ retry: > > } > > y_ptr= s->frame->data[0] + > > ((mb_y * s->frame->linesize[0] + mb_x) << > > log2_blocksize); > > -linesize = s->frame->linesize[0] << is_field_mode[mb_inde