Re: [FFmpeg-devel] [PATCH] libxcb-xhsape in configure
Hi! On Thursday 30 October 2014 09:26:16 pm Horváth Balázs wrote: This is my attempt at fixing the broken build because xcbgrab uses xcb_shape_rectangles, but doesn't link xcb-shape. Do you consider the attached patch a sufficient fix? Or does it have an advantage for users to disable xcb-shape but enable xcb-xfixes? Thank you, Carl Eugen diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c index 2fdb992..9a67985 100644 --- a/libavdevice/xcbgrab.c +++ b/libavdevice/xcbgrab.c @@ -576,7 +576,7 @@ static void setup_window(AVFormatContext *s) XCB_COPY_FROM_PARENT, mask, values); -#if XCB_SHAPE_RECTANGLES +#if CONFIG_LIBXCB_XFIXES xcb_shape_rectangles(c-conn, XCB_SHAPE_SO_SUBTRACT, XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, c-window, ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [patch 2/3]Fix bug for POWER LE: /libavcodec/ppc/hpeldsp_altivec.c
Hi, There are 3 patches to fix bugs for POWER8 little endian. I will send 3 patches in 3 different email. This is the second, functions The fate test result after merge these 3 patches can be found on website by searching ibmcrl, also attached in the below to facilitate the review. The passed test cases change from 1679/2182 to 2202/2235. Thanks. Rong yan -- The world has enough for everyone's need, but not enough for everyone's greed. 0002-libavcodec-ppc-hpeldsp_altivec.c-fix-put_no_rnd_pixe.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [patch 3/3]Fix bug for POWER LE: /libswscale/ppc/swscale_altivec.c
Hi, There are 3 patches to fix bugs for POWER8 little endian. I will send 3 patches in 3 different email. This is the third, functions hScale_altivec_real(), yuv2planeX_16_altivec(), and yuv2planeX_8() are fixed. The fate test result after merge these 3 patches can be found on website by searching ibmcrl, also attached in the below to facilitate the review. The passed test cases change from 1679/2182 to 2202/2235. Thanks. Rong Yan -- The world has enough for everyone's need, but not enough for everyone's greed. 0003-libswscale-ppc-swscale_altivec.c-fix-hScale_altivec_.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFserver bug?
On 31 October 2014 03:19, Michael Niedermayer michae...@gmx.at wrote: On Fri, Oct 31, 2014 at 02:14:29AM +0100, Sevan Gelici wrote: Hi, Two days ago i updated my linux system and also ffmpeg was updated. When i started to stream it was not working anymore. I am using ffserver. i determined the problem which causes the problem thats the bitrate it makes like 50mb of it. i reinstalled the system a couple times because of some tests and still i don't get it work. Can someone help me with this pls. do you know which commit / revission has caused the regression ? At first moment I thought I messed something with configuration code, but it reproducible before my recent changes. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [patch 1/3]Fix bug for POWER LE: /libavcodec/ppc/me_cmp.c
On Fri, Oct 31, 2014 at 06:45:51PM +0800, rongyan wrote: Hi, There are 3 patches to fix bugs for POWER8 little endian. I will send 3 patches in 3 different email. This is the first, functions sad8_altivec() sse8_altivec(), hadamard8_diff8x8_altivec(), hadamard8_diff16x8_altivec() are fixed. The fate test result after merge these 3 patches can be found on website by searching ibmcrl, also attached in the below to facilitate the review. The passed test cases change from 1679/2182 to 2202/2235. Thanks. Rong Yan -- The world has enough for everyone's need, but not enough for everyone's greed. me_cmp.c | 460 +++ 1 file changed, 408 insertions(+), 52 deletions(-) dd8fe6d196e1330633e22dd0395b5c010e5585df 0001-libavcodec-ppc-me_cmp.c-fix-sad8_altivec-sse8_altive.patch From a1bd28eb6d775e41defca51fc156a23e4d3f16ed Mon Sep 17 00:00:00 2001 From: Rong Yan rongyan...@gmail.com Date: Fri, 31 Oct 2014 10:18:01 + Subject: [PATCH 1/3] libavcodec/ppc/me_cmp.c : fix sad8_altivec() sse8_altivec() hadamard8_diff8x8_altivec() hadamard8_diff16x8_altivec() for POWER LE --- libavcodec/ppc/me_cmp.c | 460 ++-- 1 file changed, 408 insertions(+), 52 deletions(-) diff --git a/libavcodec/ppc/me_cmp.c b/libavcodec/ppc/me_cmp.c index 8ff8193..9759b17 100644 --- a/libavcodec/ppc/me_cmp.c +++ b/libavcodec/ppc/me_cmp.c @@ -34,16 +34,18 @@ #include libavcodec/mpegvideo.h #include libavcodec/me_cmp.h +#include stdio.h #if HAVE_ALTIVEC -#if HAVE_VSX + +#if !HAVE_BIGENDIAN static int sad16_x2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) { int i, s = 0; -const vector unsigned char zero = +const vector unsigned char __attribute__((aligned(16))) zero = (const vector unsigned char) vec_splat_u8(0); -vector unsigned int sad = (vector unsigned int) vec_splat_u32(0); -vector signed int sumdiffs; +vector unsigned int __attribute__((aligned(16))) sad = (vector unsigned int) vec_splat_u32(0); +vector signed int __attribute__((aligned(16))) sumdiffs; adding alignment directives should be a sepearte patch for (i = 0; i h; i++) { /* Read unaligned pixels into our vectors. The vectors are as follows: @@ -69,10 +71,11 @@ static int sad16_x2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, /* Sum up the four partial sums, and put the result into s. */ sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero); sumdiffs = vec_splat(sumdiffs, 3); -vec_vsx_st(sumdiffs, 0, s); +//vec_vsx_st(sumdiffs, 0, s); +vec_ste(sumdiffs, 0, s); return s; } -#else +#else /* else of #if !HAVE_BIGENDIAN */ static int sad16_x2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) { @@ -114,19 +117,19 @@ static int sad16_x2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -#endif /* HAVE_VSX */ +#endif /* end of #if !HAVE_BIGENDIAN */ this is inconsistent with the rest of the codebase its also a cosmetic change and cosmetic changes must not be in the same patch as functional changes -#if HAVE_VSX +#if !HAVE_BIGENDIAN static int sad16_y2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) { int i, s = 0; - const vector unsigned char zero = + const vector unsigned char __attribute__((aligned(16)))zero = (const vector unsigned char) vec_splat_u8(0); - vector unsigned char perm = vec_lvsl(0, pix2); - vector unsigned char pix1v, pix3v, avgv, t5; - vector unsigned int sad = (vector unsigned int) vec_splat_u32(0); - vector signed int sumdiffs; + vector unsigned char __attribute__((aligned(16))) perm = vec_lvsl(0, pix2); + vector unsigned char __attribute__((aligned(16))) pix1v, pix3v, avgv, t5; + vector unsigned int __attribute__((aligned(16))) sad = (vector unsigned int) vec_splat_u32(0); + vector signed int __attribute__((aligned(16))) sumdiffs; uint8_t *pix3 = pix2 + line_size; /* Due to the fact that pix3 = pix2 + line_size, the pix3 of one @@ -162,10 +165,11 @@ static int sad16_y2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, /* Sum up the four partial sums, and put the result into s. */ sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero); sumdiffs = vec_splat(sumdiffs, 3); - vec_vsx_st(sumdiffs, 0, s); + //vec_vsx_st(sumdiffs, 0, s); + vec_ste(sumdiffs, 0, s); return s; } -#else +#else /* else of #if !HAVE_BIGENDIAN */ static int sad16_y2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int
Re: [FFmpeg-devel] [patch 1/3]Fix bug for POWER LE: /libavcodec/ppc/me_cmp.c
On Fri, Oct 31, 2014 at 01:03:58PM +0100, Michael Niedermayer wrote: On Fri, Oct 31, 2014 at 06:45:51PM +0800, rongyan wrote: Hi, There are 3 patches to fix bugs for POWER8 little endian. I will send 3 patches in 3 different email. This is the first, functions sad8_altivec() sse8_altivec(), hadamard8_diff8x8_altivec(), hadamard8_diff16x8_altivec() are fixed. The fate test result after merge these 3 patches can be found on website by searching ibmcrl, also attached in the below to facilitate the review. The passed test cases change from 1679/2182 to 2202/2235. Thanks. Rong Yan -- The world has enough for everyone's need, but not enough for everyone's greed. me_cmp.c | 460 +++ 1 file changed, 408 insertions(+), 52 deletions(-) dd8fe6d196e1330633e22dd0395b5c010e5585df 0001-libavcodec-ppc-me_cmp.c-fix-sad8_altivec-sse8_altive.patch From a1bd28eb6d775e41defca51fc156a23e4d3f16ed Mon Sep 17 00:00:00 2001 From: Rong Yan rongyan...@gmail.com Date: Fri, 31 Oct 2014 10:18:01 + Subject: [PATCH 1/3] libavcodec/ppc/me_cmp.c : fix sad8_altivec() sse8_altivec() hadamard8_diff8x8_altivec() hadamard8_diff16x8_altivec() for POWER LE --- libavcodec/ppc/me_cmp.c | 460 ++-- 1 file changed, 408 insertions(+), 52 deletions(-) diff --git a/libavcodec/ppc/me_cmp.c b/libavcodec/ppc/me_cmp.c index 8ff8193..9759b17 100644 --- a/libavcodec/ppc/me_cmp.c +++ b/libavcodec/ppc/me_cmp.c @@ -34,16 +34,18 @@ #include libavcodec/mpegvideo.h #include libavcodec/me_cmp.h +#include stdio.h #if HAVE_ALTIVEC -#if HAVE_VSX + +#if !HAVE_BIGENDIAN static int sad16_x2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) { int i, s = 0; -const vector unsigned char zero = +const vector unsigned char __attribute__((aligned(16))) zero = (const vector unsigned char) vec_splat_u8(0); -vector unsigned int sad = (vector unsigned int) vec_splat_u32(0); -vector signed int sumdiffs; +vector unsigned int __attribute__((aligned(16))) sad = (vector unsigned int) vec_splat_u32(0); +vector signed int __attribute__((aligned(16))) sumdiffs; adding alignment directives should be a sepearte patch for (i = 0; i h; i++) { /* Read unaligned pixels into our vectors. The vectors are as follows: @@ -69,10 +71,11 @@ static int sad16_x2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, /* Sum up the four partial sums, and put the result into s. */ sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero); sumdiffs = vec_splat(sumdiffs, 3); -vec_vsx_st(sumdiffs, 0, s); +//vec_vsx_st(sumdiffs, 0, s); +vec_ste(sumdiffs, 0, s); return s; } -#else +#else /* else of #if !HAVE_BIGENDIAN */ static int sad16_x2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) { @@ -114,19 +117,19 @@ static int sad16_x2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -#endif /* HAVE_VSX */ +#endif /* end of #if !HAVE_BIGENDIAN */ this is inconsistent with the rest of the codebase its also a cosmetic change and cosmetic changes must not be in the same patch as functional changes -#if HAVE_VSX +#if !HAVE_BIGENDIAN static int sad16_y2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) { int i, s = 0; - const vector unsigned char zero = + const vector unsigned char __attribute__((aligned(16)))zero = (const vector unsigned char) vec_splat_u8(0); - vector unsigned char perm = vec_lvsl(0, pix2); - vector unsigned char pix1v, pix3v, avgv, t5; - vector unsigned int sad = (vector unsigned int) vec_splat_u32(0); - vector signed int sumdiffs; + vector unsigned char __attribute__((aligned(16))) perm = vec_lvsl(0, pix2); + vector unsigned char __attribute__((aligned(16))) pix1v, pix3v, avgv, t5; + vector unsigned int __attribute__((aligned(16))) sad = (vector unsigned int) vec_splat_u32(0); + vector signed int __attribute__((aligned(16))) sumdiffs; uint8_t *pix3 = pix2 + line_size; /* Due to the fact that pix3 = pix2 + line_size, the pix3 of one @@ -162,10 +165,11 @@ static int sad16_y2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, /* Sum up the four partial sums, and put the result into s. */ sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero); sumdiffs = vec_splat(sumdiffs, 3); - vec_vsx_st(sumdiffs, 0, s); + //vec_vsx_st(sumdiffs, 0, s); +
Re: [FFmpeg-devel] [PATCH] lavfi: add xbr filter
On date Friday 2014-10-31 01:36:46 +0530, arwa arif encoded: [...] From b9b56b594f856fef8b113b283df2d2045e8357f7 Mon Sep 17 00:00:00 2001 From: Arwa Arif arwaarif1...@gmail.com Date: Thu, 30 Oct 2014 22:06:20 +0530 Subject: [PATCH] [PATCH]lvafi: add xbr filter typo: lavfi: --- doc/filters.texi |5 + libavfilter/Makefile |1 + libavfilter/allfilters.c |1 + libavfilter/vf_xbr.c | 319 ++ 4 files changed, 326 insertions(+) create mode 100644 libavfilter/vf_xbr.c diff --git a/doc/filters.texi b/doc/filters.texi index 7be29de..2905e5d 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -9163,6 +9163,11 @@ Only deinterlace frames marked as interlaced. Default value is @samp{all}. @end table +@section xbr +Apply high-quality magnification filter which is designed for pixel art. It follows a set +of edge-detection rules @url{http://www.libretro.com/forums/viewtopic.php?f=6t=134}. +This filter was originally created by Hyllian. + @anchor{yadif} @section yadif diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 6d868e7..2c56e38 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -198,6 +198,7 @@ OBJS-$(CONFIG_VIDSTABDETECT_FILTER) += vidstabutils.o vf_vidstabdetect. OBJS-$(CONFIG_VIDSTABTRANSFORM_FILTER) += vidstabutils.o vf_vidstabtransform.o OBJS-$(CONFIG_VIGNETTE_FILTER) += vf_vignette.o OBJS-$(CONFIG_W3FDIF_FILTER) += vf_w3fdif.o +OBJS-$(CONFIG_XBR_FILTER)+= vf_xbr.o OBJS-$(CONFIG_YADIF_FILTER) += vf_yadif.o OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index d88a9ad..2352d44 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -213,6 +213,7 @@ void avfilter_register_all(void) REGISTER_FILTER(VIDSTABTRANSFORM, vidstabtransform, vf); REGISTER_FILTER(VIGNETTE, vignette, vf); REGISTER_FILTER(W3FDIF, w3fdif, vf); +REGISTER_FILTER(XBR,xbr,vf); REGISTER_FILTER(YADIF, yadif, vf); REGISTER_FILTER(ZMQ,zmq,vf); REGISTER_FILTER(ZOOMPAN,zoompan,vf); diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c new file mode 100644 index 000..1a828d8 --- /dev/null +++ b/libavfilter/vf_xbr.c @@ -0,0 +1,319 @@ +/* + * This file is part of FFmpeg. + * + * Copyright (c) 2014 Arwa Arif arwaarif1...@gmail.com + * + * 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 + */ + +/** + * @file + * XBR Filter is used for depixelization of image. + * This is based on Hyllian's 2xBR shader. + * 2xBR Filter v0.2.5 + * @see : http://www.libretro.com/forums/viewtopic.php?f=6t=134 + * Future work : To implement x3 and x4 scale, and threading. + */ + +#include libavutil/opt.h +#include libavutil/avassert.h +#include libavutil/pixdesc.h +#include internal.h + +typedef struct { +uint32_t rgbtoyuv[124]; +} xBRContext; + +/** +* Calculates the weight of difference of the pixels, by transforming these +* pixels into their Y'UV parts. It then uses the threshold used by HQx filters: +* 48*Y + 7*U + 6*V, to give it those smooth looking edges. +**/ +static int d(AVFrame *in, int x1, int y1, int x2, int y2, const uint32_t *r2y) nit: use a more significant name, for example compute_diff() or diff() +{ + +#define YMASK 0xff +#define UMASK 0x00ff00 +#define VMASK 0xff + +int r1 = *(in-data[0] + y1 * in-linesize[0] + x1*3); +int g1 = *(in-data[0] + y1 * in-linesize[0] + x1*3 + 1); +int b1 = *(in-data[0] + y1 * in-linesize[0] + x1*3 + 2); + +int r2 = *(in-data[0] + y2 * in-linesize[0] + x2*3); +int g2 = *(in-data[0] + y2 * in-linesize[0] + x2*3 + 1); +int b2 = *(in-data[0] + y2 * in-linesize[0] + x2*3 + 2); + +uint32_t c1 = r1 | g18 | b116 ; +uint32_t c2 = r2 | g28 | b216 ; + +uint32_t yuv1 = r2y[c1 0xff]; +uint32_t yuv2 = r2y[c2 0xff]; is the 0xff mask required? + +return abs((yuv1
[FFmpeg-devel] OPW Qualification Task: Validate MLP Bitstream
Hi, I have first added experimental encoder mlpenc.c from https://github.com/ramiropolla/mlpenc an updated changes according to the recent commits in FFmpeg From 0fb7dcf1f126bd137e2b2025c5cd6cff4af65801 Mon Sep 17 00:00:00 2001 From: Greeshma Balabhadra greeshmabalaba...@gmail.com binti...@gmail.com Date: Thu, 31 Oct 2014 06:30:00 +0530 Subject: [PATCH] mlp encoder : validate MLP bitstream diff --git a/ffmpeg/libavcodec/mlpenc.c b/ffmpeg/libavcodec/mlpenc.c index 70cb7d8..26ece64 100644 --- a/ffmpeg/libavcodec/mlpenc.c +++ b/ffmpeg/libavcodec/mlpenc.c @@ -23,13 +23,14 @@ #include libavutil/crc.h #include libavutil/avstring.h #include mlp.h -#include dsputil.h +#include mlpdsp.h #include lpc.h #define MAJOR_HEADER_INTERVAL 16 #define MLP_MIN_LPC_ORDER 1 #define MLP_MAX_LPC_ORDER 8 #define MLP_MIN_LPC_SHIFT 8 #define MLP_MAX_LPC_SHIFT 15 +#define FF_LPC_TYPE_DEFAULT -1 typedef struct { uint8_t min_channel; /// The index of the first channel coded in this substream. uint8_t max_channel; /// The index of the last channel coded in this substream. @@ -141,7 +142,7 @@ DecodingParams *prev_decoding_params; ChannelParams *seq_channel_params; DecodingParams *seq_decoding_params; unsigned int max_codebook_search; -DSPContext dsp; +MLPDSPContext dsp; } MLPEncodeContext; static ChannelParams restart_channel_params[MAX_CHANNELS]; static DecodingParams restart_decoding_params[MAX_SUBSTREAMS];@@ -31,6 +31,11 @@ #define MLP_MIN_LPC_SHIFT 8 #define MLP_MAX_LPC_SHIFT 15 #define FF_LPC_TYPE_DEFAULT -1 +typedef struct MlpLPCContext { + int lpc_order; + int lpc_coeff[MLP_MAX_LPC_ORDER+1]; + int lpc_quant; +} MlpLPCContext; typedef struct { uint8_t min_channel; /// The index of the first channel coded in this substream. uint8_t max_channel; /// The index of the last channel coded in this substream. @@ -143,6 +148,8 @@ typedef struct { DecodingParams *seq_decoding_params; unsigned int max_codebook_search; MLPDSPContext dsp; + MlpLPCContext lpc[2]; + LPCContext lpc_ctx; } MLPEncodeContext; static ChannelParams restart_channel_params[MAX_CHANNELS]; static DecodingParams restart_decoding_params[MAX_SUBSTREAMS]; @@ -1157,7 +1164,7 @@ unsigned int substr) *lpc_samples++ = *sample_buffer; sample_buffer += ctx-num_channels; } - order = ff_lpc_calc_coefs(ctx-dsp, ctx-lpc_sample_buffer, ctx-number_of_samples, + order = ff_lpc_calc_coefs(ctx-lpc_ctx, ctx-lpc_sample_buffer, ctx-number_of_samples, MLP_MIN_LPC_ORDER, max_order, 11, coefs, shift, -1, 1, ORDER_METHOD_EST, MLP_MIN_LPC_SHIFT, MLP_MAX_LPC_SHIFT, MLP_MIN_LPC_SHIFT); @@ -1815,12 +1815,10 @@ unsigned int substr) // static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet_ptr) { - const uint8_t* data=frame-data; - int buf_size=pkt-size; - uint8_t *buf=pkt-data; MLPEncodeContext *ctx = avctx-priv_data; unsigned int bytes_written = 0; - int restart_frame; + int restart_frame,ret; + const int16_t *samples = (const int16_t *)frame-data[0]; ctx-frame_index = avctx-frame_number % ctx-max_restart_interval; ctx-inout_buffer = ctx-major_inout_buffer + ctx-frame_index * ctx-one_sample_buffer_size; @@ -1831,7 +1829,7 @@ unsigned int substr) + ctx-frame_index * ctx-one_sample_buffer_size; ctx-write_buffer = ctx-inout_buffer; if (avctx-frame_number ctx-max_restart_interval) { - if (data) { + if (frame) { goto input_and_return; } else { /* There are less frames than the requested major header interval. @@ -1861,11 +1859,11 @@ unsigned int substr) ctx-timestamp += ctx-frame_size[ctx-frame_index]; ctx-dts += ctx-frame_size[ctx-frame_index]; input_and_return: - if (data) { - ctx-frame_size[ctx-frame_index] = avctx-frame_size; - ctx-next_major_frame_size += avctx-frame_size; + if (frame) { + ctx-frame_size[ctx-frame_index] = frame-nb_samples; + ctx-next_major_frame_size += frame-nb_samples; ctx-next_major_number_of_frames++; - input_data(ctx, data); + input_data(ctx, samples); } else if (!ctx-last_frame) { ctx-last_frame = ctx-inout_buffer; } @@ -1913,7 +1911,10 @@ unsigned int substr) } } no_data_left: - return bytes_written; + // return bytes_written; + pkt-size = bytes_written; + *got_packet_ptr = 1; + return 0; } static av_cold int mlp_encode_close(AVCodecContext *avctx) {@@ -1818,7 +1818,7 @@ unsigned int substr) MLPEncodeContext *ctx = avctx-priv_data; unsigned int bytes_written = 0; int restart_frame,ret; - const int16_t *samples = (const int16_t *)frame-data[0]; + const int8_t *samples = (const int8_t *)frame-data[0]; ctx-frame_index = avctx-frame_number % ctx-max_restart_interval; ctx-inout_buffer = ctx-major_inout_buffer + ctx-frame_index * ctx-one_sample_buffer_size;@@ -428,12 +429,12 @@ if (avctx-channels = 2) { ctx-substream_info |= SUBSTREAM_INFO_MAX_2_CHAN; } switch (avctx-sample_fmt) { -case SAMPLE_FMT_S16: +case AV_SAMPLE_FMT_S16:
Re: [FFmpeg-devel] OPW Qualification Task: Validate MLP Bitstream
Le decadi 10 brumaire, an CCXXIII, greeshma a écrit : @@ -23,13 +23,14 @@ #include libavutil/crc.h #include libavutil/avstring.h #include mlp.h -#include dsputil.h +#include mlpdsp.h #include lpc.h #define MAJOR_HEADER_INTERVAL 16 #define MLP_MIN_LPC_ORDER 1 #define MLP_MAX_LPC_ORDER 8 #define MLP_MIN_LPC_SHIFT snip It seems your mail user agent has completely mangled the patch: it is unusable as is. I am afraid you need to re-send it more carefully. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] OPW Qualification Task: Validate MLP Bitstream
Hi, I can view it perfectly, but anyways ,please go through the following google doc. https://docs.google.com/document/d/1oBy9AoGzJHR4UcvuogYa8sfFGUK96lcgF3qRF4HrIa4/edit?usp=sharing Greeshma Balabhadra On Fri, Oct 31, 2014 at 7:01 PM, Nicolas George geo...@nsup.org wrote: Le decadi 10 brumaire, an CCXXIII, greeshma a écrit : @@ -23,13 +23,14 @@ #include libavutil/crc.h #include libavutil/avstring.h #include mlp.h -#include dsputil.h +#include mlpdsp.h #include lpc.h #define MAJOR_HEADER_INTERVAL 16 #define MLP_MIN_LPC_ORDER 1 #define MLP_MAX_LPC_ORDER 8 #define MLP_MIN_LPC_SHIFT snip It seems your mail user agent has completely mangled the patch: it is unusable as is. I am afraid you need to re-send it more carefully. Regards, -- Nicolas George ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] OPW Qualification Task: Validate MLP Bitstream
Le decadi 10 brumaire, an CCXXIII, greeshma a écrit : I can view it perfectly, You can look how it appears to others: http://ffmpeg.org/pipermail/ffmpeg-devel/2014-October/164764.html but anyways ,please go through the following google doc. https://docs.google.com/document/d/1oBy9AoGzJHR4UcvuogYa8sfFGUK96lcgF3qRF4HrIa4/edit?usp=sharing This is not usable either. I do not know what kind of document it is, but it looks like some sort of word processor, that is not the correct tool to work on source code. For example, you can see that most of the indentation was lost and a lot of lines wrapped to the page width. And patches are reviewed directly on the mailing-list anyway. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] OPW Qualification Task: Validate MLP Bitstream
On Fri, Oct 31, 2014 at 10:09 AM, greeshma greeshmabalaba...@gmail.com wrote: https://docs.google.com/document/d/1oBy9AoGzJHR4UcvuogYa8sfFGUK96lcgF3qRF4HrIa4/edit?usp=sharing That's not going to work either, you need to use git to create a patch file, upload that file to dropbox or whatever, and paste a link to it, OR you can click on the paper clip icon in gmail and select the patch file for uploading, and that will attach it properly. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] OPW Qualification Task: Validate MLP Bitstream
Le decadi 10 brumaire, an CCXXIII, Marcus Johnson a écrit : That's not going to work either, you need to use git to create a patch Yes. file, upload that file to dropbox or whatever Please, patches should be sent to the mailing-list directly. Even the crappiest of user agents can send attachments without mangling them (and we do not usually complain when the MIME type is bogus). Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Fwd: OPW Qualification Task: Validate MLP Bitstream
Hi, I have first added experimental encoder mlpenc.c from https://github.com/ramiropolla/mlpenc an updated changes according to the recent commits in FFmpeg From 0fb7dcf1f126bd137e2b2025c5cd6cff4af65801 Mon Sep 17 00:00:00 2001 From: Greeshma Balabhadra greeshmabalaba...@gmail.com Date: Thu, 31 Oct 2014 06:30:00 +0530 Subject: [PATCH] mlp encoder : validate MLP bitstream diff --git a/ffmpeg/libavcodec/mlpenc.c b/ffmpeg/libavcodec/mlpenc.c index 70cb7d8..26ece64 100644 --- a/ffmpeg/libavcodec/mlpenc.c +++ b/ffmpeg/libavcodec/mlpenc.c @@ -23,13 +23,14 @@ #include libavutil/crc.h #include libavutil/avstring.h #include mlp.h -#include dsputil.h +#include mlpdsp.h #include lpc.h #define MAJOR_HEADER_INTERVAL 16 #define MLP_MIN_LPC_ORDER 1 #define MLP_MAX_LPC_ORDER 8 #define MLP_MIN_LPC_SHIFT 8 #define MLP_MAX_LPC_SHIFT 15 +#define FF_LPC_TYPE_DEFAULT -1 typedef struct { uint8_t min_channel; /// The index of the first channel coded in this substream. uint8_t max_channel; /// The index of the last channel coded in this substream. @@ -141,7 +142,7 @@ DecodingParams *prev_decoding_params; ChannelParams *seq_channel_params; DecodingParams *seq_decoding_params; unsigned int max_codebook_search; -DSPContext dsp; +MLPDSPContext dsp; } MLPEncodeContext; static ChannelParams restart_channel_params[MAX_CHANNELS]; static DecodingParams restart_decoding_params[MAX_SUBSTREAMS]; @@ -31,6 +31,11 @@ #define MLP_MIN_LPC_SHIFT 8 #define MLP_MAX_LPC_SHIFT 15 #define FF_LPC_TYPE_DEFAULT -1 +typedef struct MlpLPCContext { + int lpc_order; + int lpc_coeff[MLP_MAX_LPC_ORDER+1]; + int lpc_quant; +} MlpLPCContext; typedef struct { uint8_t min_channel; /// The index of the first channel coded in this substream. uint8_t max_channel; /// The index of the last channel coded in this substream. @@ -143,6 +148,8 @@ typedef struct { DecodingParams *seq_decoding_params; unsigned int max_codebook_search; MLPDSPContext dsp; + MlpLPCContext lpc[2]; + LPCContext lpc_ctx; } MLPEncodeContext; static ChannelParams restart_channel_params[MAX_CHANNELS]; static DecodingParams restart_decoding_params[MAX_SUBSTREAMS]; @@ -1157,7 +1164,7 @@ unsigned int substr) *lpc_samples++ = *sample_buffer; sample_buffer += ctx-num_channels; } - order = ff_lpc_calc_coefs(ctx-dsp, ctx-lpc_sample_buffer, ctx-number_of_samples, + order = ff_lpc_calc_coefs(ctx-lpc_ctx, ctx-lpc_sample_buffer, ctx-number_of_samples, MLP_MIN_LPC_ORDER, max_order, 11, coefs, shift, -1, 1, ORDER_METHOD_EST, MLP_MIN_LPC_SHIFT, MLP_MAX_LPC_SHIFT, MLP_MIN_LPC_SHIFT); @@ -1815,12 +1815,10 @@ unsigned int substr) // static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet_ptr) { - const uint8_t* data=frame-data; - int buf_size=pkt-size; - uint8_t *buf=pkt-data; MLPEncodeContext *ctx = avctx-priv_data; unsigned int bytes_written = 0; - int restart_frame; + int restart_frame,ret; + const int16_t *samples = (const int16_t *)frame-data[0]; ctx-frame_index = avctx-frame_number % ctx-max_restart_interval; ctx-inout_buffer = ctx-major_inout_buffer + ctx-frame_index * ctx-one_sample_buffer_size; @@ -1831,7 +1829,7 @@ unsigned int substr) + ctx-frame_index * ctx-one_sample_buffer_size; ctx-write_buffer = ctx-inout_buffer; if (avctx-frame_number ctx-max_restart_interval) { - if (data) { + if (frame) { goto input_and_return; } else { /* There are less frames than the requested major header interval. @@ -1861,11 +1859,11 @@ unsigned int substr) ctx-timestamp += ctx-frame_size[ctx-frame_index]; ctx-dts += ctx-frame_size[ctx-frame_index]; input_and_return: - if (data) { - ctx-frame_size[ctx-frame_index] = avctx-frame_size; - ctx-next_major_frame_size += avctx-frame_size; + if (frame) { + ctx-frame_size[ctx-frame_index] = frame-nb_samples; + ctx-next_major_frame_size += frame-nb_samples; ctx-next_major_number_of_frames++; - input_data(ctx, data); + input_data(ctx, samples); } else if (!ctx-last_frame) { ctx-last_frame = ctx-inout_buffer; } @@ -1913,7 +1911,10 @@ unsigned int substr) } } no_data_left: - return bytes_written; + // return bytes_written; + pkt-size = bytes_written; + *got_packet_ptr = 1; + return 0; } static av_cold int mlp_encode_close(AVCodecContext *avctx) { @@ -1818,7 +1818,7 @@ unsigned int substr) MLPEncodeContext *ctx = avctx-priv_data; unsigned int bytes_written = 0; int restart_frame,ret; - const int16_t *samples = (const int16_t *)frame-data[0]; + const int8_t *samples = (const int8_t *)frame-data[0]; ctx-frame_index = avctx-frame_number % ctx-max_restart_interval; ctx-inout_buffer = ctx-major_inout_buffer + ctx-frame_index * ctx-one_sample_buffer_size;
Re: [FFmpeg-devel] Fwd: OPW Qualification Task: Validate MLP Bitstream
Le decadi 10 brumaire, an CCXXIII, greeshma a écrit : diff --git a/ffmpeg/libavcodec/mlpenc.c b/ffmpeg/libavcodec/mlpenc.c That is better, but still not good enough. http://ffmpeg.org/pipermail/ffmpeg-devel/2014-October/164770.html These requirements are not gratuitous: git can take a patch from the mailing-list and apply it on anyone's working tree, so they can test it. If the patch is mangled, that process does not work. #include libavutil/crc.h #include libavutil/avstring.h #include mlp.h -#include dsputil.h +#include mlpdsp.h #include lpc.h #define MAJOR_HEADER_INTERVAL 16 All lines in a patch that are there to give context but not changed start with a space; you can see there is not space here, as the changed includes are not aligned with the others. typedef struct { uint8_t min_channel; /// The index of the first channel coded in this substream. uint8_t max_channel; /// The index of the last channel coded in this substream. These lines have been wrapped to ~80 columns. @@ -141,7 +142,7 @@ DecodingParams *prev_decoding_params; ChannelParams *seq_channel_params; DecodingParams *seq_decoding_params; unsigned int max_codebook_search; -DSPContext dsp; +MLPDSPContext dsp; } MLPEncodeContext; Here, the + and - that indicate a change are indented, while they are supposed to be on the very first column. [...] I give you these examples so you can see for yourself and check your next try, but that does not mean you have to CORRECT them yourself: the patch file produced by Git is correct in the first place, you just have to make sure your mail user agent sends it EXACTLY as it is. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Fwd: OPW Qualification Task: Validate MLP Bitstream
Greeshma, 2014-10-31 15:41 GMT+01:00 greeshma greeshmabalaba...@gmail.com: I have first added experimental encoder mlpenc.c from https://github.com/ramiropolla/mlpenc an updated changes according to the recent commits in FFmpeg That code is supposed to be sent for review after the end of OPW, not before =) The qualification task is to update it to the current FFmpeg codebase (for example the DSPContext changes and the encode function changes). There's still a long way to go before submitting this code for review. Ramiro ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avformat: add webp muxer
Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavformat/Makefile |1 + libavformat/allformats.c |1 + libavformat/webpenc.c| 156 ++ 3 files changed, 158 insertions(+) create mode 100644 libavformat/webpenc.c diff --git a/libavformat/Makefile b/libavformat/Makefile index 62dc41c..9833ebb 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -450,6 +450,7 @@ OBJS-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER)+= matroskadec.o matroska.o \ oggparsevorbis.o vorbiscomment.o \ flac_picture.o replaygain.o OBJS-$(CONFIG_WEBM_DASH_MANIFEST_MUXER) += webmdashenc.o matroska.o +OBJS-$(CONFIG_WEBP_MUXER)+= webpenc.o OBJS-$(CONFIG_WEBVTT_DEMUXER)+= webvttdec.o subtitles.o OBJS-$(CONFIG_WEBVTT_MUXER) += webvttenc.o OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index bf81737..4d7ef20 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -310,6 +310,7 @@ void av_register_all(void) REGISTER_DEMUXER (WC3, wc3); REGISTER_MUXER (WEBM, webm); REGISTER_MUXDEMUX(WEBM_DASH_MANIFEST, webm_dash_manifest); +REGISTER_MUXER (WEBP, webp); REGISTER_MUXDEMUX(WEBVTT, webvtt); REGISTER_DEMUXER (WSAUD,wsaud); REGISTER_DEMUXER (WSVQA,wsvqa); diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c new file mode 100644 index 000..ba891c2 --- /dev/null +++ b/libavformat/webpenc.c @@ -0,0 +1,156 @@ +/* + * webp muxer + * Copyright (c) 2014 Michael Niedermayer + * + * 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/intreadwrite.h +#include libavutil/opt.h +#include avformat.h +#include internal.h + +typedef struct WebpContext{ +AVClass *class; +int frame_count; +AVPacket last_pkt; +int loop; +} WebpContext; + +static int webp_write_header(AVFormatContext *s) +{ +AVStream *st; + +if (s-nb_streams != 1) { +av_log(s, AV_LOG_ERROR, Only exactly 1 stream is supported\n); +return AVERROR(EINVAL); +} +st = s-streams[0]; +if (st-codec-codec_id != AV_CODEC_ID_WEBP) { +av_log(s, AV_LOG_ERROR, Only WebP is supported\n); +return AVERROR(EINVAL); +} +avpriv_set_pts_info(st, 24, 1, 1000); + +avio_write(s-pb, RIFF\0\0\0\0WEBP, 12); + +return 0; +} + +static int flush(AVFormatContext *s, int trailer, int64_t pts) +{ +WebpContext *w = s-priv_data; +AVStream *st = s-streams[0]; + +if (w-last_pkt.size) { +int skip = 0; + +if (AV_RL32(w-last_pkt.data) == AV_RL32(RIFF)) +skip = 12; +if (AV_RL32(w-last_pkt.data + skip) == AV_RL32(VP8X)) +skip += AV_RL32(w-last_pkt.data + skip + 4) + 8; + +w-frame_count ++; +if (w-frame_count == 1 !trailer) { +avio_write(s-pb, VP8X, 4); +avio_wl32(s-pb, 10); +avio_w8(s-pb, 2+16); +avio_wl24(s-pb, 0); +avio_wl24(s-pb, st-codec-width - 1); +avio_wl24(s-pb, st-codec-height - 1); + +avio_write(s-pb, ANIM, 4); +avio_wl32(s-pb, 6); +avio_wl32(s-pb, 0x); +avio_wl16(s-pb, w-loop); +} + +if (w-frame_count trailer) { +avio_write(s-pb, ANMF, 4); +avio_wl32(s-pb, 16 + w-last_pkt.size - skip); +avio_wl24(s-pb, 0); +avio_wl24(s-pb, 0); +avio_wl24(s-pb, st-codec-width - 1); +avio_wl24(s-pb, st-codec-height - 1); +if (w-last_pkt.pts != AV_NOPTS_VALUE pts != AV_NOPTS_VALUE) { +avio_wl24(s-pb, pts - w-last_pkt.pts); +} else +avio_wl24(s-pb, w-last_pkt.duration); +avio_w8(s-pb, 0); +} +avio_write(s-pb, w-last_pkt.data + skip, w-last_pkt.size - skip); +av_free_packet(w-last_pkt); +} + +return 0; +} + +static int webp_write_packet(AVFormatContext *s, AVPacket *pkt) +{ +WebpContext *w = s-priv_data; +int ret; + +if ((ret =
[FFmpeg-devel] [PATCH 2/2] avcodec/libwebpenc: support P frames in webp animations
Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavcodec/libwebpenc.c | 80 +-- 1 file changed, 77 insertions(+), 3 deletions(-) diff --git a/libavcodec/libwebpenc.c b/libavcodec/libwebpenc.c index 4cb8dc3..c7f9784 100644 --- a/libavcodec/libwebpenc.c +++ b/libavcodec/libwebpenc.c @@ -41,6 +41,9 @@ typedef struct LibWebPContext { int chroma_warning; // chroma linesize mismatch warning has been printed int conversion_warning; // pixel format conversion warning has been printed WebPConfig config; // libwebp configuration +AVFrame *ref; +int cr_size; +int cr_threshold; } LibWebPContext; static int libwebp_error_to_averror(int err) @@ -144,8 +147,8 @@ static int libwebp_encode_frame(AVCodecContext *avctx, AVPacket *pkt, pic-argb= (uint32_t *)frame-data[0]; pic-argb_stride = frame-linesize[0] / 4; } else { -if (frame-linesize[1] != frame-linesize[2]) { -if (!s-chroma_warning) { +if (frame-linesize[1] != frame-linesize[2] || s-cr_threshold) { +if (!s-chroma_warning !s-cr_threshold) { av_log(avctx, AV_LOG_WARNING, Copying frame due to differing chroma linesizes.\n); s-chroma_warning = 1; @@ -158,22 +161,80 @@ static int libwebp_encode_frame(AVCodecContext *avctx, AVPacket *pkt, alt_frame-width = frame-width; alt_frame-height = frame-height; alt_frame-format = frame-format; +if (s-cr_threshold) +alt_frame-format = AV_PIX_FMT_YUVA420P; ret = av_frame_get_buffer(alt_frame, 32); if (ret 0) goto end; +alt_frame-format = frame-format; av_frame_copy(alt_frame, frame); frame = alt_frame; +if (s-cr_threshold) { +int x,y, x2, y2, p; +int bs = s-cr_size; + +if (!s-ref) { +s-ref = av_frame_clone(frame); +if (!s-ref) { +ret = AVERROR(ENOMEM); +goto end; +} +} + +alt_frame-format = AV_PIX_FMT_YUVA420P; +for (y = 0; y frame-height; y+= bs) { +for (x = 0; x frame-width; x+= bs) { +int skip; +int sse = 0; +for (p = 0; p 3; p++) { +int bs2 = bs !!p; +int w = frame-width !!p; +int h = frame-height !!p; +int xs = x !!p; +int ys = y !!p; +for (y2 = ys; y2 FFMIN(ys + bs2, h); y2++) { +for (x2 = xs; x2 FFMIN(xs + bs2, w); x2++) { +int diff = frame-data[p][frame-linesize[p] * y2 + x2] + -s-ref-data[p][frame-linesize[p] * y2 + x2]; +sse += diff*diff; +} +} +} +skip = sse s-cr_threshold frame-data[3] != s-ref-data[3]; +if (!skip) +for (p = 0; p 3; p++) { +int bs2 = bs !!p; +int w = frame-width !!p; +int h = frame-height !!p; +int xs = x !!p; +int ys = y !!p; +for (y2 = ys; y2 FFMIN(ys + bs2, h); y2++) { +memcpy(s-ref-data[p][frame-linesize[p] * y2 + xs], + frame-data[p][frame-linesize[p] * y2 + xs], FFMIN(bs2, w-xs)); +} +} +for (y2 = y; y2 FFMIN(y+bs, frame-height); y2++) { +memset(frame-data[3][frame-linesize[3] * y2 + x], +skip ? 0 : 255, +FFMIN(bs, frame-width-x)); +} +} +} +} } + pic-use_argb = 0; pic-y = frame-data[0]; pic-u = frame-data[1]; pic-v = frame-data[2]; pic-y_stride = frame-linesize[0]; pic-uv_stride = frame-linesize[1]; -if (avctx-pix_fmt == AV_PIX_FMT_YUVA420P) { +if (frame-format == AV_PIX_FMT_YUVA420P) { pic-colorspace = WEBP_YUV420A; pic-a = frame-data[3]; pic-a_stride = frame-linesize[3]; +if (alt_frame) +WebPCleanupTransparentArea(pic);
Re: [FFmpeg-devel] Discuss: Improved hardware acceleration support
On Thu, 30 Oct 2014 20:31:17 -0500 Rodger Combs rodger.co...@gmail.com wrote: libavcodec currently has support for hardware-accelerated decoding, but no support for encoding, and libavcodec+libavfilter+ffmpeg provide no support for a decode-filter-encode pipeline that doesn't involve copying buffers back and forth from the video card and cutting out a significant amount of the gain provided by using hardware acceleration to begin with. It'd be useful to provide a way to leave buffers on the GPU when possible, and copy back and forth only when using a filter that can't be done on the GPU. Some filters could even be run without copying back and forth; for instance: scaling (for some scalers), overlays, cropping, drawtext/subtitles (the drawing component, anyway), deinterlacing, trim, and some post-processing could likely be done for a number of GPUs relatively easily, and others could likely also be done with additional work. This would probably require significant changes to AVFrame, various lavc/lavfi structs and APIs, and ffmpeg.c, but it could likely produce significant improvements in speed and power consumption when using systems that can support a full decode-filter-encode pipeline on the GPU. Thoughts on feasibility and/or implementation details? It would be pretty simple. You just need a convention to pass the API context around, and the application would have to create this context. Other than that, I think some video players are already doing things like this. I don't get the need for hw encoding though. Doesn't that usually produce rather bad quality? (Except with real hw as used in broadcasting etc., but where high bitrates are still needed to save the day.) I don't give a shit about ffmpeg.c, though. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] psy_snr:Psychoacoustic SNR for audio files
On Thu, Oct 30, 2014 at 11:33:51PM +0530, Senjuti Kundu wrote: Implemented an SNR for audio files which takes into a account the psychoacoustic masking. This results in an SNR which is closer to how humans percieve sound, compared to tiny_psnr which directly compares audio signals Signed-off-by: Senjuti Kundu senjutikund...@gmail.com --- tests/psy_snr.c | 421 1 file changed, 421 insertions(+) create mode 100644 tests/psy_snr.c This is missing a change to the Makefile also if you arent subscribed to ffmpeg-devel, make sure you subscribe (and check the archives as there was already a reply) Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- 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] OPW Qualification Task: Enable daemon mode for FFserver
Hello I tried to include the changes specified by Nicholas. We can switch between both Daemon and NoDaemon mode, using the option in ffserver.conf file. From 018f8c1e1acf062a9e6a3ec94f671d574ec4b712 Mon Sep 17 00:00:00 2001 From: Binathi binti...@gmail.com Date: Fri, 31 Oct 2014 23:27:20 +0530 Subject: [PATCH] Enable Daemon mode for FFServer Signed-off-by: Binathi binti...@gmail.com --- doc/ffserver.conf | 4 doc/ffserver.texi | 7 +-- ffserver.c| 31 +-- ffserver_config.c | 7 +-- ffserver_config.h | 1 + 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/doc/ffserver.conf b/doc/ffserver.conf index b756961..eac088b 100644 --- a/doc/ffserver.conf +++ b/doc/ffserver.conf @@ -25,6 +25,10 @@ MaxBandwidth 1000 # '-' is the standard output. CustomLog - +# Suppress Daemon if you don't want to launch ffserver in daemon mode. +#NoDaemon +Daemon + ## # Definition of the live feeds. Each live feed contains one video # and/or audio sequence coming from an ffmpeg encoder or another diff --git a/doc/ffserver.texi b/doc/ffserver.texi index 77273d2..15dc4b3 100644 --- a/doc/ffserver.texi +++ b/doc/ffserver.texi @@ -406,8 +406,11 @@ ignored, and the log is written to standard output. @item NoDaemon Set no-daemon mode. This option is currently ignored since now -@command{ffserver} will always work in no-daemon mode, and is -deprecated. +@command{ffserver} will always work in daemon mode. + +@ Daemon +Set daemon mode. +@command{ffserver} will always work in daemon mode. To enable no-daemon mode, suppress this and enable NoDaemon. @end table @section Feed section diff --git a/ffserver.c b/ffserver.c index ea2a2ae..d6eb0b4 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3671,6 +3671,7 @@ static void handle_child_exit(int sig) static void opt_debug(void) { config.debug = 1; +config.ffserver_daemon = 0; snprintf(config.logfilename, sizeof(config.logfilename), -); } @@ -3736,10 +3737,36 @@ int main(int argc, char **argv) build_feed_streams(); compute_bandwidth(); - + +if (config.ffserver_daemon) { +int ffserver_id = 0; +pid_t sid = 0; + +ffserver_id = fork(); + +if (ffserver_id 0) { +av_log(NULL, AV_LOG_WARNING, Fork failed!Couldn't launch ffserver in daemon mode.\n); +exit(1); +} + +if (ffserver_id 0) { +exit(0); +} + +sid = setsid(); +if (sid 0) { +exit(1); +} + +open (/dev/null, O_RDWR); + +if (strcmp(config.logfilename, -) != 0) { +close(1); +} +} /* signal init */ signal(SIGPIPE, SIG_IGN); - + if (http_server() 0) { http_log(Could not start server\n); exit(1); diff --git a/ffserver_config.c b/ffserver_config.c index e44cdf7..f46d8f4 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -358,8 +358,11 @@ static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(config-http_addr.sin_addr, arg) != 0) ERROR(%s:%d: Invalid host/IP address: %s\n, arg); -} else if (!av_strcasecmp(cmd, NoDaemon)) { -WARNING(NoDaemon option has no effect, you should remove it\n); +} else if (!av_strcasecmp(cmd, Daemon) || !av_strcasecmp(cmd, NoDaemon)) { +if (!av_strcasecmp(cmd, Daemon)) +config-ffserver_daemon = 1; +if (!av_strcasecmp(cmd, NoDaemon)) +config-ffserver_daemon = 0; } else if (!av_strcasecmp(cmd, RTSPPort)) { ffserver_get_arg(arg, sizeof(arg), p); val = atoi(arg); diff --git a/ffserver_config.h b/ffserver_config.h index 36d61d0..e3957b1 100644 --- a/ffserver_config.h +++ b/ffserver_config.h @@ -100,6 +100,7 @@ typedef struct FFServerConfig { unsigned int nb_max_http_connections; unsigned int nb_max_connections; uint64_t max_bandwidth; +int ffserver_daemon; int debug; char logfilename[1024]; struct sockaddr_in http_addr; -- 1.9.1 Binathi. On Thu, Oct 30, 2014 at 8:41 PM, Reynaldo H. Verdejo Pinochet reyna...@osg.samsung.com wrote: Hello On 10/30/2014 10:50 AM, Nicolas George wrote: [..] Third, I do not think this exact version is correct. If you make the daemon mode the default, then NoDaemon must not be ignored, it must have its specified effect: turn daemon off; if you do not make the daemon mode the default, then there must be an option to turn it on. IMHO, the best is to have both Daemon and NoDaemon mode. [..] I would prefer no-deamon mode been the default to not break current behavior till deamon-mode has had a good deal of production testing. I also think having a single Daemonize yes/no toggle should be enough but I'm OK either way in the context of this patch. Binathi: As an added bonus, try adding an -s to your commit command line so you get the Signed-off-by:
Re: [FFmpeg-devel] Discuss: Improved hardware acceleration support
On Fri, Oct 31, 2014 at 5:59 PM, wm4 nfx...@googlemail.com wrote: On Thu, 30 Oct 2014 20:31:17 -0500 Rodger Combs rodger.co...@gmail.com wrote: libavcodec currently has support for hardware-accelerated decoding, but no support for encoding, and libavcodec+libavfilter+ffmpeg provide no support for a decode-filter-encode pipeline that doesn't involve copying buffers back and forth from the video card and cutting out a significant amount of the gain provided by using hardware acceleration to begin with. It'd be useful to provide a way to leave buffers on the GPU when possible, and copy back and forth only when using a filter that can't be done on the GPU. Some filters could even be run without copying back and forth; for instance: scaling (for some scalers), overlays, cropping, drawtext/subtitles (the drawing component, anyway), deinterlacing, trim, and some post-processing could likely be done for a number of GPUs relatively easily, and others could likely also be done with additional work. This would probably require significant changes to AVFrame, various lavc/lavfi structs and APIs, and ffmpeg.c, but it could likely produce significant improvements in speed and power consumption when using systems that can support a full decode-filter-encode pipeline on the GPU. Thoughts on feasibility and/or implementation details? It would be pretty simple. Really? :) Every HW accel uses its own special format, how do you ever want to make lavfi be capable of handling those all? It would be a nightmare of HW-API specific stuff, and considering practically none of the software filtering code can be reused anyway, hardly worth trying to shoehorn that into lavfi anyway. All the pieces are already in place for an application to do this itself for the one or two HW APIs it cares about, however, just the generic case is an absolute nightmare. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Discuss: Improved hardware acceleration support
On Fri, 31 Oct 2014 19:06:28 +0100 Hendrik Leppkes h.lepp...@gmail.com wrote: On Fri, Oct 31, 2014 at 5:59 PM, wm4 nfx...@googlemail.com wrote: On Thu, 30 Oct 2014 20:31:17 -0500 Rodger Combs rodger.co...@gmail.com wrote: libavcodec currently has support for hardware-accelerated decoding, but no support for encoding, and libavcodec+libavfilter+ffmpeg provide no support for a decode-filter-encode pipeline that doesn't involve copying buffers back and forth from the video card and cutting out a significant amount of the gain provided by using hardware acceleration to begin with. It'd be useful to provide a way to leave buffers on the GPU when possible, and copy back and forth only when using a filter that can't be done on the GPU. Some filters could even be run without copying back and forth; for instance: scaling (for some scalers), overlays, cropping, drawtext/subtitles (the drawing component, anyway), deinterlacing, trim, and some post-processing could likely be done for a number of GPUs relatively easily, and others could likely also be done with additional work. This would probably require significant changes to AVFrame, various lavc/lavfi structs and APIs, and ffmpeg.c, but it could likely produce significant improvements in speed and power consumption when using systems that can support a full decode-filter-encode pipeline on the GPU. Thoughts on feasibility and/or implementation details? It would be pretty simple. Really? :) Every HW accel uses its own special format, how do you ever want to make lavfi be capable of handling those all? It would be a nightmare of HW-API specific stuff, and considering practically none of the software filtering code can be reused anyway, hardly worth trying to shoehorn that into lavfi anyway. All the pieces are already in place for an application to do this itself for the one or two HW APIs it cares about, however, just the generic case is an absolute nightmare. Of course these filters would be highly API-specific. Unifying them would probably not be possible on such a low level, and not all APIs are equally flexible. Whether it would be useful to add this to lavfi is another question. Maybe it would - it could save the application programmer some API-specific code, even if it still has to select and create the right filters per API. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] OPW Qualification Task: Enable daemon mode for FFserver
On Fri, Oct 31, 2014 at 11:32:37PM +0530, Binathi Bingi wrote: Hello I tried to include the changes specified by Nicholas. We can switch between both Daemon and NoDaemon mode, using the option in ffserver.conf file. From 018f8c1e1acf062a9e6a3ec94f671d574ec4b712 Mon Sep 17 00:00:00 2001 From: Binathi binti...@gmail.com Date: Fri, 31 Oct 2014 23:27:20 +0530 Subject: [PATCH] Enable Daemon mode for FFServer Signed-off-by: Binathi binti...@gmail.com --- doc/ffserver.conf | 4 doc/ffserver.texi | 7 +-- ffserver.c| 31 +-- ffserver_config.c | 7 +-- ffserver_config.h | 1 + 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/doc/ffserver.conf b/doc/ffserver.conf index b756961..eac088b 100644 --- a/doc/ffserver.conf +++ b/doc/ffserver.conf @@ -25,6 +25,10 @@ MaxBandwidth 1000 # '-' is the standard output. CustomLog - +# Suppress Daemon if you don't want to launch ffserver in daemon mode. +#NoDaemon +Daemon + ## # Definition of the live feeds. Each live feed contains one video # and/or audio sequence coming from an ffmpeg encoder or another diff --git a/doc/ffserver.texi b/doc/ffserver.texi index 77273d2..15dc4b3 100644 --- a/doc/ffserver.texi +++ b/doc/ffserver.texi @@ -406,8 +406,11 @@ ignored, and the log is written to standard output. @item NoDaemon Set no-daemon mode. This option is currently ignored since now -@command{ffserver} will always work in no-daemon mode, and is -deprecated. +@command{ffserver} will always work in daemon mode. + +@ Daemon +Set daemon mode. +@command{ffserver} will always work in daemon mode. To enable no-daemon mode, suppress this and enable NoDaemon. @end table it seems the patch has been mangled @section Feed section diff --git a/ffserver.c b/ffserver.c index ea2a2ae..d6eb0b4 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3671,6 +3671,7 @@ static void handle_child_exit(int sig) static void opt_debug(void) { config.debug = 1; +config.ffserver_daemon = 0; snprintf(config.logfilename, sizeof(config.logfilename), -); } @@ -3736,10 +3737,36 @@ int main(int argc, char **argv) build_feed_streams(); compute_bandwidth(); - + +if (config.ffserver_daemon) { +int ffserver_id = 0; +pid_t sid = 0; + +ffserver_id = fork(); there is something wrong with the indention here the code inside the if() probably should be indented by 4 more spaces + +if (ffserver_id 0) { +av_log(NULL, AV_LOG_WARNING, Fork failed!Couldn't launch ffserver in daemon mode.\n); IIRC Nicolas suggested to print the error corresponding to errno, that is not a fixed string. +exit(1); +} + +if (ffserver_id 0) { +exit(0); +} + +sid = setsid(); +if (sid 0) { +exit(1); +} + +open (/dev/null, O_RDWR); + +if (strcmp(config.logfilename, -) != 0) { +close(1); +} +} /* signal init */ signal(SIGPIPE, SIG_IGN); - + if (http_server() 0) { http_log(Could not start server\n); exit(1); diff --git a/ffserver_config.c b/ffserver_config.c index e44cdf7..f46d8f4 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -358,8 +358,11 @@ static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(config-http_addr.sin_addr, arg) != 0) ERROR(%s:%d: Invalid host/IP address: %s\n, arg); -} else if (!av_strcasecmp(cmd, NoDaemon)) { -WARNING(NoDaemon option has no effect, you should remove it\n); +} else if (!av_strcasecmp(cmd, Daemon) || !av_strcasecmp(cmd, NoDaemon)) { +if (!av_strcasecmp(cmd, Daemon)) +config-ffserver_daemon = 1; +if (!av_strcasecmp(cmd, NoDaemon)) +config-ffserver_daemon = 0; why the 2 level duplicated comparission, a simple addition of a check for Daemon should be simpler [...] 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
Re: [FFmpeg-devel] [PATCH] psy_snr:Psychoacoustic SNR for audio files
I notice you have tons of c++-isms you should check: On Thu, Oct 30, 2014 at 3:03 PM, Senjuti Kundu senjutikund...@gmail.com wrote: +int i = 0; +float* maskingfunc = malloc(tempsize*sizeof(float)); +maskingfunc[tempsize/2] = exp(-db_attenuation*log(10)); Split declaration and initialization, as explained on an earlier post. +int i = 0; +int j = 0; +float* mask = malloc(tempsize*sizeof(float)); +float self = 0; +float next = 0; +float prev = 0; Also here (and several other places) +DECLARE_ALIGNED(32, FFTComplex, fftcomplexa)[SIZE/len]; +DECLARE_ALIGNED(32, FFTComplex, fftcomplexb)[SIZE/len]; That len is a compile-time variable, not constant, as required by C for sizes. Just remove the /len, a buffer of SIZE complex values will always be bigger. Alternatively, you can use alloca. +FFTContext* fftcontexta = av_fft_init(floor(log2(SIZE/len)),0); +av_fft_permute (fftcontexta, fftcomplexa); +int temp = 0; +av_fft_calc (fftcontexta, fftcomplexa); +FFTContext* fftcontextb = av_fft_init(floor(log2(SIZE/len)),0); +av_fft_permute (fftcontextb, fftcomplexb); +av_fft_calc (fftcontextb, fftcomplexb); You don't need to initialize on every iteration. Move the av_fft_init outside the loops. Also, don't declare variables in the middle of blocks, that's C++. All declarations should go at the beginning of the enclosing block. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd/alsa: implement get_device_list callbacks
On 27.10.2014 23:12, Lukasz Marek wrote: On 26.10.2014 23:27, Michael Niedermayer wrote: +/* ported from alsa-utils/aplay.c */ +int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stream_type) +{ +int ret = 0; +void **hints, **n; +char *name = NULL, *descr = NULL, *io = NULL, *tmp; +AVDeviceInfo *new_device = NULL; +const char *filter = stream_type == SND_PCM_STREAM_PLAYBACK ? Output : Input; + +if (snd_device_name_hint(-1, pcm, hints) 0) +return AVERROR_EXTERNAL; +n = hints; +while (*n) { +tmp = snd_device_name_get_hint(*n, NAME); +name = av_strdup(tmp); +if (tmp !name) { +ret = AVERROR(ENOMEM); +goto fail; +} +free(tmp); +tmp = snd_device_name_get_hint(*n, DESC); +descr = av_strdup(tmp); +if (tmp !descr) { +ret = AVERROR(ENOMEM); +goto fail; +} +free(tmp); +tmp = snd_device_name_get_hint(*n, IOID); +io = av_strdup(tmp); +if (tmp !io) { +ret = AVERROR(ENOMEM); +goto fail; +} +free(tmp); doesnt mem leak in case of the goto fails ? i dont see where its freed I intended to free before ifs, but I'm a victim of routine... I noticed it can be done more clever anyway, so one more patch attached. Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavfi: add xbr filter
On Sat, Nov 01, 2014 at 04:27:24AM +0530, arwa arif wrote: On Fri, Oct 31, 2014 at 6:31 PM, Stefano Sabatini stefa...@gmail.com wrote: On date Friday 2014-10-31 01:36:46 +0530, arwa arif encoded: [...] From b9b56b594f856fef8b113b283df2d2045e8357f7 Mon Sep 17 00:00:00 2001 From: Arwa Arif arwaarif1...@gmail.com Date: Thu, 30 Oct 2014 22:06:20 +0530 Subject: [PATCH] [PATCH]lvafi: add xbr filter typo: lavfi: --- doc/filters.texi |5 + libavfilter/Makefile |1 + libavfilter/allfilters.c |1 + libavfilter/vf_xbr.c | 319 ++ 4 files changed, 326 insertions(+) create mode 100644 libavfilter/vf_xbr.c diff --git a/doc/filters.texi b/doc/filters.texi index 7be29de..2905e5d 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -9163,6 +9163,11 @@ Only deinterlace frames marked as interlaced. Default value is @samp{all}. @end table +@section xbr +Apply high-quality magnification filter which is designed for pixel art. It follows a set +of edge-detection rules @url{ http://www.libretro.com/forums/viewtopic.php?f=6t=134}. +This filter was originally created by Hyllian. + @anchor{yadif} @section yadif diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 6d868e7..2c56e38 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -198,6 +198,7 @@ OBJS-$(CONFIG_VIDSTABDETECT_FILTER) += vidstabutils.o vf_vidstabdetect. OBJS-$(CONFIG_VIDSTABTRANSFORM_FILTER) += vidstabutils.o vf_vidstabtransform.o OBJS-$(CONFIG_VIGNETTE_FILTER) += vf_vignette.o OBJS-$(CONFIG_W3FDIF_FILTER) += vf_w3fdif.o +OBJS-$(CONFIG_XBR_FILTER)+= vf_xbr.o OBJS-$(CONFIG_YADIF_FILTER) += vf_yadif.o OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index d88a9ad..2352d44 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -213,6 +213,7 @@ void avfilter_register_all(void) REGISTER_FILTER(VIDSTABTRANSFORM, vidstabtransform, vf); REGISTER_FILTER(VIGNETTE, vignette, vf); REGISTER_FILTER(W3FDIF, w3fdif, vf); +REGISTER_FILTER(XBR,xbr,vf); REGISTER_FILTER(YADIF, yadif, vf); REGISTER_FILTER(ZMQ,zmq,vf); REGISTER_FILTER(ZOOMPAN,zoompan,vf); diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c new file mode 100644 index 000..1a828d8 --- /dev/null +++ b/libavfilter/vf_xbr.c @@ -0,0 +1,319 @@ +/* + * This file is part of FFmpeg. + * + * Copyright (c) 2014 Arwa Arif arwaarif1...@gmail.com + * + * 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 + */ + +/** + * @file + * XBR Filter is used for depixelization of image. + * This is based on Hyllian's 2xBR shader. + * 2xBR Filter v0.2.5 + * @see : http://www.libretro.com/forums/viewtopic.php?f=6t=134 + * Future work : To implement x3 and x4 scale, and threading. + */ + +#include libavutil/opt.h +#include libavutil/avassert.h +#include libavutil/pixdesc.h +#include internal.h + +typedef struct { +uint32_t rgbtoyuv[124]; +} xBRContext; + +/** +* Calculates the weight of difference of the pixels, by transforming these +* pixels into their Y'UV parts. It then uses the threshold used by HQx filters: +* 48*Y + 7*U + 6*V, to give it those smooth looking edges. +**/ +static int d(AVFrame *in, int x1, int y1, int x2, int y2, const uint32_t *r2y) nit: use a more significant name, for example compute_diff() or diff() +{ + +#define YMASK 0xff +#define UMASK 0x00ff00 +#define VMASK 0xff + +int r1 = *(in-data[0] + y1 * in-linesize[0] + x1*3); +int g1 = *(in-data[0] + y1 * in-linesize[0] + x1*3 + 1); +int b1 = *(in-data[0] + y1 * in-linesize[0] + x1*3 + 2); + +int r2 = *(in-data[0] + y2 *
[FFmpeg-devel] [PATCH] configure: add -Werror=declaration-after-statement for gcc
Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 40d1f07..3322779 100755 --- a/configure +++ b/configure @@ -5227,6 +5227,7 @@ elif enabled gcc; then check_cflags -Werror=missing-prototypes check_cflags -Werror=return-type check_cflags -Werror=vla +check_cflags -Werror=declaration-after-statement check_cflags -Wformat enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized elif enabled llvm_gcc; then -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/4] ffserver_config: drop requirement video size being multiple of 16
Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- ffserver_config.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index d589ff2..f11db03 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -819,8 +819,6 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, ret = av_parse_video_size(w, h, arg); if (ret 0) ERROR(Invalid video size '%s'\n, arg); -else if ((w % 16) || (h % 16)) -ERROR(Image size must be a multiple of 16\n); if (av_dict_set_int(config-video_conf, VideoSizeWidth, w, 0) 0 || av_dict_set_int(config-video_conf, VideoSizeHeight, h, 0) 0) goto nomem; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/4] ffserver_config: drop presets support
Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- ffserver_config.c | 80 +-- ffserver_config.h | 2 -- 2 files changed, 1 insertion(+), 81 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index f11db03..6989bd8 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -252,61 +252,6 @@ static enum AVCodecID opt_codec(const char *name, enum AVMediaType type) return codec-id; } -static int ffserver_opt_default(const char *opt, const char *arg, - AVCodecContext *avctx, int type) -{ -int ret = 0; -const AVOption *o = av_opt_find(avctx, opt, NULL, type, 0); -if(o) -ret = av_opt_set(avctx, opt, arg, 0); -return ret; -} - -static int ffserver_opt_preset(const char *arg, - AVCodecContext *avctx, int type, - enum AVCodecID *audio_id, enum AVCodecID *video_id) -{ -FILE *f=NULL; -char filename[1000], tmp[1000], tmp2[1000], line[1000]; -int ret = 0; -AVCodec *codec = NULL; - -if (avctx) -codec = avcodec_find_encoder(avctx-codec_id); - -if (!(f = get_preset_file(filename, sizeof(filename), arg, 0, - codec ? codec-name : NULL))) { -fprintf(stderr, File for preset '%s' not found\n, arg); -return AVERROR(EINVAL); -} - -while(!feof(f)){ -int e= fscanf(f, %999[^\n]\n, line) - 1; -if(line[0] == '#' !e) -continue; -e|= sscanf(line, %999[^=]=%999[^\n]\n, tmp, tmp2) - 2; -if(e){ -fprintf(stderr, %s: Invalid syntax: '%s'\n, filename, line); -ret = AVERROR(EINVAL); -break; -} -if (audio_id !strcmp(tmp, acodec)) { -*audio_id = opt_codec(tmp2, AVMEDIA_TYPE_AUDIO); -} else if (video_id !strcmp(tmp, vcodec)){ -*video_id = opt_codec(tmp2, AVMEDIA_TYPE_VIDEO); -} else if(!strcmp(tmp, scodec)) { -/* opt_subtitle_codec(tmp2); */ -} else if (avctx (ret = ffserver_opt_default(tmp, tmp2, avctx, type)) 0) { -fprintf(stderr, %s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n, filename, line, tmp, tmp2); -break; -} -} - -fclose(f); - -return ret; -} - static AVOutputFormat *ffserver_guess_format(const char *short_name, const char *filename, const char *mime_type) { AVOutputFormat *fmt = av_guess_format(short_name, filename, mime_type); @@ -867,18 +812,7 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, goto nomem; } else if (!av_strcasecmp(cmd, AVPresetVideo) || !av_strcasecmp(cmd, AVPresetAudio)) { -char **preset = NULL; -ffserver_get_arg(arg, sizeof(arg), p); -if (!av_strcasecmp(cmd, AVPresetVideo)) { -preset = config-video_preset; -ffserver_opt_preset(arg, NULL, 0, NULL, config-video_id); -} else { -preset = config-audio_preset; -ffserver_opt_preset(arg, NULL, 0, config-audio_id, NULL); -} -*preset = av_strdup(arg); -if (!preset) -return AVERROR(ENOMEM); +WARNING(Preset options have no effect, you should remove it\n); } else if (!av_strcasecmp(cmd, VideoTag)) { ffserver_get_arg(arg, sizeof(arg), p); if (strlen(arg) == 4) { @@ -953,20 +887,12 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, if (stream-feed stream-fmt strcmp(stream-fmt-name, ffm) != 0) { if (config-audio_id != AV_CODEC_ID_NONE) { AVCodecContext *audio_enc = avcodec_alloc_context3(avcodec_find_encoder(config-audio_id)); -if (config-audio_preset -ffserver_opt_preset(arg, audio_enc, AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_ENCODING_PARAM, -NULL, NULL) 0) -ERROR(Could not apply preset '%s'\n, arg); if (ffserver_apply_stream_config(audio_enc, config-audio_conf, config-audio_opts) 0) config-errors++; add_codec(stream, audio_enc); } if (config-video_id != AV_CODEC_ID_NONE) { AVCodecContext *video_enc = avcodec_alloc_context3(avcodec_find_encoder(config-video_id)); -if (config-video_preset -ffserver_opt_preset(arg, video_enc, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_ENCODING_PARAM, -NULL, NULL) 0) -ERROR(Could not apply preset '%s'\n, arg); if (ffserver_apply_stream_config(video_enc, config-video_conf, config-video_opts) 0) config-errors++; add_codec(stream, video_enc); @@ -976,8 +902,6 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd,
[FFmpeg-devel] [PATCH 3/4] ffserver_config: improve error handling
Replace atoi with more advanced parsing routine. Set maximum port value to 65535 (not 65536). Other checks. Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- ffserver_config.c | 48 +++- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index 6989bd8..c694934 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -356,9 +356,7 @@ static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, if (!av_strcasecmp(cmd, Port)) WARNING(Port option is deprecated, use HTTPPort instead\n); ffserver_get_arg(arg, sizeof(arg), p); -val = atoi(arg); -if (val 1 || val 65536) -ERROR(Invalid port: %s\n, arg); +ffserver_set_int_param(val, arg, 0, 1, 65535, config, line_num, Invalid port: %s\n, arg); if (val 1024) WARNING(Trying to use IETF assigned system port: %d\n, val); config-http_addr.sin_port = htons(val); @@ -367,37 +365,38 @@ static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, WARNING(BindAddress option is deprecated, use HTTPBindAddress instead\n); ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(config-http_addr.sin_addr, arg) != 0) -ERROR(%s:%d: Invalid host/IP address: %s\n, arg); +ERROR(Invalid host/IP address: %s\n, arg); } else if (!av_strcasecmp(cmd, NoDaemon)) { WARNING(NoDaemon option has no effect, you should remove it\n); } else if (!av_strcasecmp(cmd, RTSPPort)) { ffserver_get_arg(arg, sizeof(arg), p); -val = atoi(arg); -if (val 1 || val 65536) -ERROR(%s:%d: Invalid port: %s\n, arg); -config-rtsp_addr.sin_port = htons(atoi(arg)); +ffserver_set_int_param(val, arg, 0, 1, 65535, config, line_num, Invalid port: %s\n, arg); +config-rtsp_addr.sin_port = htons(val); } else if (!av_strcasecmp(cmd, RTSPBindAddress)) { ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(config-rtsp_addr.sin_addr, arg) != 0) ERROR(Invalid host/IP address: %s\n, arg); } else if (!av_strcasecmp(cmd, MaxHTTPConnections)) { ffserver_get_arg(arg, sizeof(arg), p); -val = atoi(arg); -if (val 1 || val 65536) -ERROR(Invalid MaxHTTPConnections: %s\n, arg); +ffserver_set_int_param(val, arg, 0, 1, 65535, config, line_num, Invalid MaxHTTPConnections: %s\n, arg); config-nb_max_http_connections = val; +if (config-nb_max_connections config-nb_max_http_connections) +ERROR(Inconsistent configuration: MaxClients(%d) MaxHTTPConnections(%d)\n, + config-nb_max_connections, config-nb_max_http_connections); } else if (!av_strcasecmp(cmd, MaxClients)) { ffserver_get_arg(arg, sizeof(arg), p); -val = atoi(arg); -if (val 1 || val config-nb_max_http_connections) -ERROR(Invalid MaxClients: %s\n, arg); -else -config-nb_max_connections = val; +ffserver_set_int_param(val, arg, 0, 1, 65535, config, line_num, Invalid MaxClients: %s\n, arg); +config-nb_max_connections = val; +if (config-nb_max_connections config-nb_max_http_connections) +ERROR(Inconsistent configuration: MaxClients(%d) MaxHTTPConnections(%d)\n, + config-nb_max_connections, config-nb_max_http_connections); } else if (!av_strcasecmp(cmd, MaxBandwidth)) { int64_t llval; +char *tailp; ffserver_get_arg(arg, sizeof(arg), p); -llval = strtoll(arg, NULL, 10); -if (llval 10 || llval 1000) +errno = 0; +llval = strtoll(arg, tailp, 10); +if (llval 10 || llval 1000 || tailp[0] || errno) ERROR(Invalid MaxBandwidth: %s\n, arg); else config-max_bandwidth = llval; @@ -405,7 +404,7 @@ static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, if (!config-debug) ffserver_get_arg(config-logfilename, sizeof(config-logfilename), p); } else if (!av_strcasecmp(cmd, LoadModule)) { -ERROR(Loadable modules no longer supported\n); +ERROR(Loadable modules are no longer supported\n); } else ERROR(Incorrect keyword: '%s'\n, cmd); return 0; @@ -500,6 +499,9 @@ static int ffserver_parse_config_feed(FFServerConfig *config, const char *cmd, c case 'G': fsize *= 1024 * 1024 * 1024; break; +default: +ERROR(Invalid file size: %s\n, arg); +break; } feed-feed_max_size = (int64_t)fsize; if (feed-feed_max_size FFM_PACKET_SIZE*4) @@ -876,11 +878,15 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, stream-is_multicast = 1; stream-loop = 1;
[FFmpeg-devel] [PATCH 4/4] ffserver_config: dont pass pointer to enum as pointer to int
Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- ffserver_config.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index c694934..045b791 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -541,8 +541,11 @@ static int ffserver_apply_stream_config(AVCodecContext *enc, const AVDictionary ffserver_set_int_param(enc-width, e-value, 0, INT_MIN, INT_MAX, NULL, 0, NULL); if ((e = av_dict_get(conf, VideoSizeHeight, NULL, 0))) ffserver_set_int_param(enc-height, e-value, 0, INT_MIN, INT_MAX, NULL, 0, NULL); -if ((e = av_dict_get(conf, PixelFormat, NULL, 0))) -ffserver_set_int_param(enc-pix_fmt, e-value, 0, INT_MIN, INT_MAX, NULL, 0, NULL); +if ((e = av_dict_get(conf, PixelFormat, NULL, 0))) { +int val; +ffserver_set_int_param(val, e-value, 0, INT_MIN, INT_MAX, NULL, 0, NULL); +enc-pix_fmt = val; +} if ((e = av_dict_get(conf, VideoGopSize, NULL, 0))) ffserver_set_int_param(enc-gop_size, e-value, 0, INT_MIN, INT_MAX, NULL, 0, NULL); if ((e = av_dict_get(conf, VideoFrameRateNum, NULL, 0))) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] ffserver_config: dont pass pointer to enum as pointer to int
On Sat, Nov 01, 2014 at 03:00:55AM +0100, Lukasz Marek wrote: Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- ffserver_config.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Into a blind darkness they enter who follow after the Ignorance, they as if into a greater darkness enter who devote themselves to the Knowledge alone. -- Isha Upanishad signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel