[FFmpeg-cvslog] fftools/ffmpeg: properly initialize output stream field order
ffmpeg | branch: master | Tobias Rapp | Thu Apr 26 14:23:02 2018 +0200| [a150b2e3a099fd539ecc6664050fd20617ce223c] | committer: Tobias Rapp fftools/ffmpeg: properly initialize output stream field order Fixes stream field order written by avformat_write_header when "top" option is specified on the command-line. Signed-off-by: Tobias Rapp > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a150b2e3a099fd539ecc6664050fd20617ce223c --- fftools/ffmpeg.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 5dc198f933..5a19a09d9a 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3389,6 +3389,12 @@ static int init_output_stream_encode(OutputStream *ost) enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample; } +if (ost->top_field_first == 0) { +enc_ctx->field_order = AV_FIELD_BB; +} else if (ost->top_field_first == 1) { +enc_ctx->field_order = AV_FIELD_TT; +} + if (ost->forced_keyframes) { if (!strncmp(ost->forced_keyframes, "expr:", 5)) { ret = av_expr_parse(&ost->forced_keyframes_pexpr, ost->forced_keyframes+5, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/vf_overlay: add x86 SIMD
ffmpeg | branch: master | Paul B Mahol | Mon Apr 30 12:01:07 2018 +0200| [6d7c63588c81ba61b75701702b8680bd0063f36c] | committer: Paul B Mahol avfilter/vf_overlay: add x86 SIMD Specifically for yuv444, yuv422, yuv420 format when main stream has no alpha, and alpha is straight. Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6d7c63588c81ba61b75701702b8680bd0063f36c --- libavfilter/vf_overlay.c | 75 +--- libavfilter/vf_overlay.h | 85 ++ libavfilter/x86/Makefile | 2 + libavfilter/x86/vf_overlay.asm| 144 ++ libavfilter/x86/vf_overlay_init.c | 63 + 5 files changed, 313 insertions(+), 56 deletions(-) diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index 8c1895cca4..c4d87306f1 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -39,6 +39,7 @@ #include "drawutils.h" #include "framesync.h" #include "video.h" +#include "vf_overlay.h" typedef struct ThreadData { AVFrame *dst, *src; @@ -59,21 +60,6 @@ static const char *const var_names[] = { NULL }; -enum var_name { -VAR_MAIN_W,VAR_MW, -VAR_MAIN_H,VAR_MH, -VAR_OVERLAY_W, VAR_OW, -VAR_OVERLAY_H, VAR_OH, -VAR_HSUB, -VAR_VSUB, -VAR_X, -VAR_Y, -VAR_N, -VAR_POS, -VAR_T, -VAR_VARS_NB -}; - #define MAIN0 #define OVERLAY 1 @@ -92,45 +78,6 @@ enum EvalMode { EVAL_MODE_NB }; -enum OverlayFormat { -OVERLAY_FORMAT_YUV420, -OVERLAY_FORMAT_YUV422, -OVERLAY_FORMAT_YUV444, -OVERLAY_FORMAT_RGB, -OVERLAY_FORMAT_GBRP, -OVERLAY_FORMAT_AUTO, -OVERLAY_FORMAT_NB -}; - -typedef struct OverlayContext { -const AVClass *class; -int x, y; ///< position of overlaid picture - -uint8_t main_is_packed_rgb; -uint8_t main_rgba_map[4]; -uint8_t main_has_alpha; -uint8_t overlay_is_packed_rgb; -uint8_t overlay_rgba_map[4]; -uint8_t overlay_has_alpha; -int format; ///< OverlayFormat -int alpha_format; -int eval_mode; ///< EvalMode - -FFFrameSync fs; - -int main_pix_step[4]; ///< steps per pixel for each plane of the main output -int overlay_pix_step[4];///< steps per pixel for each plane of the overlay -int hsub, vsub; ///< chroma subsampling values -const AVPixFmtDescriptor *main_desc; ///< format descriptor for main input - -double var_values[VAR_VARS_NB]; -char *x_expr, *y_expr; - -AVExpr *x_pexpr, *y_pexpr; - -int (*blend_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); -} OverlayContext; - static av_cold void uninit(AVFilterContext *ctx) { OverlayContext *s = ctx->priv; @@ -509,6 +456,7 @@ static av_always_inline void blend_plane(AVFilterContext *ctx, int jobnr, int nb_jobs) { +OverlayContext *octx = ctx->priv; int src_wp = AV_CEIL_RSHIFT(src_w, hsub); int src_hp = AV_CEIL_RSHIFT(src_h, vsub); int dst_wp = AV_CEIL_RSHIFT(dst_w, hsub); @@ -538,8 +486,18 @@ static av_always_inline void blend_plane(AVFilterContext *ctx, s = sp + k; a = ap + (kblend_row[i](d, da, s, a, kmax - k, src->linesize[3]); -for (kmax = FFMIN(-xp + dst_wp, src_wp); k < kmax; k++) { +s += c; +d += dst_step * c; +da += (1 << hsub) * c; +a += (1 << hsub) * c; +k += c; +} +for (; k < kmax; k++) { int alpha_v, alpha_h, alpha; // average alpha for color components, improve quality @@ -916,7 +874,7 @@ static int config_input_main(AVFilterLink *inlink) } if (!s->alpha_format) -return 0; +goto end; switch (s->format) { case OVERLAY_FORMAT_YUV420: @@ -960,6 +918,11 @@ static int config_input_main(AVFilterLink *inlink) } break; } + +end: +if (ARCH_X86) +ff_overlay_init_x86(s, s->format, s->alpha_format, s->main_has_alpha); + return 0; } diff --git a/libavfilter/vf_overlay.h b/libavfilter/vf_overlay.h new file mode 100644 index 00..072ece358f --- /dev/null +++ b/libavfilter/vf_overlay.h @@ -0,0 +1,85 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have rece
[FFmpeg-cvslog] avfilter/vf_convolution: rewrite so it doesn't use temp buffers
ffmpeg | branch: master | Paul B Mahol | Wed May 2 19:23:41 2018 +0200| [ab1114a0f5b32d91e7f56dc1183087a33a96153c] | committer: Paul B Mahol avfilter/vf_convolution: rewrite so it doesn't use temp buffers Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ab1114a0f5b32d91e7f56dc1183087a33a96153c --- libavfilter/vf_convolution.c | 969 --- 1 file changed, 261 insertions(+), 708 deletions(-) diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c index e9b1f4abe8..026b881873 100644 --- a/libavfilter/vf_convolution.c +++ b/libavfilter/vf_convolution.c @@ -21,6 +21,7 @@ #include "libavutil/avstring.h" #include "libavutil/imgutils.h" +#include "libavutil/intreadwrite.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avfilter.h" @@ -40,10 +41,8 @@ typedef struct ConvolutionContext { int size[4]; int depth; +int max; int bpc; -int bstride; -uint8_t *buffer; -uint8_t **bptrs; int nb_planes; int nb_threads; int planewidth[4]; @@ -52,7 +51,11 @@ typedef struct ConvolutionContext { int matrix_length[4]; int copy[4]; -int (*filter[4])(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); +void (*setup[4])(const uint8_t *c[], const uint8_t *src, int stride, + int x, int width, int y, int height, int bpc); +void (*filter[4])(uint8_t *dst, const uint8_t *src, int width, + float rdiv, float bias, const int *const matrix, + const uint8_t *c[], int peak); } ConvolutionContext; #define OFFSET(x) offsetof(ConvolutionContext, x) @@ -120,743 +123,314 @@ static int query_formats(AVFilterContext *ctx) return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); } -static inline void line_copy8(uint8_t *line, const uint8_t *srcp, int width, int mergin) +typedef struct ThreadData { +AVFrame *in, *out; +} ThreadData; + +static void filter16_prewitt(uint8_t *dstp, const uint8_t *src, int width, + float scale, float delta, const int *const matrix, + const uint8_t *c[], int peak) { -int i; +uint16_t *dst = (uint16_t *)dstp; +int x; -memcpy(line, srcp, width); +for (x = 0; x < width; x++) { +int suma = AV_RN16A(&c[0][2 * x]) * -1 + AV_RN16A(&c[1][2 * x]) * -1 + AV_RN16A(&c[2][2 * x]) * -1 + + AV_RN16A(&c[6][2 * x]) * 1 + AV_RN16A(&c[7][2 * x]) * 1 + AV_RN16A(&c[8][2 * x]) * 1; +int sumb = AV_RN16A(&c[0][2 * x]) * -1 + AV_RN16A(&c[2][2 * x]) * 1 + AV_RN16A(&c[3][2 * x]) * -1 + + AV_RN16A(&c[5][2 * x]) * 1 + AV_RN16A(&c[6][2 * x]) * -1 + AV_RN16A(&c[8][2 * x]) * 1; -for (i = mergin; i > 0; i--) { -line[-i] = line[i]; -line[width - 1 + i] = line[width - 1 - i]; +dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak); } } -static inline void line_copy16(uint16_t *line, const uint16_t *srcp, int width, int mergin) +static void filter16_roberts(uint8_t *dstp, const uint8_t *src, int width, + float scale, float delta, const int *const matrix, + const uint8_t *c[], int peak) { -int i; +uint16_t *dst = (uint16_t *)dstp; +int x; -memcpy(line, srcp, width * 2); +for (x = 0; x < width; x++) { +int suma = AV_RN16A(&c[0][2 * x]) * 1 + AV_RN16A(&c[4][2 * x]) * -1; +int sumb = AV_RN16A(&c[1][2 * x]) * 1 + AV_RN16A(&c[3][2 * x]) * -1; -for (i = mergin; i > 0; i--) { -line[-i] = line[i]; -line[width - 1 + i] = line[width - 1 - i]; +dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak); } } -typedef struct ThreadData { -AVFrame *in, *out; -int plane; -} ThreadData; - -static int filter16_prewitt(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +static void filter16_sobel(uint8_t *dstp, const uint8_t *src, int width, + float scale, float delta, const int *const matrix, + const uint8_t *c[], int peak) { -ConvolutionContext *s = ctx->priv; -ThreadData *td = arg; -AVFrame *in = td->in; -AVFrame *out = td->out; -const int plane = td->plane; -const int peak = (1 << s->depth) - 1; -const int stride = in->linesize[plane] / 2; -const int bstride = s->bstride; -const int height = s->planeheight[plane]; -const int width = s->planewidth[plane]; -const int slice_start = (height * jobnr) / nb_jobs; -const int slice_end = (height * (jobnr+1)) / nb_jobs; -const uint16_t *src = (const uint16_t *)in->data[plane] + slice_start * stride; -uint16_t *dst = (uint16_t *)out->data[plane] + slice_start * (out->linesize[plane] / 2); -const float scale = s->scale; -const float delta = s->delta; -uint16_t *p0 = (uint1
[FFmpeg-cvslog] lavf/dashenc: pass standards compliance value to the internal context
ffmpeg | branch: master | Jan Ekström | Fri Apr 27 03:51:37 2018 +0300| [bad42e9b40920f079b27e5bd4103d9293046b2ed] | committer: Karthick Jeyapal lavf/dashenc: pass standards compliance value to the internal context Enables one to test possibly nonstandard formats such as Opus or FLAC in ISOBMFF, among other things. This becomes much more useful if output segment format becomes an option, or if the WebM segment feature gets removed. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bad42e9b40920f079b27e5bd4103d9293046b2ed --- libavformat/dashenc.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 45f7830aec..1dd633365d 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -983,10 +983,11 @@ static int dash_init(AVFormatContext *s) if (!ctx->oformat) return AVERROR_MUXER_NOT_FOUND; os->ctx = ctx; -ctx->interrupt_callback = s->interrupt_callback; -ctx->opaque = s->opaque; -ctx->io_close = s->io_close; -ctx->io_open= s->io_open; +ctx->interrupt_callback= s->interrupt_callback; +ctx->opaque= s->opaque; +ctx->io_close = s->io_close; +ctx->io_open = s->io_open; +ctx->strict_std_compliance = s->strict_std_compliance; if (!(st = avformat_new_stream(ctx, NULL))) return AVERROR(ENOMEM); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/dashenc: don't call flush_init_segment before avformat_write_header
ffmpeg | branch: master | Rodger Combs | Fri Apr 27 03:51:35 2018 +0300| [6f119dc32176e191c7fc796d4c4ca06c7be4ea71] | committer: Karthick Jeyapal lavf/dashenc: don't call flush_init_segment before avformat_write_header Fixes crash when muxing MKV-in-DASH > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6f119dc32176e191c7fc796d4c4ca06c7be4ea71 --- libavformat/dashenc.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 211ef23cb0..4f8f61b704 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -1026,13 +1026,6 @@ static int dash_init(AVFormatContext *s) av_log(s, AV_LOG_VERBOSE, "Representation %d init segment will be written to: %s\n", i, filename); -// Flush init segment -// except for mp4, since delay_moov is set and the init segment -// is then flushed after the first packets -if (strcmp(os->format_name, "mp4")) { -flush_init_segment(s, os); -} - s->streams[i]->time_base = st->time_base; // If the muxer wants to shift timestamps, request to have them shifted // already before being handed to this muxer, so we don't have mismatches @@ -1074,6 +1067,13 @@ static int dash_write_header(AVFormatContext *s) OutputStream *os = &c->streams[i]; if ((ret = avformat_write_header(os->ctx, NULL)) < 0) return ret; + +// Flush init segment +// Only for WebM segment, since for mp4 delay_moov is set and +// the init segment is thus flushed after the first packets. +if (strcmp(os->format_name, "mp4") && +(ret = flush_init_segment(s, os)) < 0) +return ret; } return ret; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/dashenc: require experimental mode to be enabled for WebM
ffmpeg | branch: master | Jan Ekström | Fri Apr 27 03:51:36 2018 +0300| [48684d26057ad830f522fc94d073a26067b49e6f] | committer: Karthick Jeyapal lavf/dashenc: require experimental mode to be enabled for WebM It has not ever been working and has not been validated, Additionally, mention that the segment file names should be changed to end with webm instead of m4s, which is utilized for ISOBMFF fragments. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=48684d26057ad830f522fc94d073a26067b49e6f --- libavformat/dashenc.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 4f8f61b704..45f7830aec 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -966,6 +966,16 @@ static int dash_init(AVFormatContext *s) s->streams[i]->codecpar->codec_id == AV_CODEC_ID_OPUS || s->streams[i]->codecpar->codec_id == AV_CODEC_ID_VORBIS) { snprintf(os->format_name, sizeof(os->format_name), "webm"); + +if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { +av_log(s, AV_LOG_ERROR, + "WebM support in dashenc is experimental and has not " + "been validated. For testing purposes, make sure " + "to add -strict experimental and override " + "-init_seg_name and -media_seg_name to end with " + "the extension 'webm'.\n"); +return AVERROR(EINVAL); +} } else { snprintf(os->format_name, sizeof(os->format_name), "mp4"); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog