[FFmpeg-cvslog] avformat/hls: continue to play enabled playlist when have failed playlist
ffmpeg | branch: master | Steven Liu | Tue Sep 3 09:55:17 2019 +0800| [4e0860e36305c768c3d97b41d38122e59a18da87] | committer: Steven Liu avformat/hls: continue to play enabled playlist when have failed playlist fix ticket: 7811 Signed-off-by: Steven Liu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4e0860e36305c768c3d97b41d38122e59a18da87 --- libavformat/hls.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 17a75e20cd..8dc0e4e385 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -116,6 +116,7 @@ struct playlist { int n_segments; struct segment **segments; int needed; +int broken; int cur_seq_no; int64_t cur_seg_offset; int64_t last_load_time; @@ -1815,15 +1816,21 @@ static int hls_read_header(AVFormatContext *s) if (c->n_playlists > 1 || c->playlists[0]->n_segments == 0) { for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; -if ((ret = parse_playlist(c, pls->url, pls, NULL)) < 0) +if ((ret = parse_playlist(c, pls->url, pls, NULL)) < 0) { +av_log(s, AV_LOG_WARNING, "parse_playlist error %s [%s]\n", av_err2str(ret), pls->url); +pls->broken = 1; +if (c->n_playlists > 1) +continue; goto fail; +} } } -if (c->variants[0]->playlists[0]->n_segments == 0) { -av_log(s, AV_LOG_WARNING, "Empty segment\n"); -ret = AVERROR_EOF; -goto fail; +for (i = 0; i < c->n_variants; i++) { +if (c->variants[i]->playlists[0]->n_segments == 0) { +av_log(s, AV_LOG_WARNING, "Empty segment [%s]\n", c->variants[i]->playlists[0]->url); +c->variants[i]->playlists[0]->broken = 1; +} } /* If this isn't a live stream, calculate the total duration of the @@ -1994,6 +2001,9 @@ static int recheck_discard_flags(AVFormatContext *s, int first) cur_needed = playlist_needed(c->playlists[i]); +if (pls->broken) { +continue; +} if (cur_needed && !pls->needed) { pls->needed = 1; changed = 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] avformat/hlsenc: free the original malloc pointer to avoid error when system function used in the following patch
ffmpeg | branch: master | Limin Wang | Wed Oct 23 23:55:16 2019 +0800| [09afddf04e6fd2f3c62b9e0629764bb04a002cde] | committer: Steven Liu avformat/hlsenc: free the original malloc pointer to avoid error when system function used in the following patch Signed-off-by: Limin Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09afddf04e6fd2f3c62b9e0629764bb04a002cde --- libavformat/hlsenc.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index e2c1f8a4c3..013e91ad88 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -493,8 +493,11 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls, int ret = 0, path_size, sub_path_size; int segment_cnt = 0; char *dirname = NULL, *sub_path; +char *dirname_r = NULL; +char *dirname_repl = NULL; char *path = NULL; char *vtt_dirname = NULL; +char *vtt_dirname_r = NULL; AVDictionary *options = NULL; AVIOContext *out = NULL; const char *proto = NULL; @@ -523,28 +526,27 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls, } if (segment && !hls->use_localtime_mkdir) { -char *dirname_r = hls->segment_filename ? av_strdup(hls->segment_filename): av_strdup(vs->avf->url); +dirname_r = hls->segment_filename ? av_strdup(hls->segment_filename): av_strdup(vs->avf->url); dirname = (char*)av_dirname(dirname_r); } /* if %v is present in the file's directory * all segment belongs to the same variant, so do it only once before the loop*/ if (dirname && av_stristr(dirname, "%v")) { -char * r_dirname = dirname; +char * dirname_repl = dirname; if (!vs->varname) { -if (replace_int_data_in_filename(&r_dirname, dirname, 'v', segment->var_stream_idx) < 1) { +if (replace_int_data_in_filename(&dirname_repl, dirname, 'v', segment->var_stream_idx) < 1) { ret = AVERROR(EINVAL); goto fail; } } else { -if (replace_str_data_in_filename(&r_dirname, dirname, 'v', vs->varname) < 1) { +if (replace_str_data_in_filename(&dirname_repl, dirname, 'v', vs->varname) < 1) { ret = AVERROR(EINVAL); goto fail; } } -av_freep(&dirname); -dirname = r_dirname; +dirname = dirname_repl; } while (segment) { @@ -578,7 +580,7 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls, } if ((segment->sub_filename[0] != '\0')) { -char *vtt_dirname_r = av_strdup(vs->vtt_avf->url); +vtt_dirname_r = av_strdup(vs->vtt_avf->url); vtt_dirname = (char*)av_dirname(vtt_dirname_r); sub_path_size = strlen(segment->sub_filename) + 1 + strlen(vtt_dirname) + 1; sub_path = av_malloc(sub_path_size); @@ -589,7 +591,7 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls, snprintf(sub_path, sub_path_size, "%s%c%s", vtt_dirname, SEPARATOR, segment->sub_filename); -av_freep(&vtt_dirname); +av_freep(&vtt_dirname_r); if (hls->method || (proto && !av_strcasecmp(proto, "http"))) { av_dict_set(&options, "method", "DELETE", 0); @@ -614,8 +616,9 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls, fail: av_freep(&path); -av_freep(&dirname); -av_freep(&vtt_dirname); +av_freep(&dirname_r); +av_freep(&dirname_repl); +av_freep(&vtt_dirname_r); 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] avfilter/vf_colorbalance: switch to floats
ffmpeg | branch: master | Paul B Mahol | Wed Nov 13 12:56:04 2019 +0100| [bffd0f7b69b843d583dd4ab46de19dab98b68d39] | committer: Paul B Mahol avfilter/vf_colorbalance: switch to floats > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bffd0f7b69b843d583dd4ab46de19dab98b68d39 --- libavfilter/vf_colorbalance.c | 96 +-- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/libavfilter/vf_colorbalance.c b/libavfilter/vf_colorbalance.c index e2e380174d..097a3d778f 100644 --- a/libavfilter/vf_colorbalance.c +++ b/libavfilter/vf_colorbalance.c @@ -36,9 +36,9 @@ typedef struct ThreadData { } ThreadData; typedef struct Range { -double shadows; -double midtones; -double highlights; +float shadows; +float midtones; +float highlights; } Range; typedef struct ColorBalanceContext { @@ -59,16 +59,16 @@ typedef struct ColorBalanceContext { #define OFFSET(x) offsetof(ColorBalanceContext, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM static const AVOption colorbalance_options[] = { -{ "rs", "set red shadows", OFFSET(cyan_red.shadows), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, -{ "gs", "set green shadows",OFFSET(magenta_green.shadows), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, -{ "bs", "set blue shadows", OFFSET(yellow_blue.shadows), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, -{ "rm", "set red midtones", OFFSET(cyan_red.midtones), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, -{ "gm", "set green midtones", OFFSET(magenta_green.midtones), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, -{ "bm", "set blue midtones",OFFSET(yellow_blue.midtones), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, -{ "rh", "set red highlights", OFFSET(cyan_red.highlights), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, -{ "gh", "set green highlights", OFFSET(magenta_green.highlights), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, -{ "bh", "set blue highlights", OFFSET(yellow_blue.highlights), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, -{ "pl", "preserve lightness", OFFSET(preserve_lightness), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, +{ "rs", "set red shadows", OFFSET(cyan_red.shadows), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS }, +{ "gs", "set green shadows",OFFSET(magenta_green.shadows), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS }, +{ "bs", "set blue shadows", OFFSET(yellow_blue.shadows), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS }, +{ "rm", "set red midtones", OFFSET(cyan_red.midtones), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS }, +{ "gm", "set green midtones", OFFSET(magenta_green.midtones), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS }, +{ "bm", "set blue midtones",OFFSET(yellow_blue.midtones), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS }, +{ "rh", "set red highlights", OFFSET(cyan_red.highlights), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS }, +{ "gh", "set green highlights", OFFSET(magenta_green.highlights), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS }, +{ "bh", "set blue highlights", OFFSET(yellow_blue.highlights), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS }, +{ "pl", "preserve lightness", OFFSET(preserve_lightness), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, { NULL } }; @@ -98,35 +98,35 @@ static int query_formats(AVFilterContext *ctx) return ff_set_common_formats(ctx, fmts_list); } -static double get_component(double v, double l, -double s, double m, double h) +static float get_component(float v, float l, + float s, float m, float h) { -const double a = 4, b = 0.333, scale = 0.7; +const float a = 4.f, b = 0.333f, scale = 0.7f; -s *= av_clipd((b - l) * a + 0.5, 0, 1) * scale; -m *= av_clipd((l - b) * a + 0.5, 0, 1) * av_clipd((1.0 - l - b) * a + 0.5, 0, 1) * scale; -h *= av_clipd((l + b - 1) * a + 0.5, 0, 1) * scale; +s *= av_clipf((b - l) * a + 0.5f, 0, 1) * scale; +m *= av_clipf((l - b) * a + 0.5f, 0, 1) * av_clipf((1.0 - l - b) * a + 0.5f, 0, 1) * scale; +h *= av_clipf((l + b - 1) * a + 0.5f, 0, 1) * scale; v += s; v += m; v += h; -return av_clipd(v, 0, 1); +return av_clipf(v, 0, 1); } -static double hfun(double n, double h, double s, double l) +static float hfun(float n, float h, float s, float l) { -double a = s * FFMIN(l, 1. - l); -double k = fmod(n + h / 30., 12.); +float a = s * FFMIN(l, 1. - l); +float k = fmodf(n + h / 30.f, 12.f); -return av_clipd(l - a * FFMAX(FFMIN3(k - 3, 9 - k, 1), -1.), 0, 1); +return av_clipf(l - a * FFMAX(FFMIN3(k - 3.f, 9.f - k, 1), -1.f), 0, 1); } -static void preservel(double *r, double *g, double *b, double l) +static void preservel(float *r, float *g, float *b, float l)
[FFmpeg-cvslog] avfilter/vf_colorbalance: add option to preserve lightness
ffmpeg | branch: master | Paul B Mahol | Wed Nov 13 12:26:18 2019 +0100| [d19fdc83b35c66a9eada41dfb8c1e28076d73f1b] | committer: Paul B Mahol avfilter/vf_colorbalance: add option to preserve lightness > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d19fdc83b35c66a9eada41dfb8c1e28076d73f1b --- doc/filters.texi | 3 + libavfilter/vf_colorbalance.c | 161 ++ 2 files changed, 118 insertions(+), 46 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 6800124574..9268c33e30 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -7080,6 +7080,9 @@ Adjust red, green and blue midtones (medium pixels). Adjust red, green and blue highlights (brightest pixels). Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}. + +@item pl +Preserve lightness when changing color balance. Default is disabled. @end table @subsection Examples diff --git a/libavfilter/vf_colorbalance.c b/libavfilter/vf_colorbalance.c index eb870ac2ad..e2e380174d 100644 --- a/libavfilter/vf_colorbalance.c +++ b/libavfilter/vf_colorbalance.c @@ -46,9 +46,11 @@ typedef struct ColorBalanceContext { Range cyan_red; Range magenta_green; Range yellow_blue; +int preserve_lightness; uint8_t rgba_map[4]; int depth; +int max; int step; int (*color_balance)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); @@ -66,6 +68,7 @@ static const AVOption colorbalance_options[] = { { "rh", "set red highlights", OFFSET(cyan_red.highlights), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, { "gh", "set green highlights", OFFSET(magenta_green.highlights), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, { "bh", "set blue highlights", OFFSET(yellow_blue.highlights), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, +{ "pl", "preserve lightness", OFFSET(preserve_lightness), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, { NULL } }; @@ -95,14 +98,10 @@ static int query_formats(AVFilterContext *ctx) return ff_set_common_formats(ctx, fmts_list); } -static int get_component(int c, int depth, double l, - double s, double m, double h) +static double get_component(double v, double l, +double s, double m, double h) { const double a = 4, b = 0.333, scale = 0.7; -const double max = (1 << depth) - 1; -double v = c / max; - -l /= max; s *= av_clipd((b - l) * a + 0.5, 0, 1) * scale; m *= av_clipd((l - b) * a + 0.5, 0, 1) * av_clipd((1.0 - l - b) * a + 0.5, 0, 1) * scale; @@ -111,10 +110,49 @@ static int get_component(int c, int depth, double l, v += s; v += m; v += h; -v = av_clipd(v, 0, 1); -c = v * max; -return av_clip_uintp2_c(c, depth); +return av_clipd(v, 0, 1); +} + +static double hfun(double n, double h, double s, double l) +{ +double a = s * FFMIN(l, 1. - l); +double k = fmod(n + h / 30., 12.); + +return av_clipd(l - a * FFMAX(FFMIN3(k - 3, 9 - k, 1), -1.), 0, 1); +} + +static void preservel(double *r, double *g, double *b, double l) +{ +double max = FFMAX3(*r, *g, *b); +double min = FFMIN3(*r, *g, *b); +double h, s; + +l *= 0.5; + +if (*r == *g && *g == *b) { +h = 0.; +} else if (max == *r) { +h = 60. * (0. + (*g - *b) / (max - min)); +} else if (max == *g) { +h = 60. * (2. + (*b - *r) / (max - min)); +} else if (max == *b) { +h = 60. * (4. + (*r - *g) / (max - min)); +} else { +h = 0.; +} +if (h < 0.) +h += 360.; + +if (max == 0. || min == 1.) { +s = 0.; +} else { +s = (max - min) / (1. - FFABS(2. * l - 1)); +} + +*r = hfun(0, h, s, l); +*g = hfun(8, h, s, l); +*b = hfun(4, h, s, l); } static int color_balance8_p(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) @@ -133,19 +171,26 @@ static int color_balance8_p(AVFilterContext *ctx, void *arg, int jobnr, int nb_j uint8_t *dstb = out->data[1] + slice_start * out->linesize[1]; uint8_t *dstr = out->data[2] + slice_start * out->linesize[2]; uint8_t *dsta = out->data[3] + slice_start * out->linesize[3]; -const int depth = s->depth; +const double max = s->max; int i, j; for (i = slice_start; i < slice_end; i++) { for (j = 0; j < out->width; j++) { -const int r = srcr[j]; -const int g = srcg[j]; -const int b = srcb[j]; -const int l = FFMAX3(r, g, b) + FFMIN3(r, g, b); - -dstr[j] = get_component(r, depth, l, s->cyan_red.shadows, s->cyan_red.midtones, s->cyan_red.highlights); -dstg[j] = get_component(g, depth, l, s->magenta_green.shadows, s->magenta_green.midtones, s->magenta_green.highlights); -dstb[j] = get_component(b, depth, l, s->yellow_blue.shadows, s->yellow_blue.midtones, s->yellow_blue.highlights); +double r
[FFmpeg-cvslog] avfilter/vf_colorbalance: add support for commands
ffmpeg | branch: master | Paul B Mahol | Wed Nov 13 12:59:17 2019 +0100| [45f03cdd20c3f9a83d4955fa32ffdc287229ccfd] | committer: Paul B Mahol avfilter/vf_colorbalance: add support for commands > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=45f03cdd20c3f9a83d4955fa32ffdc287229ccfd --- doc/filters.texi | 4 libavfilter/vf_colorbalance.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index 9268c33e30..e48f9c99e5 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -7095,6 +7095,10 @@ colorbalance=rs=.3 @end example @end itemize +@subsection Commands + +This filter supports the all above options as @ref{commands}. + @section colorchannelmixer Adjust video input frames by re-mixing color channels. diff --git a/libavfilter/vf_colorbalance.c b/libavfilter/vf_colorbalance.c index 097a3d778f..cc90dc08c7 100644 --- a/libavfilter/vf_colorbalance.c +++ b/libavfilter/vf_colorbalance.c @@ -57,7 +57,7 @@ typedef struct ColorBalanceContext { } ColorBalanceContext; #define OFFSET(x) offsetof(ColorBalanceContext, x) -#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM static const AVOption colorbalance_options[] = { { "rs", "set red shadows", OFFSET(cyan_red.shadows), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS }, { "gs", "set green shadows",OFFSET(magenta_green.shadows), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS }, @@ -448,4 +448,5 @@ AVFilter ff_vf_colorbalance = { .inputs= colorbalance_inputs, .outputs = colorbalance_outputs, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, +.process_command = ff_filter_process_command, }; ___ 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/mxfenc: correctly set width values for dvcprohd
ffmpeg | branch: master | Baptiste Coudurier | Mon Aug 26 13:15:32 2019 -0700| [11a38be99cd0c6685a65940cf0c9114d338235a3] | committer: Baptiste Coudurier avformat/mxfenc: correctly set width values for dvcprohd > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=11a38be99cd0c6685a65940cf0c9114d338235a3 --- libavformat/mxfenc.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index aa23ee3947..a76be64c5c 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1190,7 +1190,7 @@ static int64_t mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID { MXFStreamContext *sc = st->priv_data; AVIOContext *pb = s->pb; -int stored_width = (st->codecpar->width +15)/16*16; +int stored_width = 0; int stored_height = (st->codecpar->height+15)/16*16; int display_height; int f1, f2; @@ -1199,6 +1199,15 @@ static int64_t mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID get_trc(transfer_ul, st->codecpar->color_trc); +if (st->codecpar->codec_id == AV_CODEC_ID_DVVIDEO) { +if (st->codecpar->height == 1080) +stored_width = 1920; +else if (st->codecpar->height == 720) +stored_width = 1280; +} +if (!stored_width) +stored_width = (st->codecpar->width+15)/16*16; + mxf_write_local_tag(pb, 4, 0x3203); avio_wb32(pb, stored_width); @@ -1221,7 +1230,7 @@ static int64_t mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID //Sampled width mxf_write_local_tag(pb, 4, 0x3205); -avio_wb32(pb, st->codecpar->width); +avio_wb32(pb, stored_width); //Samples height mxf_write_local_tag(pb, 4, 0x3204); @@ -1236,7 +1245,7 @@ static int64_t mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID avio_wb32(pb, 0); mxf_write_local_tag(pb, 4, 0x3209); -avio_wb32(pb, st->codecpar->width); +avio_wb32(pb, stored_width); if (st->codecpar->height == 608) // PAL + VBI display_height = 576; ___ 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/dvenc: support encoding dvcprohd
ffmpeg | branch: master | Baptiste Coudurier | Sat Nov 9 15:54:16 2019 -0800| [a1403032c8cb0f78caa7723df940b13d247cfe47] | committer: Baptiste Coudurier avcodec/dvenc: support encoding dvcprohd > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1403032c8cb0f78caa7723df940b13d247cfe47 --- libavcodec/dv.h | 1 + libavcodec/dvenc.c | 561 +++- tests/fate/vcodec.mak | 14 +- tests/ref/vsynth/vsynth1-dv-fhd | 4 + tests/ref/vsynth/vsynth1-dv-hd | 4 + tests/ref/vsynth/vsynth2-dv-fhd | 4 + tests/ref/vsynth/vsynth2-dv-hd | 4 + tests/ref/vsynth/vsynth3-dv-fhd | 4 + tests/ref/vsynth/vsynth3-dv-hd | 4 + 9 files changed, 541 insertions(+), 59 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..dca57feb4f 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), //
[FFmpeg-cvslog] librav1e: Don't make users explicitly set -qp -1 to use bit rate mode
ffmpeg | branch: master | Derek Buitenhuis | Mon Nov 11 14:15:41 2019 +| [1354c39c78e5ca1e8bfaf9b65ed021f672f0729f] | committer: Derek Buitenhuis librav1e: Don't make users explicitly set -qp -1 to use bit rate mode Signed-off-by: Derek Buitenhuis > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1354c39c78e5ca1e8bfaf9b65ed021f672f0729f --- libavcodec/librav1e.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c index 5052cac896..a5aedd512c 100644 --- a/libavcodec/librav1e.c +++ b/libavcodec/librav1e.c @@ -533,7 +533,7 @@ retry: #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { -{ "qp", "use constant quantizer mode", OFFSET(quantizer), AV_OPT_TYPE_INT, { .i64 = 100 }, -1, 255, VE }, +{ "qp", "use constant quantizer mode", OFFSET(quantizer), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, VE }, { "speed", "what speed preset to use", OFFSET(speed), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 10, VE }, { "tiles", "number of tiles encode with", OFFSET(tiles), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE }, { "tile-rows", "number of tiles rows to encode with", OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE }, ___ 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] tests/ref/vsynth: add missing reference files, fix build
ffmpeg | branch: master | Michael Niedermayer | Wed Nov 13 23:18:58 2019 +0100| [8d5f9daacd8153d92b9b1a87e0704e1ebf35346d] | committer: Michael Niedermayer tests/ref/vsynth: add missing reference files, fix build > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d5f9daacd8153d92b9b1a87e0704e1ebf35346d --- tests/ref/vsynth/vsynth_lena-dv-fhd | 4 tests/ref/vsynth/vsynth_lena-dv-hd | 4 2 files changed, 8 insertions(+) diff --git a/tests/ref/vsynth/vsynth_lena-dv-fhd b/tests/ref/vsynth/vsynth_lena-dv-fhd new file mode 100644 index 00..51a4505011 --- /dev/null +++ b/tests/ref/vsynth/vsynth_lena-dv-fhd @@ -0,0 +1,4 @@ +3a33e512f8b3f4213477c98d4e7e2559 *tests/data/fate/vsynth_lena-dv-fhd.dv +2880 tests/data/fate/vsynth_lena-dv-fhd.dv +b97e0a057202359ef93f2ec0b9fdfec4 *tests/data/fate/vsynth_lena-dv-fhd.out.rawvideo +stddev:1.03 PSNR: 47.80 MAXDIFF: 14 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth_lena-dv-hd b/tests/ref/vsynth/vsynth_lena-dv-hd new file mode 100644 index 00..aba756c5f1 --- /dev/null +++ b/tests/ref/vsynth/vsynth_lena-dv-hd @@ -0,0 +1,4 @@ +01a61c53943a421fa6a5e03dbc205972 *tests/data/fate/vsynth_lena-dv-hd.dv +1440 tests/data/fate/vsynth_lena-dv-hd.dv +4db4175c80ea1f16b7ec303611b8873a *tests/data/fate/vsynth_lena-dv-hd.out.rawvideo +stddev:1.49 PSNR: 44.66 MAXDIFF: 27 bytes: 7603200/ 7603200 ___ 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/id3v2: Avoid av_strdup for key and value of dict
ffmpeg | branch: master | Andreas Rheinhardt | Sun Nov 10 19:04:51 2019 +0100| [a7245adee3e98d4b2e2a1bb7ddc0caae898b5193] | committer: Michael Niedermayer avformat/id3v2: Avoid av_strdup for key and value of dict Signed-off-by: Andreas Rheinhardt Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7245adee3e98d4b2e2a1bb7ddc0caae898b5193 --- libavformat/id3v2.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index b43ab1745f..7bae036635 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -361,8 +361,8 @@ static void read_uslt(AVFormatContext *s, AVIOContext *pb, int taglen, { uint8_t lang[4]; uint8_t *descriptor = NULL; // 'Content descriptor' -uint8_t *text = NULL; -char *key = NULL; +uint8_t *text; +char *key; int encoding; int ok = 0; @@ -387,18 +387,19 @@ static void read_uslt(AVFormatContext *s, AVIOContext *pb, int taglen, key = av_asprintf("lyrics-%s%s%s", descriptor[0] ? (char *)descriptor : "", descriptor[0] ? "-" : "", lang); -if (!key) +if (!key) { +av_free(text); goto error; +} -av_dict_set(metadata, key, text, 0); +av_dict_set(metadata, key, text, +AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); ok = 1; error: if (!ok) av_log(s, AV_LOG_ERROR, "Error reading lyrics, skipped\n"); av_free(descriptor); -av_free(text); -av_free(key); } /** ___ 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".