[FFmpeg-cvslog] ffmpeg: fix broken indent/style in write_frame
ffmpeg | branch: master | Clément Bœsch | Fri Sep 2 11:01:46 2016 +0200| [1895e3a24fd51509532ef5f51dd09ec2953eb203] | committer: Clément Bœsch ffmpeg: fix broken indent/style in write_frame > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1895e3a24fd51509532ef5f51dd09ec2953eb203 --- ffmpeg.c | 43 +-- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 3229823..d858407 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -718,29 +718,28 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) - FFMIN3(pkt->pts, pkt->dts, ost->last_mux_dts + 1) - FFMAX3(pkt->pts, pkt->dts, ost->last_mux_dts + 1); } - if( -(avctx->codec_type == AVMEDIA_TYPE_AUDIO || avctx->codec_type == AVMEDIA_TYPE_VIDEO) && -pkt->dts != AV_NOPTS_VALUE && -!(avctx->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) && -ost->last_mux_dts != AV_NOPTS_VALUE) { - int64_t max = ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT); - if (pkt->dts < max) { -int loglevel = max - pkt->dts > 2 || avctx->codec_type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG; -av_log(s, loglevel, "Non-monotonous DTS in output stream " - "%d:%d; previous: %"PRId64", current: %"PRId64"; ", - ost->file_index, ost->st->index, ost->last_mux_dts, pkt->dts); -if (exit_on_error) { -av_log(NULL, AV_LOG_FATAL, "aborting.\n"); -exit_program(1); +if ((avctx->codec_type == AVMEDIA_TYPE_AUDIO || avctx->codec_type == AVMEDIA_TYPE_VIDEO) && +pkt->dts != AV_NOPTS_VALUE && +!(avctx->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) && +ost->last_mux_dts != AV_NOPTS_VALUE) { +int64_t max = ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT); +if (pkt->dts < max) { +int loglevel = max - pkt->dts > 2 || avctx->codec_type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG; +av_log(s, loglevel, "Non-monotonous DTS in output stream " + "%d:%d; previous: %"PRId64", current: %"PRId64"; ", + ost->file_index, ost->st->index, ost->last_mux_dts, pkt->dts); +if (exit_on_error) { +av_log(NULL, AV_LOG_FATAL, "aborting.\n"); +exit_program(1); +} +av_log(s, loglevel, "changing to %"PRId64". This may result " + "in incorrect timestamps in the output file.\n", + max); +if (pkt->pts >= pkt->dts) +pkt->pts = FFMAX(pkt->pts, max); +pkt->dts = max; +} } -av_log(s, loglevel, "changing to %"PRId64". This may result " - "in incorrect timestamps in the output file.\n", - max); -if(pkt->pts >= pkt->dts) -pkt->pts = FFMAX(pkt->pts, max); -pkt->dts = max; - } - } } ost->last_mux_dts = pkt->dts; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter: add weave filter
ffmpeg | branch: master | Paul B Mahol | Thu Apr 18 00:26:28 2013 +| [3e1356f790b178531671d1a3864da3ac1ef325fc] | committer: Paul B Mahol avfilter: add weave filter Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e1356f790b178531671d1a3864da3ac1ef325fc --- Changelog| 1 + doc/filters.texi | 21 +++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/version.h| 2 +- libavfilter/vf_weave.c | 143 +++ 6 files changed, 168 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 7dcec3c..9e1b652 100644 --- a/Changelog +++ b/Changelog @@ -24,6 +24,7 @@ version : - yuvtestsrc filter - vaguedenoiser filter - added threads option per filter instance +- weave filter version 3.1: diff --git a/doc/filters.texi b/doc/filters.texi index 88c6f65..945b9af 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -14104,6 +14104,27 @@ Set scale used for displaying graticule. Default is digital. @end table +@section weave + +The @code{weave} takes a field-based video input and join +each two sequential fields into single frame, producing a new double +height clip with half the frame rate and half the frame count. + +It accepts the following option: + +@table @option +@item first_field +Set first field. Available values are: + +@table @samp +@item top, t +Set the frame as top-field-first. + +@item bottom, b +Set the frame as bottom-field-first. +@end table +@end table + @section xbr Apply the xBR high-quality magnification filter which is designed for pixel art. It follows a set of edge-detection rules, see diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 81b40ac..8bc6b9c 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -295,6 +295,7 @@ OBJS-$(CONFIG_VIGNETTE_FILTER) += vf_vignette.o OBJS-$(CONFIG_VSTACK_FILTER) += vf_stack.o framesync.o OBJS-$(CONFIG_W3FDIF_FILTER) += vf_w3fdif.o OBJS-$(CONFIG_WAVEFORM_FILTER) += vf_waveform.o +OBJS-$(CONFIG_WEAVE_FILTER) += vf_weave.o OBJS-$(CONFIG_XBR_FILTER)+= vf_xbr.o OBJS-$(CONFIG_YADIF_FILTER) += vf_yadif.o OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index ee6f9cb..a651bb5 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -311,6 +311,7 @@ void avfilter_register_all(void) REGISTER_FILTER(VSTACK, vstack, vf); REGISTER_FILTER(W3FDIF, w3fdif, vf); REGISTER_FILTER(WAVEFORM, waveform, vf); +REGISTER_FILTER(WEAVE, weave, vf); REGISTER_FILTER(XBR,xbr,vf); REGISTER_FILTER(YADIF, yadif, vf); REGISTER_FILTER(ZMQ,zmq,vf); diff --git a/libavfilter/version.h b/libavfilter/version.h index 1b91d60..5b5f75f 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #include "libavutil/version.h" #define LIBAVFILTER_VERSION_MAJOR 6 -#define LIBAVFILTER_VERSION_MINOR 58 +#define LIBAVFILTER_VERSION_MINOR 59 #define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vf_weave.c b/libavfilter/vf_weave.c new file mode 100644 index 000..2f0784e --- /dev/null +++ b/libavfilter/vf_weave.c @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2013 Paul B Mahol + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/imgutils.h" +#include "libavutil/opt.h" +#include "libavutil/pixdesc.h" +#include "avfilter.h" +#include "internal.h" + +typedef struct WeaveContext { +const AVClass *class; +int first_field; +int nb_planes; +int planeheight[4]; +int linesize[4]; + +AVFrame *prev; +} WeaveContext; + +#define OFFSET(x) offsetof(WeaveContext, x) +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM + +static const AVOption weave_options[] = { +{ "first_field", "set first field", OFFSET(first_field), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "field"},
[FFmpeg-cvslog] avfilter/vf_minterpolate: rename chroma log vars
ffmpeg | branch: master | Davinder Singh | Tue Aug 30 06:32:09 2016 +0530| [367577dbe267e71d69f80ec3241ff8e3db0ad6c6] | committer: Paul B Mahol avfilter/vf_minterpolate: rename chroma log vars also use AVPixFmtDescriptor instead of avcodec_get_chroma_sub_sample() for log2_chroma*. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=367577dbe267e71d69f80ec3241ff8e3db0ad6c6 --- libavfilter/vf_minterpolate.c | 22 +- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c index 76a546f..4bb5853 100644 --- a/libavfilter/vf_minterpolate.c +++ b/libavfilter/vf_minterpolate.c @@ -184,10 +184,8 @@ typedef struct MIContext { double prev_mafd; double scd_threshold; -int chroma_height; -int chroma_width; -int chroma_h_shift; -int chroma_v_shift; +int log2_chroma_w; +int log2_chroma_h; int nb_planes; } MIContext; @@ -335,10 +333,8 @@ static int config_input(AVFilterLink *inlink) const int width = inlink->w; int i; -mi_ctx->chroma_height = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h); -mi_ctx->chroma_width = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w); - -avcodec_get_chroma_sub_sample(inlink->format, &mi_ctx->chroma_h_shift, &mi_ctx->chroma_v_shift); +mi_ctx->log2_chroma_h = desc->log2_chroma_h; +mi_ctx->log2_chroma_w = desc->log2_chroma_w; mi_ctx->nb_planes = av_pix_fmt_count_planes(inlink->format); @@ -936,8 +932,8 @@ static void set_frame_data(MIContext *mi_ctx, int alpha, AVFrame *avf_out) for (i = 0; i < pixel->nb; i++) { Frame *frame = &mi_ctx->frames[pixel->refs[i]]; if (chroma) { -x_mv = (x >> mi_ctx->chroma_h_shift) + (pixel->mvs[i][0] / (1 << mi_ctx->chroma_h_shift)); -y_mv = (y >> mi_ctx->chroma_v_shift) + (pixel->mvs[i][1] / (1 << mi_ctx->chroma_v_shift)); +x_mv = (x >> mi_ctx->log2_chroma_w) + pixel->mvs[i][0] / (1 << mi_ctx->log2_chroma_w); +y_mv = (y >> mi_ctx->log2_chroma_h) + pixel->mvs[i][1] / (1 << mi_ctx->log2_chroma_h); } else { x_mv = x + pixel->mvs[i][0]; y_mv = y + pixel->mvs[i][1]; @@ -949,7 +945,7 @@ static void set_frame_data(MIContext *mi_ctx, int alpha, AVFrame *avf_out) val = ROUNDED_DIV(val, weight_sum); if (chroma) -avf_out->data[plane][(x >> mi_ctx->chroma_h_shift) + (y >> mi_ctx->chroma_v_shift) * avf_out->linesize[plane]] = val; +avf_out->data[plane][(x >> mi_ctx->log2_chroma_w) + (y >> mi_ctx->log2_chroma_h) * avf_out->linesize[plane]] = val; else avf_out->data[plane][x + y * avf_out->linesize[plane]] = val; } @@ -1092,8 +1088,8 @@ static void interpolate(AVFilterLink *inlink, AVFrame *avf_out) int height = avf_out->height; if (plane == 1 || plane == 2) { -width = mi_ctx->chroma_width; -height = mi_ctx->chroma_height; +width = AV_CEIL_RSHIFT(width, mi_ctx->log2_chroma_w); +height = AV_CEIL_RSHIFT(height, mi_ctx->log2_chroma_h); } for (y = 0; y < height; y++) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/avidec: Fix infinite loop in avi_read_nikon()
ffmpeg | branch: master | Michael Niedermayer | Fri Sep 2 12:19:29 2016 +0200| [e4e4a9cad7f21593d4bcb1f2404ea0d373c36c43] | committer: Michael Niedermayer avformat/avidec: Fix infinite loop in avi_read_nikon() Fixes: 360/test.poc Found-by: 连一汉 Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e4e4a9cad7f21593d4bcb1f2404ea0d373c36c43 --- libavformat/avidec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 38ea86d..858011c 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -344,14 +344,14 @@ static void avi_metadata_creation_time(AVDictionary **metadata, char *date) static void avi_read_nikon(AVFormatContext *s, uint64_t end) { -while (avio_tell(s->pb) < end) { +while (avio_tell(s->pb) < end && !avio_feof(s->pb)) { uint32_t tag = avio_rl32(s->pb); uint32_t size = avio_rl32(s->pb); switch (tag) { case MKTAG('n', 'c', 't', 'g'): /* Nikon Tags */ { uint64_t tag_end = avio_tell(s->pb) + size; -while (avio_tell(s->pb) < tag_end) { +while (avio_tell(s->pb) < tag_end && !avio_feof(s->pb)) { uint16_t tag = avio_rl16(s->pb); uint16_t size= avio_rl16(s->pb); const char *name = NULL; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/vf_zscale: make possible to change chroma location
ffmpeg | branch: master | Paul B Mahol | Fri Sep 2 16:03:58 2016 +0200| [b5cf307d0f85aff434342e41beb33b39df8d553f] | committer: Paul B Mahol avfilter/vf_zscale: make possible to change chroma location > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b5cf307d0f85aff434342e41beb33b39df8d553f --- doc/filters.texi| 28 libavfilter/vf_zscale.c | 43 ++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index 945b9af..df6f997 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -14483,6 +14483,34 @@ Possible value are: @item 2020_ncl @item 2020_cl @end table + +@item chromal, c +Set the output chroma location. + +Possible values are: +@table @var +@item input +@item left +@item center +@item topleft +@item top +@item bottomleft +@item bottom +@end table + +@item chromalin, cin +Set the input chroma location. + +Possible values are: +@table @var +@item input +@item left +@item center +@item topleft +@item top +@item bottomleft +@item bottom +@end table @end table The values of the @option{w} and @option{h} options are expressions diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c index 5a7ffc3..bc88426 100644 --- a/libavfilter/vf_zscale.c +++ b/libavfilter/vf_zscale.c @@ -88,10 +88,12 @@ typedef struct ZScaleContext { int trc; int primaries; int range; +int chromal; int colorspace_in; int trc_in; int primaries_in; int range_in; +int chromal_in; char *size_str; char *w_expr; ///< width expression string @@ -116,6 +118,7 @@ typedef struct ZScaleContext { enum AVColorTransferCharacteristic in_trc, out_trc; enum AVColorPrimaries in_primaries, out_primaries; enum AVColorRange in_range, out_range; +enum AVChromaLocation in_chromal, out_chromal; } ZScaleContext; static av_cold int init_dict(AVFilterContext *ctx, AVDictionary **opts) @@ -316,6 +319,26 @@ static int print_zimg_error(AVFilterContext *ctx) return err_code; } +static int convert_chroma_location(enum AVChromaLocation chroma_location) +{ +switch (chroma_location) { +case AVCHROMA_LOC_UNSPECIFIED: +case AVCHROMA_LOC_LEFT: +return ZIMG_CHROMA_LEFT; +case AVCHROMA_LOC_CENTER: +return ZIMG_CHROMA_CENTER; +case AVCHROMA_LOC_TOPLEFT: +return ZIMG_CHROMA_TOP_LEFT; +case AVCHROMA_LOC_TOP: +return ZIMG_CHROMA_TOP; +case AVCHROMA_LOC_BOTTOMLEFT: +return ZIMG_CHROMA_BOTTOM_LEFT; +case AVCHROMA_LOC_BOTTOM: +return ZIMG_CHROMA_BOTTOM; +} +return ZIMG_CHROMA_LEFT; +} + static int convert_matrix(enum AVColorSpace colorspace) { switch (colorspace) { @@ -420,7 +443,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) || s->out_colorspace != out->colorspace || s->out_trc != out->color_trc || s->out_primaries != out->color_primaries - || s->out_range != out->color_range) { + || s->out_range != out->color_range + || s->in_chromal != in->chroma_location + || s->out_chromal != out->chroma_location) { snprintf(buf, sizeof(buf)-1, "%d", outlink->w); av_opt_set(s, "w", buf, 0); snprintf(buf, sizeof(buf)-1, "%d", outlink->h); @@ -456,6 +481,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) s->src_format.transfer_characteristics = s->trc_in == - 1 ? convert_trc(in->color_trc) : s->trc_in; s->src_format.color_primaries = s->primaries_in == -1 ? convert_primaries(in->color_primaries) : s->primaries_in; s->src_format.pixel_range = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? ZIMG_RANGE_FULL : s->range_in == -1 ? convert_range(in->color_range) : s->range_in; +s->src_format.chroma_location = s->chromal_in == -1 ? convert_chroma_location(in->chroma_location) : s->chromal_in; s->dst_format.width = out->width; s->dst_format.height = out->height; @@ -468,6 +494,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) s->dst_format.transfer_characteristics = s->trc == -1 ? convert_trc(out->color_trc) : s->trc; s->dst_format.color_primaries = s->primaries == -1 ? convert_primaries(out->color_primaries) : s->primaries; s->dst_format.pixel_range = (odesc->flags & AV_PIX_FMT_FLAG_RGB) ? ZIMG_RANGE_FULL : s->range == -1 ? convert_range(out->color_range) : s->range; +s->dst_format.chroma_location = s->chromal == -1 ? convert_chroma_location(out->chroma_location) : s->chromal; if (s->colorspace != -1) out->colorspace = (int)s->dst_format.matrix_coefficients; @@ -481,6 +508,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) if (s->trc != -1) out->color_trc = (int)s->dst_format.transfer_characteristics; +if (s->chromal != -1) +out->chroma_location = (int)s->dst_format.chroma_locatio
[FFmpeg-cvslog] swscale/tests/swscale: add cpuflags option
ffmpeg | branch: master | Michael Niedermayer | Fri Sep 2 14:55:27 2016 +0200| [7a6c288c2b5b1653d3a70f8d5511b31cf5156894] | committer: Michael Niedermayer swscale/tests/swscale: add cpuflags option Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7a6c288c2b5b1653d3a70f8d5511b31cf5156894 --- libswscale/tests/swscale.c | 9 + 1 file changed, 9 insertions(+) diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c index 58c2114..da6a41b 100644 --- a/libswscale/tests/swscale.c +++ b/libswscale/tests/swscale.c @@ -25,6 +25,7 @@ #include #undef HAVE_AV_CONFIG_H +#include "libavutil/cpu.h" #include "libavutil/imgutils.h" #include "libavutil/mem.h" #include "libavutil/avutil.h" @@ -382,6 +383,14 @@ int main(int argc, char **argv) fprintf(stderr, "could not open '%s'\n", argv[i + 1]); goto error; } +} else if (!strcmp(argv[i], "-cpuflags")) { +unsigned flags = av_get_cpu_flags(); +int ret = av_parse_cpu_caps(&flags, argv[i + 1]); +if (ret < 0) { +fprintf(stderr, "invalid cpu flags %s\n", argv[i + 1]); +return ret; +} +av_force_cpu_flags(flags); } else if (!strcmp(argv[i], "-src")) { srcFormat = av_get_pix_fmt(argv[i + 1]); if (srcFormat == AV_PIX_FMT_NONE) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] doc/filters: add weave example
ffmpeg | branch: master | Paul B Mahol | Fri Sep 2 18:30:07 2016 +0200| [5dcd913ab51f8ec96e01ef4cc651727b96dd6780] | committer: Paul B Mahol doc/filters: add weave example Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5dcd913ab51f8ec96e01ef4cc651727b96dd6780 --- doc/filters.texi | 12 1 file changed, 12 insertions(+) diff --git a/doc/filters.texi b/doc/filters.texi index df6f997..c12b093 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -11824,6 +11824,7 @@ selectivecolor=psfile=MySelectiveColorPresets/Misty.asv @end example @end itemize +@anchor{separatefields} @section separatefields The @code{separatefields} takes a frame-based video input and splits @@ -14125,6 +14126,16 @@ Set the frame as bottom-field-first. @end table @end table +@subsection Examples + +@itemize +@item +Interlace video using @code{select} and @code{separatefields} filter: +@example +separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave +@end example +@end itemize + @section xbr Apply the xBR high-quality magnification filter which is designed for pixel art. It follows a set of edge-detection rules, see @@ -16009,6 +16020,7 @@ Time limit for the pauses. Any pause longer than that will be considered a timestamp discontinuity and reset the timer. Default is 2 seconds. @end table +@anchor{select} @section select, aselect Select frames to pass in output. ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/swscale: Factor bottom to top handling
ffmpeg | branch: master | Michael Niedermayer | Fri Sep 2 16:35:36 2016 +0200| [f580719b1a24a311ef9e38efce214fd77373dbc2] | committer: Michael Niedermayer swscale/swscale: Factor bottom to top handling Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f580719b1a24a311ef9e38efce214fd77373dbc2 --- libswscale/swscale.c | 51 +++ 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index bbea0fe..63d16bd 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -761,6 +761,12 @@ int attribute_align_arg sws_scale(struct SwsContext *c, uint8_t *dst2[4]; uint8_t *rgb0_tmp = NULL; int macro_height = isBayer(c->srcFormat) ? 2 : (1 << c->chrSrcVSubSample); +// copy strides, so they can safely be modified +int srcStride2[4] = { srcStride[0], srcStride[1], srcStride[2], +srcStride[3] }; +int dstStride2[4] = { dstStride[0], dstStride[1], dstStride[2], +dstStride[3] }; +int srcSliceY_internal = srcSliceY; if (!srcStride || !dstStride || !dst || !srcSlice) { av_log(c, AV_LOG_ERROR, "One of the input parameters to sws_scale() is NULL, please check the calling code\n"); @@ -943,30 +949,12 @@ int attribute_align_arg sws_scale(struct SwsContext *c, for (i = 0; i < 4; i++) memset(c->dither_error[i], 0, sizeof(c->dither_error[0][0]) * (c->dstW+2)); - -// copy strides, so they can safely be modified -if (c->sliceDir == 1) { -// slices go from top to bottom -int srcStride2[4] = { srcStride[0], srcStride[1], srcStride[2], - srcStride[3] }; -int dstStride2[4] = { dstStride[0], dstStride[1], dstStride[2], - dstStride[3] }; - -reset_ptr(src2, c->srcFormat); -reset_ptr((void*)dst2, c->dstFormat); - -/* reset slice direction at end of frame */ -if (srcSliceY + srcSliceH == c->srcH) -c->sliceDir = 0; - -ret = c->swscale(c, src2, srcStride2, srcSliceY, srcSliceH, dst2, - dstStride2); -} else { +if (c->sliceDir != 1) { // slices go from bottom to top => we flip the image internally -int srcStride2[4] = { -srcStride[0], -srcStride[1], -srcStride[2], - -srcStride[3] }; -int dstStride2[4] = { -dstStride[0], -dstStride[1], -dstStride[2], - -dstStride[3] }; +for (i=0; i<4; i++) { +srcStride2[i] *= -1; +dstStride2[i] *= -1; +} src2[0] += (srcSliceH - 1) * srcStride[0]; if (!usePal(c->srcFormat)) @@ -978,16 +966,15 @@ int attribute_align_arg sws_scale(struct SwsContext *c, dst2[2] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[2]; dst2[3] += ( c->dstH - 1) * dstStride[3]; -reset_ptr(src2, c->srcFormat); -reset_ptr((void*)dst2, c->dstFormat); - -/* reset slice direction at end of frame */ -if (!srcSliceY) -c->sliceDir = 0; - -ret = c->swscale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH, - srcSliceH, dst2, dstStride2); +srcSliceY_internal = c->srcH-srcSliceY-srcSliceH; } +reset_ptr(src2, c->srcFormat); +reset_ptr((void*)dst2, c->dstFormat); + +/* reset slice direction at end of frame */ +if (srcSliceY_internal + srcSliceH == c->srcH) +c->sliceDir = 0; +ret = c->swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH, dst2, dstStride2); if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/swscale_unscaled: Fix packed_16bpc_bswap() with slices
ffmpeg | branch: master | Michael Niedermayer | Fri Sep 2 20:25:24 2016 +0200| [47bc1bdafb0950ccf128eaa491d8fd7cc0978813] | committer: Michael Niedermayer swscale/swscale_unscaled: Fix packed_16bpc_bswap() with slices Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=47bc1bdafb0950ccf128eaa491d8fd7cc0978813 --- libswscale/swscale_unscaled.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index b231abe..8df0694 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -352,6 +352,7 @@ static int packed_16bpc_bswap(SwsContext *c, const uint8_t *src[], int min_stride = FFMIN(FFABS(srcstr), FFABS(dststr)); if(!dstPtr || !srcPtr) continue; +dstPtr += (srcSliceY >> c->chrDstVSubSample) * dststr; for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) { for (j = 0; j < min_stride; j++) { dstPtr[j] = av_bswap16(srcPtr[j]); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/swscale: Try to fix rgb48Toxyz12() with slices
ffmpeg | branch: master | Michael Niedermayer | Fri Sep 2 16:52:55 2016 +0200| [89ec11e096131bf0b74e04e3c19ec2007600fa94] | committer: Michael Niedermayer swscale/swscale: Try to fix rgb48Toxyz12() with slices Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=89ec11e096131bf0b74e04e3c19ec2007600fa94 --- libswscale/swscale.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 63d16bd..a192a1f 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -978,8 +978,14 @@ int attribute_align_arg sws_scale(struct SwsContext *c, if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) { +int dstY = c->dstY ? c->dstY : srcSliceY + srcSliceH; +av_assert0(dstY >= ret); +av_assert0(ret >= 0); +av_assert0(c->dstH >= dstY); + +uint16_t *dst16 = (uint16_t*)(dst2[0] + (dstY - ret) * dstStride2[0]); /* replace on the same data */ -rgb48Toxyz12(c, (uint16_t*)dst2[0], (const uint16_t*)dst2[0], dstStride[0]/2, ret); +rgb48Toxyz12(c, dst16, dst16, dstStride2[0]/2, ret); } av_free(rgb0_tmp); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale: add unscaled copy from yuv420p10 to p010
ffmpeg | branch: master | Timo Rothenpieler | Thu Sep 1 16:54:01 2016 +0200| [39f75645c801974bd6e325688f72d4626610f356] | committer: Timo Rothenpieler swscale: add unscaled copy from yuv420p10 to p010 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=39f75645c801974bd6e325688f72d4626610f356 --- libswscale/swscale_unscaled.c | 44 +++ 1 file changed, 44 insertions(+) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 8df0694..ca7374a 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -197,6 +197,45 @@ static int nv12ToPlanarWrapper(SwsContext *c, const uint8_t *src[], return srcSliceH; } +static int planarToP010Wrapper(SwsContext *c, const uint8_t *src8[], + int srcStride[], int srcSliceY, + int srcSliceH, uint8_t *dstParam8[], + int dstStride[]) +{ +const uint16_t **src = (const uint16_t**)src8; +uint16_t *dstY = (uint16_t*)(dstParam8[0] + dstStride[0] * srcSliceY); +uint16_t *dstUV = (uint16_t*)(dstParam8[1] + dstStride[1] * srcSliceY / 2); +int x, y; + +av_assert0(!(srcStride[0] % 2 || srcStride[1] % 2 || srcStride[2] % 2 || + dstStride[0] % 2 || dstStride[1] % 2)); + +for (y = 0; y < srcSliceH; y++) { +uint16_t *tdstY = dstY; +const uint16_t *tsrc0 = src[0]; +for (x = c->srcW; x > 0; x--) { +*tdstY++ = *tsrc0++ << 6; +} +src[0] += srcStride[0] / 2; +dstY += dstStride[0] / 2; + +if (!(y & 1)) { +uint16_t *tdstUV = dstUV; +const uint16_t *tsrc1 = src[1]; +const uint16_t *tsrc2 = src[2]; +for (x = c->srcW / 2; x > 0; x--) { +*tdstUV++ = *tsrc1++ << 6; +*tdstUV++ = *tsrc2++ << 6; +} +src[1] += srcStride[1] / 2; +src[2] += srcStride[2] / 2; +dstUV += dstStride[1] / 2; +} +} + +return srcSliceH; +} + static int planarToYuy2Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) @@ -1601,6 +1640,11 @@ void ff_get_unscaled_swscale(SwsContext *c) !(flags & SWS_ACCURATE_RND) && (c->dither == SWS_DITHER_BAYER || c->dither == SWS_DITHER_AUTO) && !(dstH & 1)) { c->swscale = ff_yuv2rgb_get_func_ptr(c); } +/* yuv420p10_to_p010 */ +if ((srcFormat == AV_PIX_FMT_YUV420P10 || srcFormat == AV_PIX_FMT_YUVA420P10) && +dstFormat == AV_PIX_FMT_P010) { +c->swscale = planarToP010Wrapper; +} if (srcFormat == AV_PIX_FMT_YUV410P && !(dstH & 3) && (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) && ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] configure: check for dlsym as well
ffmpeg | branch: master | Timo Rothenpieler | Thu Sep 1 11:18:00 2016 +0200| [1c37be6e95ba2b6050502839eb73ca5b3809b71c] | committer: Timo Rothenpieler configure: check for dlsym as well For some reason, when compiling with gcc-asan and a recent enough gcc version(seen on 5.3+ so far), linking dlopen works without -ldl, but dlsym fails with: undefined reference to symbol 'dlsym@@GLIBC_2.2.5' So this patchs checks for both dlopen and dlsym to work for determining if -ldl is needed. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1c37be6e95ba2b6050502839eb73ca5b3809b71c --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 4bed6f2..ce69936 100755 --- a/configure +++ b/configure @@ -5379,9 +5379,9 @@ check_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_ check_ldflags -Wl,--as-needed check_ldflags -Wl,-z,noexecstack -if check_func dlopen; then +if check_func dlopen && check_func dlsym; then ldl= -elif check_func dlopen -ldl; then +elif check_func dlopen -ldl && check_func dlsym -ldl; then ldl=-ldl fi ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog