[FFmpeg-devel] [PATCH] lavfi: add tblend filter
On date Wednesday 2014-12-10 19:03:10 +0100, Clément Bœsch encoded: Oups, sorry about the delay, I forgot that one. On Thu, Dec 04, 2014 at 12:36:43PM +0100, Stefano Sabatini wrote: [...] From c805460ceb04ec2da3f607e69067f4cc710c0613 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini stefa...@gmail.com Date: Thu, 4 Dec 2014 12:27:53 +0100 Subject: [PATCH] lavfi: add tblend filter --- libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_blend.c | 73 +++- 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/libavfilter/Makefile b/libavfilter/Makefile index d41a52e..d1be7e3 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -187,6 +187,7 @@ OBJS-$(CONFIG_STEREO3D_FILTER) += vf_stereo3d.o OBJS-$(CONFIG_SUBTITLES_FILTER) += vf_subtitles.o OBJS-$(CONFIG_SUPER2XSAI_FILTER) += vf_super2xsai.o OBJS-$(CONFIG_SWAPUV_FILTER) += vf_swapuv.o +OBJS-$(CONFIG_TBLEND_FILTER) += vf_blend.o OBJS-$(CONFIG_TDIFF_FILTER) += vf_tdiff.o OBJS-$(CONFIG_TELECINE_FILTER) += vf_telecine.o OBJS-$(CONFIG_THUMBNAIL_FILTER) += vf_thumbnail.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index f13f82d..e8914cc 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -202,6 +202,7 @@ void avfilter_register_all(void) REGISTER_FILTER(SUBTITLES, subtitles, vf); REGISTER_FILTER(SUPER2XSAI, super2xsai, vf); REGISTER_FILTER(SWAPUV, swapuv, vf); +REGISTER_FILTER(TBLEND, tblend, vf); REGISTER_FILTER(TDIFF, tdiff, vf); REGISTER_FILTER(TELECINE, telecine, vf); REGISTER_FILTER(THUMBNAIL, thumbnail, vf); diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c index 8bf19ff..3c1572c 100644 --- a/libavfilter/vf_blend.c +++ b/libavfilter/vf_blend.c @@ -95,6 +95,8 @@ typedef struct { double all_opacity; FilterParams params[4]; +int tblend; +AVFrame *prev_frame;/* only used with tblend */ } BlendContext; #define OFFSET(x) offsetof(BlendContext, x) @@ -285,7 +287,8 @@ static AVFrame *blend_frame(AVFilterContext *ctx, AVFrame *top_buf, ctx-internal-execute(ctx, filter_slice, td, NULL, FFMIN(outh, ctx-graph-nb_threads)); } -av_frame_free(top_buf); +if (!b-tblend) +av_frame_free(top_buf); return dst_buf; } @@ -295,6 +298,8 @@ static av_cold int init(AVFilterContext *ctx) BlendContext *b = ctx-priv; int ret, plane; +b-tblend = !strcmp(ctx-filter-name, tblend); + for (plane = 0; plane FF_ARRAY_ELEMS(b-params); plane++) { FilterParams *param = b-params[plane]; @@ -412,6 +417,8 @@ static av_cold void uninit(AVFilterContext *ctx) int i; ff_dualinput_uninit(b-dinput); +av_freep(b-prev_frame); + for (i = 0; i FF_ARRAY_ELEMS(b-params); i++) av_expr_free(b-params[i].e); } @@ -463,3 +470,67 @@ AVFilter ff_vf_blend = { .priv_class= blend_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; + +static int tblend_config_output(AVFilterLink *outlink) +{ +AVFilterContext *ctx = outlink-src; +AVFilterLink *inlink = ctx-inputs[0]; +BlendContext *b = ctx-priv; +const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink-format); + +b-hsub = pix_desc-log2_chroma_w; +b-vsub = pix_desc-log2_chroma_h; +b-nb_planes = av_pix_fmt_count_planes(inlink-format); +outlink-flags |= FF_LINK_FLAG_REQUEST_LOOP; Do you need that? (it's single input) From internal.h: /** * Frame requests may need to loop in order to be fulfilled. * A filter must set this flags on an output link if it may return 0 in * request_frame() without filtering a frame. */ FF_LINK_FLAG_REQUEST_LOOP = 1, I need to set this, since the filter caches the first frame, and will output only when the second frame arrives. Indeed if I comment the line I get: Assertion !link-frame_requested || link-flags FF_LINK_FLAG_REQUEST_LOOP failed at libavfilter/avfilter.c:368 + +return 0; +} + +static int tblend_filter_frame(AVFilterLink *inlink, AVFrame *frame) +{ +BlendContext *b = inlink-dst-priv; +AVFilterLink *outlink = inlink-dst-outputs[0]; + +if (b-prev_frame) { +AVFrame *out = blend_frame(inlink-dst, frame, b-prev_frame); +av_frame_free(b-prev_frame); +b-prev_frame = frame; +return ff_filter_frame(outlink, out); +} +b-prev_frame = frame; +return 0; +} + +#define tblend_options blend_options
Re: [FFmpeg-devel] [PATCH] lavfi: add tdiff filter
On date Thursday 2014-12-11 10:18:51 +, Paul B Mahol encoded: On 12/10/14, Clement Boesch u...@pkh.me wrote: Oups, sorry about the delay, I forgot that one. On Thu, Dec 04, 2014 at 12:36:43PM +0100, Stefano Sabatini wrote: [...] From 65455601f502dd148bcd140f8d70eef104b1bdbe Mon Sep 17 00:00:00 2001 From: Stefano Sabatini stefa...@gmail.com Date: Thu, 4 Dec 2014 12:34:30 +0100 Subject: [PATCH] lavfi/blend: add difference128 mode --- libavfilter/vf_blend.c | 4 1 file changed, 4 insertions(+) diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c index 3c1572c..e73ea35 100644 --- a/libavfilter/vf_blend.c +++ b/libavfilter/vf_blend.c @@ -41,6 +41,7 @@ enum BlendMode { BLEND_BURN, BLEND_DARKEN, BLEND_DIFFERENCE, +BLEND_DIFFERENCE128, BLEND_DIVIDE, BLEND_DODGE, BLEND_EXCLUSION, @@ -114,6 +115,7 @@ static const AVOption blend_options[] = { { burn, , 0, AV_OPT_TYPE_CONST, {.i64=BLEND_BURN}, 0, 0, FLAGS, mode }, { darken, , 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DARKEN}, 0, 0, FLAGS, mode }, { difference, , 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIFFERENCE}, 0, 0, FLAGS, mode }, +{ difference128, , 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIFFERENCE128}, 0, 0, FLAGS, mode }, { divide, , 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIVIDE}, 0, 0, FLAGS, mode }, { dodge, , 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DODGE}, 0, 0, FLAGS, mode }, { exclusion, , 0, AV_OPT_TYPE_CONST, {.i64=BLEND_EXCLUSION}, 0, 0, FLAGS, mode }, @@ -192,6 +194,7 @@ DEFINE_BLEND(subtract, FFMAX(0, A - B)) DEFINE_BLEND(multiply, MULTIPLY(1, A, B)) DEFINE_BLEND(negation, 255 - FFABS(255 - A - B)) DEFINE_BLEND(difference, FFABS(A - B)) +DEFINE_BLEND(difference128, av_clip_uint8(128 + A - B)) DEFINE_BLEND(screen, SCREEN(1, A, B)) DEFINE_BLEND(overlay,(A 128) ? MULTIPLY(2, A, B) : SCREEN(2, A, B)) DEFINE_BLEND(hardlight, (B 128) ? MULTIPLY(2, B, A) : SCREEN(2, B, A)) @@ -315,6 +318,7 @@ static av_cold int init(AVFilterContext *ctx) case BLEND_BURN: param-blend = blend_burn; break; case BLEND_DARKEN: param-blend = blend_darken; break; case BLEND_DIFFERENCE: param-blend = blend_difference; break; +case BLEND_DIFFERENCE128: param-blend = blend_difference128; break; case BLEND_DIVIDE: param-blend = blend_divide; break; case BLEND_DODGE: param-blend = blend_dodge; break; case BLEND_EXCLUSION: param-blend = blend_exclusion; break; I'm not a maintainer of blend but it looks OK (assuming previous comments are honored). The new difference mode is useful, thanks. Applied, thanks. -- FFmpeg = Fantastic and Fast Mortal Perennial Explosive Gangster ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] x86/vf_fspp: port inline asm to yasm
On Fri, Dec 26, 2014 at 01:58:11AM -0300, James Almer wrote: Signed-off-by: James Almer jamr...@gmail.com --- Checksum of output is the same as far as i could test, but as mentioned in the other thread it's still different than the output of the C versions. libavfilter/vf_fspp.c | 12 +- libavfilter/vf_fspp.h |6 +- libavfilter/x86/Makefile |3 +- libavfilter/x86/vf_fspp.asm | 727 + libavfilter/x86/{vf_fspp.c = vf_fspp_init.c} | 1396 + 5 files changed, 756 insertions(+), 1388 deletions(-) create mode 100644 libavfilter/x86/vf_fspp.asm rename libavfilter/x86/{vf_fspp.c = vf_fspp_init.c} (1%) breaks build with shared libs /usr/bin/ld: libavfilter/x86/vf_fspp.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC libavfilter/x86/vf_fspp.o: could not read symbols: Bad value clang: error: linker command failed with exit code 1 (use -v to see invocation [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Parallelization of FFmpeg
Dtison.net systemadmin at dtison.net writes: If anything comes to mind - someone make a suggestion and I'll take a look at it. The vc1 decoder could need frame parallelization. That being said, what normally happens is that you decide on which part of FFmpeg you would like to work on and start sending patches. In theory, this can lead to duplicated work but in reality this does not happen very often afaict. (And I suspect parallelization of vc1 is not an easy task.) Thank you for any contribution! Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_boxblur: generate supported pixfmt list instead of hardcoding
On Sun, Dec 21, 2014 at 06:27:26PM +0100, Michael Niedermayer wrote: This adds support for several more 8bit planar formats Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavfilter/vf_boxblur.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) applied [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] swscale: Pass through chroma positions in sws_getCachedContext
--- libswscale/utils.c | 13 + 1 file changed, 13 insertions(+) diff --git a/libswscale/utils.c b/libswscale/utils.c index ab494ed..601e7bf 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1960,6 +1960,8 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW, { static const double default_param[2] = { SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT }; +int64_t src_h_chr_pos = -513, dst_h_chr_pos = -513, +src_v_chr_pos = -513, dst_v_chr_pos = -513; if (!param) param = default_param; @@ -1974,6 +1976,11 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW, context-flags != flags || context-param[0] != param[0] || context-param[1] != param[1])) { + +av_opt_get_int(context, src_h_chr_pos, 0, src_h_chr_pos); +av_opt_get_int(context, src_v_chr_pos, 0, src_v_chr_pos); +av_opt_get_int(context, dst_h_chr_pos, 0, dst_h_chr_pos); +av_opt_get_int(context, dst_v_chr_pos, 0, dst_v_chr_pos); sws_freeContext(context); context = NULL; } @@ -1990,6 +1997,12 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW, context-flags = flags; context-param[0] = param[0]; context-param[1] = param[1]; + +av_opt_set_int(context, src_h_chr_pos, src_h_chr_pos, 0); +av_opt_set_int(context, src_v_chr_pos, src_v_chr_pos, 0); +av_opt_set_int(context, dst_h_chr_pos, dst_h_chr_pos, 0); +av_opt_set_int(context, dst_v_chr_pos, dst_v_chr_pos, 0); + if (sws_init_context(context, srcFilter, dstFilter) 0) { sws_freeContext(context); return NULL; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] swscale: Pass through chroma positions in sws_getCachedContext
On Fri, Dec 26, 2014 at 02:46:02PM +, Kieran Kunhya wrote: --- libswscale/utils.c | 13 + 1 file changed, 13 insertions(+) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Freedom in capitalist society always remains about the same as it was in ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] x86/vf_fspp: port inline asm to yasm
Signed-off-by: James Almer jamr...@gmail.com --- libavfilter/vf_fspp.c | 12 +- libavfilter/vf_fspp.h |6 +- libavfilter/x86/Makefile |3 +- libavfilter/x86/vf_fspp.asm | 727 + libavfilter/x86/{vf_fspp.c = vf_fspp_init.c} | 1396 + 5 files changed, 756 insertions(+), 1388 deletions(-) create mode 100644 libavfilter/x86/vf_fspp.asm rename libavfilter/x86/{vf_fspp.c = vf_fspp_init.c} (1%) diff --git a/libavfilter/vf_fspp.c b/libavfilter/vf_fspp.c index 4a1b7e0..c36a666 100644 --- a/libavfilter/vf_fspp.c +++ b/libavfilter/vf_fspp.c @@ -151,11 +151,11 @@ static void store_slice2_c(uint8_t *dst, int16_t *src, } } -static void mul_thrmat_c(FSPPContext *p, int q) +static void mul_thrmat_c(int16_t *thr_adr_noq, int16_t *thr_adr, int q) { int a; for (a = 0; a 64; a++) -((int16_t *)p-threshold_mtx)[a] = q * ((int16_t *)p-threshold_mtx_noq)[a];//ints faster in C +thr_adr[a] = q * thr_adr_noq[a]; } static void filter(FSPPContext *p, uint8_t *dst, uint8_t *src, @@ -220,7 +220,7 @@ static void filter(FSPPContext *p, uint8_t *dst, uint8_t *src, t = qp_store[qy + (t qpsh)]; t = norm_qscale(t, p-qscale_type); -if (t != p-prev_q) p-prev_q = t, p-mul_thrmat(p, t); +if (t != p-prev_q) p-prev_q = t, p-mul_thrmat((int16_t *)(p-threshold_mtx_noq[0]), (int16_t *)(p-threshold_mtx[0]), t); p-column_fidct((int16_t *)(p-threshold_mtx[0]), block + x * 8, block3 + x * 8, 8); //yes, this is a HOTSPOT } p-row_idct(block3 + 0 * 8, p-temp + (y 15) * stride + x0 + 2 - (y 1), stride, 2 * (BLOCKSZ - 1)); @@ -378,7 +378,7 @@ static void column_fidct_c(int16_t *thr_adr, int16_t *data, int16_t *output, int } } -static void row_idct_c(int16_t *workspace, int16_t *output_adr, int output_stride, int cnt) +static void row_idct_c(int16_t *workspace, int16_t *output_adr, ptrdiff_t output_stride, int cnt) { int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int_simd16_t tmp10, tmp11, tmp12, tmp13; @@ -440,7 +440,7 @@ static void row_idct_c(int16_t *workspace, int16_t *output_adr, int output_strid } } -static void row_fdct_c(int16_t *data, const uint8_t *pixels, int line_size, int cnt) +static void row_fdct_c(int16_t *data, const uint8_t *pixels, ptrdiff_t line_size, int cnt) { int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int_simd16_t tmp10, tmp11, tmp12, tmp13; @@ -582,7 +582,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } if (fspp-qp) -fspp-prev_q = fspp-qp, fspp-mul_thrmat(fspp, fspp-qp); +fspp-prev_q = fspp-qp, fspp-mul_thrmat((int16_t *)(fspp-threshold_mtx_noq[0]), (int16_t *)(fspp-threshold_mtx[0]), fspp-qp); /* if we are not in a constant user quantizer mode and we don't want to use * the quantizers from the B-frames (B-frames often have a higher QP), we diff --git a/libavfilter/vf_fspp.h b/libavfilter/vf_fspp.h index db860c6..237ffb1 100644 --- a/libavfilter/vf_fspp.h +++ b/libavfilter/vf_fspp.h @@ -79,16 +79,16 @@ typedef struct FSPPContext { ptrdiff_t dst_stride, ptrdiff_t src_stride, ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale); -void (*mul_thrmat)(struct FSPPContext *fspp, int q); +void (*mul_thrmat)(int16_t *thr_adr_noq, int16_t *thr_adr, int q); void (*column_fidct)(int16_t *thr_adr, int16_t *data, int16_t *output, int cnt); void (*row_idct)(int16_t *workspace, int16_t *output_adr, - int output_stride, int cnt); + ptrdiff_t output_stride, int cnt); void (*row_fdct)(int16_t *data, const uint8_t *pixels, - int line_size, int cnt); + ptrdiff_t line_size, int cnt); } FSPPContext; diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile index 4f9c83d..d9265c9 100644 --- a/libavfilter/x86/Makefile +++ b/libavfilter/x86/Makefile @@ -1,4 +1,4 @@ -OBJS-$(CONFIG_FSPP_FILTER) += x86/vf_fspp.o +OBJS-$(CONFIG_FSPP_FILTER) += x86/vf_fspp_init.o OBJS-$(CONFIG_GRADFUN_FILTER)+= x86/vf_gradfun_init.o OBJS-$(CONFIG_HQDN3D_FILTER) += x86/vf_hqdn3d_init.o OBJS-$(CONFIG_IDET_FILTER) += x86/vf_idet_init.o @@ -10,6 +10,7 @@ OBJS-$(CONFIG_TINTERLACE_FILTER) += x86/vf_tinterlace_init.o OBJS-$(CONFIG_VOLUME_FILTER) += x86/af_volume_init.o OBJS-$(CONFIG_YADIF_FILTER) += x86/vf_yadif_init.o +YASM-OBJS-$(CONFIG_FSPP_FILTER) += x86/vf_fspp.o YASM-OBJS-$(CONFIG_GRADFUN_FILTER) += x86/vf_gradfun.o YASM-OBJS-$(CONFIG_HQDN3D_FILTER)+=
Re: [FFmpeg-devel] [PATCH] x86/vf_fspp: port inline asm to yasm
On Fri, Dec 26, 2014 at 02:15:32PM -0300, James Almer wrote: Signed-off-by: James Almer jamr...@gmail.com --- libavfilter/vf_fspp.c | 12 +- libavfilter/vf_fspp.h |6 +- libavfilter/x86/Makefile |3 +- libavfilter/x86/vf_fspp.asm | 727 + libavfilter/x86/{vf_fspp.c = vf_fspp_init.c} | 1396 + 5 files changed, 756 insertions(+), 1388 deletions(-) create mode 100644 libavfilter/x86/vf_fspp.asm rename libavfilter/x86/{vf_fspp.c = vf_fspp_init.c} (1%) seems building find and seems producing the same output should be ok [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Freedom in capitalist society always remains about the same as it was in ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] x86/vf_fspp: port inline asm to yasm
On 26/12/14 3:09 PM, Michael Niedermayer wrote: On Fri, Dec 26, 2014 at 02:15:32PM -0300, James Almer wrote: Signed-off-by: James Almer jamr...@gmail.com --- libavfilter/vf_fspp.c | 12 +- libavfilter/vf_fspp.h |6 +- libavfilter/x86/Makefile |3 +- libavfilter/x86/vf_fspp.asm | 727 + libavfilter/x86/{vf_fspp.c = vf_fspp_init.c} | 1396 + 5 files changed, 756 insertions(+), 1388 deletions(-) create mode 100644 libavfilter/x86/vf_fspp.asm rename libavfilter/x86/{vf_fspp.c = vf_fspp_init.c} (1%) seems building find and seems producing the same output should be ok Pushed, thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] x86/vf_fspp: port inline asm to yasm
On 26/12/14 5:31 AM, Christophe Gisquet wrote: Is m7 overwritten anywhere in those slice functions? It's not. I made a couple changes to these two functions compared to the inline asm version (all the setup before the loops), but didn't bother checking the simd much while porting it so i didn't notice that. I'll change it. Thanks, and sorry for missing your comment before i pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH]Do not store more than 30 bit for r10k
Hi! Attached patch makes the output of r10k more predictable. Please comment, Carl Eugendiff --git a/libavcodec/r210enc.c b/libavcodec/r210enc.c index d61cd75..4cbebd7 100644 --- a/libavcodec/r210enc.c +++ b/libavcodec/r210enc.c @@ -62,7 +62,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (avctx-codec_id == AV_CODEC_ID_R210) pixel = (r 20) | (g 10) | b 2; else -pixel = (r 22) | (g 12) | b; +pixel = (r 22) | (g 12) | b 0xFFFC; if (avctx-codec_id == AV_CODEC_ID_AVRP) bytestream_put_le32(dst, pixel); else ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Do not store more than 30 bit for r10k
On Sat, Dec 27, 2014 at 12:41:12AM +0100, Carl-Eugen Hoyos wrote: Hi! Attached patch makes the output of r10k more predictable. Please comment, Carl Eugen this is probably ok [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avfilter/vf_cropdetect: Factorize duplicated code using a macro
This simplifies subsequent changes Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavfilter/vf_cropdetect.c | 34 ++ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index 76aa7b2..fd2286d 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -136,33 +136,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) s-frame_nb = 1; } -for (y = 0; y s-y1; y++) { -if (checkline(ctx, frame-data[0] + frame-linesize[0] * y, bpp, frame-width, bpp) s-limit) { -s-y1 = y; -break; -} +#define CHECK(DST, FROM, NOEND, INC, STEP0, STEP1, LEN) \ +for (y = FROM; NOEND; INC) {\ +if (checkline(ctx, frame-data[0] + STEP0 * y, STEP1, LEN, bpp) s-limit) {\ +DST = y;\ +break;\ +}\ } -for (y = frame-height - 1; y FFMAX(s-y2, s-y1); y--) { -if (checkline(ctx, frame-data[0] + frame-linesize[0] * y, bpp, frame-width, bpp) s-limit) { -s-y2 = y; -break; -} -} - -for (y = 0; y s-x1; y++) { -if (checkline(ctx, frame-data[0] + bpp*y, frame-linesize[0], frame-height, bpp) s-limit) { -s-x1 = y; -break; -} -} +CHECK(s-y1, 0, y s-y1, y++, frame-linesize[0], bpp, frame-width); +CHECK(s-y2, frame-height - 1, y FFMAX(s-y2, s-y1), y--, frame-linesize[0], bpp, frame-width); +CHECK(s-x1, 0, y s-x1, y++, bpp, frame-linesize[0], frame-height); +CHECK(s-x2, frame-width - 1, y FFMAX(s-x2, s-x1), y--, bpp, frame-linesize[0], frame-height); -for (y = frame-width - 1; y FFMAX(s-x2, s-x1); y--) { -if (checkline(ctx, frame-data[0] + bpp*y, frame-linesize[0], frame-height, bpp) s-limit) { -s-x2 = y; -break; -} -} // round x and y (up), important for yuv colorspaces // make sure they stay rounded! -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avfilter/vf_cropdetect: add max_outliers parameter
Fixes Ticket3030 Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavfilter/vf_cropdetect.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index fd2286d..8d45491 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -40,6 +40,7 @@ typedef struct CropDetectContext { int reset_count; int frame_nb; int max_pixsteps[4]; +int max_outliers; } CropDetectContext; static int query_formats(AVFilterContext *ctx) @@ -122,6 +123,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) int bpp = s-max_pixsteps[0]; int w, h, x, y, shrink_by; AVDictionary **metadata; +int outliers, last_y; // ignore first 2 frames - they may be empty if (++s-frame_nb 0) { @@ -137,17 +139,21 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) } #define CHECK(DST, FROM, NOEND, INC, STEP0, STEP1, LEN) \ -for (y = FROM; NOEND; INC) {\ +outliers = 0;\ +for (last_y = y = FROM; NOEND; y = y INC) {\ if (checkline(ctx, frame-data[0] + STEP0 * y, STEP1, LEN, bpp) s-limit) {\ -DST = y;\ -break;\ -}\ +if (++outliers s-max_outliers) { \ +DST = last_y;\ +break;\ +}\ +} else\ +last_y = y INC;\ } -CHECK(s-y1, 0, y s-y1, y++, frame-linesize[0], bpp, frame-width); -CHECK(s-y2, frame-height - 1, y FFMAX(s-y2, s-y1), y--, frame-linesize[0], bpp, frame-width); -CHECK(s-x1, 0, y s-x1, y++, bpp, frame-linesize[0], frame-height); -CHECK(s-x2, frame-width - 1, y FFMAX(s-x2, s-x1), y--, bpp, frame-linesize[0], frame-height); +CHECK(s-y1, 0, y s-y1, +1, frame-linesize[0], bpp, frame-width); +CHECK(s-y2, frame-height - 1, y FFMAX(s-y2, s-y1), -1, frame-linesize[0], bpp, frame-width); +CHECK(s-x1, 0, y s-x1, +1, bpp, frame-linesize[0], frame-height); +CHECK(s-x2, frame-width - 1, y FFMAX(s-x2, s-x1), -1, bpp, frame-linesize[0], frame-height); // round x and y (up), important for yuv colorspaces @@ -200,6 +206,7 @@ static const AVOption cropdetect_options[] = { { round, Value by which the width/height should be divisible, OFFSET(round), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, INT_MAX, FLAGS }, { reset, Recalculate the crop area after this many frames, OFFSET(reset_count), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, { reset_count, Recalculate the crop area after this many frames,OFFSET(reset_count),AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX, FLAGS }, +{ max_outliers, Threshold count of outliers, OFFSET(max_outliers),AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, { NULL } }; -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel