Re: [FFmpeg-devel] [PATCH v3] Improved the performance of 1 decode + N filter graphs and adaptive bitrate.
> -Original Message- > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > Michael Niedermayer > Sent: Thursday, January 17, 2019 8:30 PM > To: FFmpeg development discussions and patches > Cc: Nicolas George > Subject: Re: [FFmpeg-devel] [PATCH v3] Improved the performance of 1 > decode + N filter graphs and adaptive bitrate. > > On Wed, Jan 16, 2019 at 04:17:07PM -0500, Shaofei Wang wrote: > > With new option "-abr_pipeline" > > It enabled multiple filter graph concurrency, which bring obove about > > 4%~20% improvement in some 1:N scenarios by CPU or GPU acceleration > > > > Below are some test cases and comparison as reference. > > (Hardware platform: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz) > > (Software: Intel iHD driver - 16.9.00100, CentOS 7) > > > > For 1:N transcode by GPU acceleration with vaapi: > > ./ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ > > -hwaccel_output_format vaapi \ > > -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > > -vf "scale_vaapi=1280:720" -c:v h264_vaapi -f null /dev/null \ > > -vf "scale_vaapi=720:480" -c:v h264_vaapi -f null /dev/null \ > > -abr_pipeline > > > > test results: > > 2 encoders 5 encoders 10 encoders > > Improved 6.1%6.9% 5.5% > > > > For 1:N transcode by GPU acceleration with QSV: > > ./ffmpeg -hwaccel qsv -c:v h264_qsv \ > > -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > > -vf "scale_qsv=1280:720:format=nv12" -c:v h264_qsv -f null /dev/null > \ > > -vf "scale_qsv=720:480:format=nv12" -c:v h264_qsv -f null > > /dev/null > > > > test results: > > 2 encoders 5 encoders 10 encoders > > Improved 6% 4% 15% > > > > For Intel GPU acceleration case, 1 decode to N scaling, by QSV: > > ./ffmpeg -hwaccel qsv -c:v h264_qsv \ > > -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > > -vf "scale_qsv=1280:720:format=nv12,hwdownload" -pix_fmt nv12 -f > null /dev/null \ > > -vf "scale_qsv=720:480:format=nv12,hwdownload" -pix_fmt nv12 -f > > null /dev/null > > > > test results: > > 2 scale 5 scale 10 scale > > Improved 12% 21%21% > > > > For CPU only 1 decode to N scaling: > > ./ffmpeg -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > > -vf "scale=1280:720" -pix_fmt nv12 -f null /dev/null \ > > -vf "scale=720:480" -pix_fmt nv12 -f null /dev/null \ > > -abr_pipeline > > > > test results: > > 2 scale 5 scale 10 scale > > Improved 25%107% 148% > > > > Signed-off-by: Wang, Shaofei > > Reviewed-by: Zhao, Jun > > --- > > fftools/ffmpeg.c| 228 > > > fftools/ffmpeg.h| 15 > > fftools/ffmpeg_filter.c | 4 + > > fftools/ffmpeg_opt.c| 6 +- > > 4 files changed, 237 insertions(+), 16 deletions(-) > > Looking at this i see alot of duplicated code and alot of ifdefs Since I didn't want to change the function interface of reap_filters(), a none-loop reap function generated. Will change it base on the reap_filters() to avoid duplicated lines in the next patch. > Preferably one codepath when possible, and best results by default no need to > manually enable the fast path. If disable/enable the fast path option is not needed for users, i'll remove it. But before that, there are some reasons: 1. it provide more choice for user to decide whether to use it depend on their cases, otherwise we need to implement the 'strategies' for users to decide when to enable/disable the fast path. 2. it's easy to compare the result to make sure which is the best Thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] avformat/dashenc: Format xs:datetime in millisecond precision
On 1/17/19 2:35 PM, Karthick J wrote: > For low latency streaming even milliseconds matter! > --- > libavformat/dashenc.c | 15 --- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c > index cfd0f601d4..9c90cf17e5 100644 > --- a/libavformat/dashenc.c > +++ b/libavformat/dashenc.c > @@ -32,6 +32,7 @@ > #include "libavutil/mathematics.h" > #include "libavutil/opt.h" > #include "libavutil/rational.h" > +#include "libavutil/time.h" > #include "libavutil/time_internal.h" > > #include "avc.h" > @@ -668,12 +669,20 @@ static void write_time(AVIOContext *out, int64_t time) > > static void format_date_now(char *buf, int size) > { > -time_t t = time(NULL); > struct tm *ptm, tmbuf; > -ptm = gmtime_r(&t, &tmbuf); > +int64_t time_us = av_gettime(); > +int64_t time_ms = time_us / 1000; > +const time_t time_s = time_ms / 1000; > +int millisec = time_ms - (time_s * 1000); > +ptm = gmtime_r(&time_s, &tmbuf); > if (ptm) { > -if (!strftime(buf, size, "%Y-%m-%dT%H:%M:%SZ", ptm)) > +int len; > +if (!strftime(buf, size, "%Y-%m-%dT%H:%M:%S", ptm)) { > buf[0] = '\0'; > +return; > +} > +len = strlen(buf); > +snprintf(buf + len, size - len, ".%03dZ", millisec); > } > } > Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avcodec/mips: [loongson] optimize put_hevc_qpel_bi_hv_8 with mmi.
Optimize put_hevc_qpel_bi_hv_8 with mmi in the case width=4/8/12/16/24/32/48/64. This optimization improved HEVC decoding performance 11.4%(2.01x to 2.24x, tested on loongson 3A3000). --- libavcodec/mips/hevcdsp_init_mips.c | 9 ++ libavcodec/mips/hevcdsp_mips.h | 12 +- libavcodec/mips/hevcdsp_mmi.c | 229 3 files changed, 249 insertions(+), 1 deletion(-) diff --git a/libavcodec/mips/hevcdsp_init_mips.c b/libavcodec/mips/hevcdsp_init_mips.c index e5e0588..18d97d9 100644 --- a/libavcodec/mips/hevcdsp_init_mips.c +++ b/libavcodec/mips/hevcdsp_init_mips.c @@ -34,6 +34,15 @@ static av_cold void hevc_dsp_init_mmi(HEVCDSPContext *c, c->put_hevc_qpel[8][1][1] = ff_hevc_put_hevc_qpel_hv48_8_mmi; c->put_hevc_qpel[9][1][1] = ff_hevc_put_hevc_qpel_hv64_8_mmi; +c->put_hevc_qpel_bi[1][1][1] = ff_hevc_put_hevc_qpel_bi_hv4_8_mmi; +c->put_hevc_qpel_bi[3][1][1] = ff_hevc_put_hevc_qpel_bi_hv8_8_mmi; +c->put_hevc_qpel_bi[4][1][1] = ff_hevc_put_hevc_qpel_bi_hv12_8_mmi; +c->put_hevc_qpel_bi[5][1][1] = ff_hevc_put_hevc_qpel_bi_hv16_8_mmi; +c->put_hevc_qpel_bi[6][1][1] = ff_hevc_put_hevc_qpel_bi_hv24_8_mmi; +c->put_hevc_qpel_bi[7][1][1] = ff_hevc_put_hevc_qpel_bi_hv32_8_mmi; +c->put_hevc_qpel_bi[8][1][1] = ff_hevc_put_hevc_qpel_bi_hv48_8_mmi; +c->put_hevc_qpel_bi[9][1][1] = ff_hevc_put_hevc_qpel_bi_hv64_8_mmi; + c->put_hevc_qpel_bi[3][0][0] = ff_hevc_put_hevc_pel_bi_pixels8_8_mmi; c->put_hevc_qpel_bi[5][0][0] = ff_hevc_put_hevc_pel_bi_pixels16_8_mmi; c->put_hevc_qpel_bi[6][0][0] = ff_hevc_put_hevc_pel_bi_pixels24_8_mmi; diff --git a/libavcodec/mips/hevcdsp_mips.h b/libavcodec/mips/hevcdsp_mips.h index 2351c9b..9f1e447 100644 --- a/libavcodec/mips/hevcdsp_mips.h +++ b/libavcodec/mips/hevcdsp_mips.h @@ -502,7 +502,7 @@ void ff_hevc_put_hevc_##PEL##_bi_##DIR##WIDTH##_8_##TYPE(uint8_t *dst, ptrdiff_t dst_stride, \ uint8_t *src, \ ptrdiff_t src_stride, \ - int16_t *src_16bit, \ + int16_t *src2, \ int height, \ intptr_t mx, \ intptr_t my, \ @@ -514,5 +514,15 @@ L_BI_MC(pel, pixels, 24, mmi); L_BI_MC(pel, pixels, 32, mmi); L_BI_MC(pel, pixels, 48, mmi); L_BI_MC(pel, pixels, 64, mmi); + +L_BI_MC(qpel, hv, 4, mmi); +L_BI_MC(qpel, hv, 8, mmi); +L_BI_MC(qpel, hv, 12, mmi); +L_BI_MC(qpel, hv, 16, mmi); +L_BI_MC(qpel, hv, 24, mmi); +L_BI_MC(qpel, hv, 32, mmi); +L_BI_MC(qpel, hv, 48, mmi); +L_BI_MC(qpel, hv, 64, mmi); + #undef L_BI_MC #endif // #ifndef AVCODEC_MIPS_HEVCDSP_MIPS_H diff --git a/libavcodec/mips/hevcdsp_mmi.c b/libavcodec/mips/hevcdsp_mmi.c index e776a13..727a718 100644 --- a/libavcodec/mips/hevcdsp_mmi.c +++ b/libavcodec/mips/hevcdsp_mmi.c @@ -217,6 +217,235 @@ PUT_HEVC_QPEL_HV(32, 8, -32, -64); PUT_HEVC_QPEL_HV(48, 12, -48, -96); PUT_HEVC_QPEL_HV(64, 16, -64, -128); +#define PUT_HEVC_QPEL_BI_HV(w, x_step, src_step, src2_step, dst_step) \ +void ff_hevc_put_hevc_qpel_bi_hv##w##_8_mmi(uint8_t *_dst, \ +ptrdiff_t _dststride, \ +uint8_t *_src, \ +ptrdiff_t _srcstride, \ +int16_t *src2, int height, \ +intptr_t mx, intptr_t my, \ +int width) \ +{ \ +int x, y; \ +const int8_t *filter; \ +pixel *src = (pixel*)_src; \ +ptrdiff_t srcstride = _srcstride / sizeof(pixel); \ +pixel *dst = (pixel *)_dst;\ +ptrdiff_t dststride = _dststride / sizeof(pixel); \ +int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE];\ +int16_t *tmp = tmp_array; \ +uint64_t ftmp[20]; \ +uint64_t rtmp[1]; \ +int shift = 7; \ +int offset = 64;\ +
[FFmpeg-devel] [PATCH 1/2] avcodec/mips: [loongson] optimize put_hevc_qpel_hv_8 with mmi.
Optimize put_hevc_qpel_hv_8 with mmi in the case width=4/8/12/16/24/32/48/64. This optimization improved HEVC decoding performance 11%(1.81x to 2.01x, tested on loongson 3A3000). --- libavcodec/mips/hevcdsp_init_mips.c | 9 ++ libavcodec/mips/hevcdsp_mips.h | 37 +-- libavcodec/mips/hevcdsp_mmi.c | 195 libavutil/mips/mmiutils.h | 9 ++ 4 files changed, 240 insertions(+), 10 deletions(-) diff --git a/libavcodec/mips/hevcdsp_init_mips.c b/libavcodec/mips/hevcdsp_init_mips.c index 41c9001..e5e0588 100644 --- a/libavcodec/mips/hevcdsp_init_mips.c +++ b/libavcodec/mips/hevcdsp_init_mips.c @@ -25,6 +25,15 @@ static av_cold void hevc_dsp_init_mmi(HEVCDSPContext *c, const int bit_depth) { if (8 == bit_depth) { +c->put_hevc_qpel[1][1][1] = ff_hevc_put_hevc_qpel_hv4_8_mmi; +c->put_hevc_qpel[3][1][1] = ff_hevc_put_hevc_qpel_hv8_8_mmi; +c->put_hevc_qpel[4][1][1] = ff_hevc_put_hevc_qpel_hv12_8_mmi; +c->put_hevc_qpel[5][1][1] = ff_hevc_put_hevc_qpel_hv16_8_mmi; +c->put_hevc_qpel[6][1][1] = ff_hevc_put_hevc_qpel_hv24_8_mmi; +c->put_hevc_qpel[7][1][1] = ff_hevc_put_hevc_qpel_hv32_8_mmi; +c->put_hevc_qpel[8][1][1] = ff_hevc_put_hevc_qpel_hv48_8_mmi; +c->put_hevc_qpel[9][1][1] = ff_hevc_put_hevc_qpel_hv64_8_mmi; + c->put_hevc_qpel_bi[3][0][0] = ff_hevc_put_hevc_pel_bi_pixels8_8_mmi; c->put_hevc_qpel_bi[5][0][0] = ff_hevc_put_hevc_pel_bi_pixels16_8_mmi; c->put_hevc_qpel_bi[6][0][0] = ff_hevc_put_hevc_pel_bi_pixels24_8_mmi; diff --git a/libavcodec/mips/hevcdsp_mips.h b/libavcodec/mips/hevcdsp_mips.h index ff9401c..2351c9b 100644 --- a/libavcodec/mips/hevcdsp_mips.h +++ b/libavcodec/mips/hevcdsp_mips.h @@ -480,16 +480,33 @@ void ff_hevc_addblk_32x32_msa(uint8_t *dst, int16_t *pi16Coeffs, void ff_hevc_idct_luma_4x4_msa(int16_t *pi16Coeffs); /* Loongson optimization */ -#define L_BI_MC(PEL, DIR, WIDTH, TYPE) \ -void ff_hevc_put_hevc_##PEL##_bi_##DIR##WIDTH##_8_##TYPE(uint8_t *dst, \ -ptrdiff_t dst_stride, \ -uint8_t *src, \ -ptrdiff_t src_stride, \ -int16_t *src_16bit, \ -int height, \ -intptr_t mx, \ -intptr_t my, \ -int width) +#define L_MC(PEL, DIR, WIDTH, TYPE) \ +void ff_hevc_put_hevc_##PEL##_##DIR##WIDTH##_8_##TYPE(int16_t *dst, \ + uint8_t *src, \ + ptrdiff_t src_stride, \ + int height,\ + intptr_t mx, \ + intptr_t my, \ + int width) +L_MC(qpel, hv, 4, mmi); +L_MC(qpel, hv, 8, mmi); +L_MC(qpel, hv, 12, mmi); +L_MC(qpel, hv, 16, mmi); +L_MC(qpel, hv, 24, mmi); +L_MC(qpel, hv, 32, mmi); +L_MC(qpel, hv, 48, mmi); +L_MC(qpel, hv, 64, mmi); + +#define L_BI_MC(PEL, DIR, WIDTH, TYPE) \ +void ff_hevc_put_hevc_##PEL##_bi_##DIR##WIDTH##_8_##TYPE(uint8_t *dst, \ + ptrdiff_t dst_stride, \ + uint8_t *src, \ + ptrdiff_t src_stride, \ + int16_t *src_16bit, \ + int height, \ + intptr_t mx, \ + intptr_t my, \ + int width) L_BI_MC(pel, pixels, 8, mmi); L_BI_MC(pel, pixels, 16, mmi); diff --git a/libavcodec/mips/hevcdsp_mmi.c b/libavcodec/mips/hevcdsp_mmi.c index 60b9c18..e776a13 100644 --- a/libavcodec/mips/hevcdsp_mmi.c +++ b/libavcodec/mips/hevcdsp_mmi.c @@ -18,10 +18,205 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavcodec/hevcdec.h" #include "libavcodec/bit_depth_template.c" #include "libavcodec/mips/hevcdsp_mips.h" #include "libavutil/mips/mmiutils.h" +#define PUT_HEVC_QPEL_HV(w
[FFmpeg-devel] [PATCH 2/5] lavc/qsvdec: Replace current parser with MFXVideoDECODE_DecodeHeader()
Using MSDK parser can improve qsv decoder pass rate in some cases (E.g: sps declares a wrong level_idc, smaller than it should be). And it is necessary for adding new qsv decoders such as MJPEG and VP9 since current parser can't provide enough information. Actually using MFXVideoDECODE_DecodeHeader() was disscussed at https://ffmpeg.org/pipermail/ffmpeg-devel/2015-July/175734.html and merged as commit 1acb19d, but was overwritten when merged libav patches (commit: 1f26a23) without any explain. Signed-off-by: Zhong Li --- libavcodec/qsvdec.c | 103 libavcodec/qsvdec.h | 2 + 2 files changed, 33 insertions(+), 72 deletions(-) diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 4a0be81..013400b 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -120,7 +120,7 @@ static inline unsigned int qsv_fifo_size(const AVFifoBuffer* fifo) return av_fifo_size(fifo) / qsv_fifo_item_size(); } -static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q) +static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q, AVPacket *avpkt) { const AVPixFmtDescriptor *desc; mfxSession session = NULL; @@ -129,6 +129,17 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q) int frame_width = avctx->coded_width; int frame_height = avctx->coded_height; int ret; +mfxBitstream bs = { { { 0 } } }; + +if (avpkt->size) { +bs.Data = avpkt->data; +bs.DataLength = avpkt->size; +bs.MaxLength = bs.DataLength; +bs.TimeStamp = avpkt->pts; +if (avctx->field_order == AV_FIELD_PROGRESSIVE) +bs.DataFlag |= MFX_BITSTREAM_COMPLETE_FRAME; +} else +return AVERROR_INVALIDDATA; desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt); if (!desc) @@ -174,32 +185,19 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q) if (ret < 0) return ret; -param.mfx.CodecId = ret; -param.mfx.CodecProfile = ff_qsv_profile_to_mfx(avctx->codec_id, avctx->profile); -param.mfx.CodecLevel = avctx->level == FF_LEVEL_UNKNOWN ? MFX_LEVEL_UNKNOWN : avctx->level; - -param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; -param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; -param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8; -param.mfx.FrameInfo.FourCC = q->fourcc; -param.mfx.FrameInfo.Width = frame_width; -param.mfx.FrameInfo.Height = frame_height; -param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; - -switch (avctx->field_order) { -case AV_FIELD_PROGRESSIVE: -param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; -break; -case AV_FIELD_TT: -param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_FIELD_TFF; -break; -case AV_FIELD_BB: -param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_FIELD_BFF; -break; -default: -param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_UNKNOWN; -break; -} +param.mfx.CodecId = ret; +ret = MFXVideoDECODE_DecodeHeader(q->session, &bs, ¶m); +if (ret < 0) +return ff_qsv_print_error(avctx, ret, +"Error decoding stream header"); + +avctx->width= param.mfx.FrameInfo.CropW; +avctx->height = param.mfx.FrameInfo.CropH; +avctx->coded_width = param.mfx.FrameInfo.Width; +avctx->coded_height = param.mfx.FrameInfo.Height; +avctx->level= param.mfx.CodecProfile; +avctx->profile = param.mfx.CodecLevel; +avctx->field_order = ff_qsv_map_picstruct(param.mfx.FrameInfo.PicStruct); param.IOPattern = q->iopattern; param.AsyncDepth = q->async_depth; @@ -521,62 +519,22 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, pkt->data, pkt->size, pkt->pts, pkt->dts, pkt->pos); -avctx->field_order = q->parser->field_order; /* TODO: flush delayed frames on reinit */ -if (q->parser->format != q->orig_pix_fmt|| -FFALIGN(q->parser->coded_width, 16) != FFALIGN(avctx->coded_width, 16) || -FFALIGN(q->parser->coded_height, 16) != FFALIGN(avctx->coded_height, 16)) { + +if (!q->initialized){ enum AVPixelFormat pix_fmts[3] = { AV_PIX_FMT_QSV, - AV_PIX_FMT_NONE, + AV_PIX_FMT_NV12, AV_PIX_FMT_NONE }; -enum AVPixelFormat qsv_format; -AVPacket zero_pkt = {0}; - -if (q->buffered_count) { -q->reinit_flag = 1; -/* decode zero-size pkt to flush the buffered pkt before reinit */ -q->buffered_count--; -return qsv_decode(avctx, q, frame, got_frame, &zero_pkt); -} - -q->reinit_flag = 0; - -qsv_format = ff_qsv_map_pixfmt(q->parser->format, &q->fourcc)
[FFmpeg-devel] [PATCH 1/5] lavc/qsvdec: add function ff_qsv_map_picstruct()
Signed-off-by: Zhong Li --- libavcodec/qsv.c | 18 ++ libavcodec/qsv_internal.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index bb0d795..224bc00 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -196,6 +196,24 @@ int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame) return AVERROR_BUG; } +enum AVFieldOrder ff_qsv_map_picstruct(int mfx_pic_struct) +{ +enum AVFieldOrder field = AV_FIELD_UNKNOWN; +switch (mfx_pic_struct & 0xF) { +case MFX_PICSTRUCT_PROGRESSIVE: +field = AV_FIELD_PROGRESSIVE; +break; +case MFX_PICSTRUCT_FIELD_TFF: +field = AV_FIELD_TT; +break; +case MFX_PICSTRUCT_FIELD_BFF: +field = AV_FIELD_BB; +break; +} + +return field; +} + enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type) { enum AVPictureType type; diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h index 394c558..51c23d5 100644 --- a/libavcodec/qsv_internal.h +++ b/libavcodec/qsv_internal.h @@ -94,6 +94,8 @@ int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile); int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc); enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type); +enum AVFieldOrder ff_qsv_map_picstruct(int mfx_pic_struct); + int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession *session, const char *load_plugins); -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/5] lavc/qsvdec: Add mjpeg decoder support
Signed-off-by: Zhong Li --- Changelog | 1 + configure | 1 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c| 1 + libavcodec/qsvdec_other.c | 28 +++- 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 422d84e..bf76613 100644 --- a/Changelog +++ b/Changelog @@ -14,6 +14,7 @@ version : - vividas demuxer - hymt decoder - anlmdn filter +- Intel QSV-accelerated MJPEG decoding version 4.1: diff --git a/configure b/configure index 946f534..ac71ecf 100755 --- a/configure +++ b/configure @@ -2981,6 +2981,7 @@ hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m" hevc_v4l2m2m_decoder_select="hevc_mp4toannexb_bsf" hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m" mjpeg_cuvid_decoder_deps="cuvid" +mjpeg_qsv_decoder_select="qsvdec" mjpeg_qsv_encoder_deps="libmfx" mjpeg_qsv_encoder_select="qsvenc" mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 99799ce..df5912c 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -421,6 +421,7 @@ OBJS-$(CONFIG_METASOUND_DECODER) += metasound.o metasound_data.o \ OBJS-$(CONFIG_MICRODVD_DECODER)+= microdvddec.o ass.o OBJS-$(CONFIG_MIMIC_DECODER) += mimic.o OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o +OBJS-$(CONFIG_MJPEG_QSV_DECODER) += qsvdec_other.o OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpegenc_common.o \ mjpegenc_huffman.o OBJS-$(CONFIG_MJPEGB_DECODER) += mjpegbdec.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 4755af7..32cca0c 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -756,6 +756,7 @@ extern AVCodec ff_hevc_videotoolbox_encoder; extern AVCodec ff_libkvazaar_encoder; extern AVCodec ff_mjpeg_cuvid_decoder; extern AVCodec ff_mjpeg_qsv_encoder; +extern AVCodec ff_mjpeg_qsv_decoder; extern AVCodec ff_mjpeg_vaapi_encoder; extern AVCodec ff_mpeg1_cuvid_decoder; extern AVCodec ff_mpeg2_cuvid_decoder; diff --git a/libavcodec/qsvdec_other.c b/libavcodec/qsvdec_other.c index 03251d2..ba490d4 100644 --- a/libavcodec/qsvdec_other.c +++ b/libavcodec/qsvdec_other.c @@ -1,5 +1,5 @@ /* - * Intel MediaSDK QSV based MPEG-2, VC-1 and VP8 decoders + * Intel MediaSDK QSV based MPEG-2, VC-1, VP8 and MJPEG decoders * * copyright (c) 2015 Anton Khirnov * @@ -255,3 +255,29 @@ AVCodec ff_vp8_qsv_decoder = { .wrapper_name = "qsv", }; #endif + +#if CONFIG_MJPEG_QSV_DECODER +static const AVClass mjpeg_qsv_class = { +.class_name = "mjpeg_qsv", +.item_name = av_default_item_name, +.option = options, +.version= LIBAVUTIL_VERSION_INT, +}; + +AVCodec ff_mjpeg_qsv_decoder = { +.name = "mjpeg_qsv", +.long_name = NULL_IF_CONFIG_SMALL("MJPEG video (Intel Quick Sync Video acceleration)"), +.priv_data_size = sizeof(QSVOtherContext), +.type = AVMEDIA_TYPE_VIDEO, +.id = AV_CODEC_ID_MJPEG, +.init = qsv_decode_init, +.decode = qsv_decode_frame, +.flush = qsv_decode_flush, +.close = qsv_decode_close, +.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HYBRID, +.priv_class = &mjpeg_qsv_class, +.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, +AV_PIX_FMT_QSV, +AV_PIX_FMT_NONE }, +}; +#endif -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/5] lavc/qsvdec: remove orignal parser code since not needed now
Signed-off-by: Zhong Li --- configure | 10 +- libavcodec/qsvdec.c | 16 +--- libavcodec/qsvdec.h | 2 -- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/configure b/configure index c2b8fac..946f534 100755 --- a/configure +++ b/configure @@ -2957,7 +2957,7 @@ h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser" h264_mmal_decoder_deps="mmal" h264_nvenc_encoder_deps="nvenc" h264_omx_encoder_deps="omx" -h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec" +h264_qsv_decoder_select="h264_mp4toannexb_bsf qsvdec" h264_qsv_encoder_select="qsvenc" h264_rkmpp_decoder_deps="rkmpp" h264_rkmpp_decoder_select="h264_mp4toannexb_bsf" @@ -2971,7 +2971,7 @@ hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf" hevc_mediacodec_decoder_deps="mediacodec" hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser" hevc_nvenc_encoder_deps="nvenc" -hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec" +hevc_qsv_decoder_select="hevc_mp4toannexb_bsf qsvdec" hevc_qsv_encoder_select="hevcparse qsvenc" hevc_rkmpp_decoder_deps="rkmpp" hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf" @@ -2991,7 +2991,7 @@ mpeg2_crystalhd_decoder_select="crystalhd" mpeg2_cuvid_decoder_deps="cuvid" mpeg2_mmal_decoder_deps="mmal" mpeg2_mediacodec_decoder_deps="mediacodec" -mpeg2_qsv_decoder_select="qsvdec mpegvideo_parser" +mpeg2_qsv_decoder_select="qsvdec" mpeg2_qsv_encoder_select="qsvenc" mpeg2_vaapi_encoder_select="cbs_mpeg2 vaapi_encode" mpeg2_v4l2m2m_decoder_deps="v4l2_m2m mpeg2_v4l2_m2m" @@ -3008,11 +3008,11 @@ nvenc_hevc_encoder_select="hevc_nvenc_encoder" vc1_crystalhd_decoder_select="crystalhd" vc1_cuvid_decoder_deps="cuvid" vc1_mmal_decoder_deps="mmal" -vc1_qsv_decoder_select="qsvdec vc1_parser" +vc1_qsv_decoder_select="qsvdec" vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m" vp8_cuvid_decoder_deps="cuvid" vp8_mediacodec_decoder_deps="mediacodec" -vp8_qsv_decoder_select="qsvdec vp8_parser" +vp8_qsv_decoder_select="qsvdec" vp8_rkmpp_decoder_deps="rkmpp" vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8" vp8_vaapi_encoder_select="vaapi_encode" diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 013400b..2f7a4bd 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -474,7 +474,6 @@ int ff_qsv_decode_close(QSVContext *q) av_fifo_free(q->async_fifo); q->async_fifo = NULL; -av_parser_close(q->parser); avcodec_free_context(&q->avctx_internal); if (q->internal_session) @@ -500,25 +499,12 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, return AVERROR(ENOMEM); q->avctx_internal->codec_id = avctx->codec_id; - -q->parser = av_parser_init(avctx->codec_id); -if (!q->parser) -return AVERROR(ENOMEM); - -q->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES; q->orig_pix_fmt = AV_PIX_FMT_NONE; } if (!pkt->size) return qsv_decode(avctx, q, frame, got_frame, pkt); -/* we assume the packets are already split properly and want - * just the codec parameters here */ -av_parser_parse2(q->parser, q->avctx_internal, - &dummy_data, &dummy_size, - pkt->data, pkt->size, pkt->pts, pkt->dts, - pkt->pos); - /* TODO: flush delayed frames on reinit */ if (!q->initialized){ @@ -540,7 +526,7 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, return qsv_decode(avctx, q, frame, got_frame, pkt); reinit_fail: -q->orig_pix_fmt = q->parser->format = avctx->pix_fmt = AV_PIX_FMT_NONE; +q->orig_pix_fmt = avctx->pix_fmt = AV_PIX_FMT_NONE; return ret; } diff --git a/libavcodec/qsvdec.h b/libavcodec/qsvdec.h index 4812fb2..8e64839 100644 --- a/libavcodec/qsvdec.h +++ b/libavcodec/qsvdec.h @@ -56,8 +56,6 @@ typedef struct QSVContext { int buffered_count; int reinit_flag; -// the internal parser and codec context for parsing the data -AVCodecParserContext *parser; AVCodecContext *avctx_internal; enum AVPixelFormat orig_pix_fmt; uint32_t fourcc; -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 0/5] Refact qsv decoder parser and add new decoders
Replace current parser with MFXVideoDECODE_DecodeHeader(), and add MJPEG/VP9 decoders. Zhong Li (5): lavc/qsvdec: add function ff_qsv_map_picstruct() lavc/qsvdec: Replace current parser with MFXVideoDECODE_DecodeHeader() lavc/qsvdec: remove orignal parser code since not needed now lavc/qsvdec: Add mjpeg decoder support lavc/qsvdec: Add VP9 decoder support Changelog | 2 + configure | 12 +++-- libavcodec/Makefile | 1 + libavcodec/allcodecs.c| 2 + libavcodec/qsv.c | 23 + libavcodec/qsv_internal.h | 2 + libavcodec/qsvdec.c | 119 +- libavcodec/qsvdec.h | 4 +- libavcodec/qsvdec_other.c | 72 ++-- 9 files changed, 140 insertions(+), 97 deletions(-) -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 5/5] lavc/qsvdec: Add VP9 decoder support
VP9 decoder is support on Intel kabyLake+ platforms with MSDK Version 1.19+ Signed-off-by: Zhong Li --- Changelog | 1 + configure | 1 + libavcodec/allcodecs.c| 1 + libavcodec/qsv.c | 5 + libavcodec/qsvdec_other.c | 46 +++--- 5 files changed, 51 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index bf76613..053c551 100644 --- a/Changelog +++ b/Changelog @@ -15,6 +15,7 @@ version : - hymt decoder - anlmdn filter - Intel QSV-accelerated MJPEG decoding +- Intel QSV-accelerated VP9 decoding version 4.1: diff --git a/configure b/configure index ac71ecf..d81bbb9 100755 --- a/configure +++ b/configure @@ -3021,6 +3021,7 @@ vp8_v4l2m2m_decoder_deps="v4l2_m2m vp8_v4l2_m2m" vp8_v4l2m2m_encoder_deps="v4l2_m2m vp8_v4l2_m2m" vp9_cuvid_decoder_deps="cuvid" vp9_mediacodec_decoder_deps="mediacodec" +vp9_qsv_decoder_select="qsvdec" vp9_rkmpp_decoder_deps="rkmpp" vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9" vp9_vaapi_encoder_select="vaapi_encode" diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 32cca0c..3bccfed 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -773,6 +773,7 @@ extern AVCodec ff_vp8_v4l2m2m_encoder; extern AVCodec ff_vp8_vaapi_encoder; extern AVCodec ff_vp9_cuvid_decoder; extern AVCodec ff_vp9_mediacodec_decoder; +extern AVCodec ff_vp9_qsv_decoder; extern AVCodec ff_vp9_vaapi_encoder; // The iterate API is not usable with ossfuzz due to the excessive size of binaries created diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 224bc00..dface37 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -60,6 +60,11 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id) #endif case AV_CODEC_ID_MJPEG: return MFX_CODEC_JPEG; +#if QSV_VERSION_ATLEAST(1, 19) +case AV_CODEC_ID_VP9: +return MFX_CODEC_VP9; +#endif + default: break; } diff --git a/libavcodec/qsvdec_other.c b/libavcodec/qsvdec_other.c index ba490d4..3caf295 100644 --- a/libavcodec/qsvdec_other.c +++ b/libavcodec/qsvdec_other.c @@ -1,5 +1,5 @@ /* - * Intel MediaSDK QSV based MPEG-2, VC-1, VP8 and MJPEG decoders + * Intel MediaSDK QSV based MPEG-2, VC-1, VP8, MJPEG and VP9 decoders * * copyright (c) 2015 Anton Khirnov * @@ -60,8 +60,8 @@ static av_cold int qsv_decode_close(AVCodecContext *avctx) { QSVOtherContext *s = avctx->priv_data; -#if CONFIG_VP8_QSV_DECODER -if (avctx->codec_id == AV_CODEC_ID_VP8) +#if CONFIG_VP8_QSV_DECODER || CONFIG_VP9_QSV_DECODER +if (avctx->codec_id == AV_CODEC_ID_VP8 || avctx->codec_id == AV_CODEC_ID_VP9) av_freep(&s->qsv.load_plugins); #endif @@ -90,6 +90,17 @@ static av_cold int qsv_decode_init(AVCodecContext *avctx) } #endif +#if CONFIG_VP9_QSV_DECODER +if (avctx->codec_id == AV_CODEC_ID_VP9) { +static const char *uid_vp9dec_hw = "a922394d8d87452f878c51f2fc9b4131"; + +av_freep(&s->qsv.load_plugins); +s->qsv.load_plugins = av_strdup(uid_vp9dec_hw); +if (!s->qsv.load_plugins) +return AVERROR(ENOMEM); +} +#endif + s->packet_fifo = av_fifo_alloc(sizeof(AVPacket)); if (!s->packet_fifo) { ret = AVERROR(ENOMEM); @@ -281,3 +292,32 @@ AVCodec ff_mjpeg_qsv_decoder = { AV_PIX_FMT_NONE }, }; #endif + +#if CONFIG_VP9_QSV_DECODER +static const AVClass vp9_qsv_class = { +.class_name = "vp9_qsv", +.item_name = av_default_item_name, +.option = options, +.version= LIBAVUTIL_VERSION_INT, +}; + +AVCodec ff_vp9_qsv_decoder = { +.name = "vp9_qsv", +.long_name = NULL_IF_CONFIG_SMALL("VP9 video (Intel Quick Sync Video acceleration)"), +.priv_data_size = sizeof(QSVOtherContext), +.type = AVMEDIA_TYPE_VIDEO, +.id = AV_CODEC_ID_VP9, +.init = qsv_decode_init, +.decode = qsv_decode_frame, +.flush = qsv_decode_flush, +.close = qsv_decode_close, +.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HYBRID, +.priv_class = &vp9_qsv_class, +.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, +AV_PIX_FMT_P010, +AV_PIX_FMT_QSV, +AV_PIX_FMT_NONE }, +.hw_configs = ff_qsv_hw_configs, +.wrapper_name = "qsv", +}; +#endif -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2 4/4] avformat/concatdec: always re-calculate start time and duration
Marton Balint (12019-01-04): > Agreed, and this is how it should work even after the patch. user_duration > which is the duration specified in the ffconcat file always have priority > because get_best_effort_duration always considers that first. So it does not > matter that we assign ConcatFile->duration again and again, because we will > just reassing the same value. > > Given that, I don't think an inconsitent state is possible because seeking > is only allowed if the durations are known (if they are all set in the > ffconcat file). On the other hand, if generic seeking is not allowed, then > start_time will never be invalid because we always recalculate it for the > next file when we open it. > > Does this relax your concern? I think it does. Sorry for forgetting to reply to this. Please go ahead when convenient. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
On 1/14/19, Paul B Mahol wrote: > On 1/13/19, Paul B Mahol wrote: >> On 1/13/19, Paul B Mahol wrote: >>> Signed-off-by: Paul B Mahol >>> --- >>> doc/filters.texi | 14 ++ >>> libavfilter/Makefile | 1 + >>> libavfilter/allfilters.c | 1 + >>> libavfilter/vf_colorkey.c | 93 ++- >>> 4 files changed, 108 insertions(+), 1 deletion(-) >>> >> >> Forgot to write in commit log: >> >> This work is obviously sponsored by Carl Eugen Hoyos, by 50 $. >> > > Will apply ASAP! > Time have come to apply this. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
Paul B Mahol (12019-01-21): > Time have come to apply this. Not unless you fix the flaws. Get somebody to do a proper review. -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
On 1/21/19, Nicolas George wrote: > Paul B Mahol (12019-01-21): >> Time have come to apply this. > > Not unless you fix the flaws. Get somebody to do a proper review. > This was reviewed, and I will apply it. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
Paul B Mahol (12019-01-21): > This was reviewed, and I will apply it. I see no trace of it on the mailing-list. And if it was true, the flaw I spotted would have been fixed. If you apply as is, I will revert. Get a REAL review, public, on the mailing list. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
On 1/21/19, Nicolas George wrote: > Paul B Mahol (12019-01-21): >> This was reviewed, and I will apply it. > > I see no trace of it on the mailing-list. And if it was true, the flaw I > spotted would have been fixed. > > If you apply as is, I will revert. Michael will remove your commit rights then. You are blocking my patch, and not providing useful review at all. You are just bad person. > > Get a REAL review, public, on the mailing list. > > Regards, > > -- > Nicolas George > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
Paul B Mahol (12019-01-21): > You are blocking my patch, Yes I am blocking your patch: it is bad. Fix it. *Your* rights should be revoked if you push without review. > and not providing useful review at all. I do not owe you a review. You have been repeatedly rude towards me, why should I make a gift of my time to you? -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
On 1/21/19, Nicolas George wrote: > Paul B Mahol (12019-01-21): >> You are blocking my patch, > > Yes I am blocking your patch: it is bad. Fix it. > > *Your* rights should be revoked if you push without review. No. >> and not providing useful review at all. > > I do not owe you a review. You have been repeatedly rude towards me, why > should I make a gift of my time to you? You can only block patch if you provide actual review. Those are rules. You are rude to me, not other way around. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
Paul B Mahol (12019-01-21): > You can only block patch if you provide actual review. > Those are rules. You just invented that rule. There is a flaw, do not push without fixing it. I stand firm on it will not repeat it. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
On 1/21/19, Nicolas George wrote: > Paul B Mahol (12019-01-21): >> You can only block patch if you provide actual review. >> Those are rules. > > You just invented that rule. No, see Michael commits patches without review (thank Carl, not from you) all the time. > > There is a flaw, do not push without fixing it. I stand firm on it will > not repeat it. You have not provided actual review, just pointed some minor nuisance. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
Paul B Mahol (12019-01-21): > No, see Michael commits patches without review (thank Carl, not from > you) all the time. Yes, but not when flaws were pointed. > You have not provided actual review, Once again: I will not, I do not owe you my time. > just pointed some minor nuisance. "Minor" is your judgement. Do not push without fixing them and without a proper review. -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
On 1/21/19, Nicolas George wrote: > Paul B Mahol (12019-01-21): >> No, see Michael commits patches without review (thank Carl, not from >> you) all the time. > > Yes, but not when flaws were pointed. > >> You have not provided actual review, > > Once again: I will not, I do not owe you my time. They why you reply to my patches at all? > >> just pointed some minor nuisance. > > "Minor" is your judgement. Do not push without fixing them and without a > proper review. Or what? I'm ignoring you all the time, and nobody cares. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
Paul B Mahol (12019-01-21): > They why you reply to my patches at all? Because they are bad. I am not doing it for you, I am doing it for the project. > Or what? I'm ignoring you all the time, and nobody cares. Thanks, you just said explicitly that you violated the rules of this project. This will be remembered if you have the bad idea of pushing without review. Good bye. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
On 1/21/19, Nicolas George wrote: > Paul B Mahol (12019-01-21): >> They why you reply to my patches at all? > > Because they are bad. I am not doing it for you, I am doing it for the > project. This really hurts me, because its obviously not correct. And you are doing this for your minor pride and not for project. > >> Or what? I'm ignoring you all the time, and nobody cares. > > Thanks, you just said explicitly that you violated the rules of this > project. This will be remembered if you have the bad idea of pushing > without review. Actually nobody takes you seriously when you review my patches. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add astretch filter
On 11/10/18, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > libavfilter/Makefile | 1 + > libavfilter/af_astretch.c | 330 ++ > libavfilter/allfilters.c | 1 + > 3 files changed, 332 insertions(+) > create mode 100644 libavfilter/af_astretch.c > will apply ASAP! ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Rename RSHIFT macro to ROUNDED_RSHIFT
Patches to follow: [PATCH 1/2] avutil: Rename RSHIFT macro to ROUNDED_RSHIFT [PATCH 2/2] avcodec: Change uses of RSHIFT to ROUNDED_RSHIFT This is my first patch submission to ffmpeg (and at a tense moment, it seems, but soldiering on...), please bear with me. The RSHIFT macro in libavutil/common.h does not actually perform a bitwise right-shift, but rather a rounded version of the same operation, as is noted by a comment above the macro. The rounded divsion macro on the very next line is named ROUNDED_DIV, which seems far more clear. So, the first of these two patches renames RSHIFT to ROUNDED_RSHIFT for clarity. The second updates all uses of the macro which are internal to the ffmpeg source tree (which occur in only three codecs under libavcodec/). After applying both patches, 'make fate' succeeds and ffmpeg is still functional. An example of the name causing issues (due to a conflict with the RSHIFT macro in the Ruby source, which does perform a standard bitwise right-shift) can be found at [1]. [1]: https://github.com/OpenShot/libopenshot/issues/164 Signed-off-by: FeRD (Frank Dana) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avcodec: Change uses of RSHIFT to ROUNDED_RSHIFT
Three files in libavcodec/ use the RSHIFT macro from libavutil: - mpeg4videodec.c - vp3.c - vp56.c All instances of RSHIFT are updated to follow the name-change in libavutil/common.h (previous commit). Signed-off-by: FeRD (Frank Dana) --- libavcodec/mpeg4videodec.c | 4 ++-- libavcodec/vp3.c | 16 libavcodec/vp56.c | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index f44ee76bd4..5d63ba12ba 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -601,7 +601,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n) if (ctx->divx_version == 500 && ctx->divx_build == 413 && a >= s->quarter_sample) sum = s->sprite_offset[0][n] / (1 << (a - s->quarter_sample)); else -sum = RSHIFT(s->sprite_offset[0][n] * (1 << s->quarter_sample), a); +sum = ROUNDED_RSHIFT(s->sprite_offset[0][n] * (1 << s->quarter_sample), a); } else { dx= s->sprite_delta[n][0]; dy= s->sprite_delta[n][1]; @@ -623,7 +623,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n) v += dx; } } -sum = RSHIFT(sum, a + 8 - s->quarter_sample); +sum = ROUNDED_RSHIFT(sum, a + 8 - s->quarter_sample); } if (sum < -len) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index a5d8c2ed0b..13b3d6e22a 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -861,10 +861,10 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb) if (s->chroma_y_shift) { if (s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV) { -motion_x[0] = RSHIFT(motion_x[0] + motion_x[1] + - motion_x[2] + motion_x[3], 2); -motion_y[0] = RSHIFT(motion_y[0] + motion_y[1] + - motion_y[2] + motion_y[3], 2); +motion_x[0] = ROUNDED_RSHIFT(motion_x[0] + motion_x[1] + + motion_x[2] + motion_x[3], 2); +motion_y[0] = ROUNDED_RSHIFT(motion_y[0] + motion_y[1] + + motion_y[2] + motion_y[3], 2); } motion_x[0] = (motion_x[0] >> 1) | (motion_x[0] & 1); motion_y[0] = (motion_y[0] >> 1) | (motion_y[0] & 1); @@ -873,10 +873,10 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb) s->motion_val[1][frag][1] = motion_y[0]; } else if (s->chroma_x_shift) { if (s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV) { -motion_x[0] = RSHIFT(motion_x[0] + motion_x[1], 1); -motion_y[0] = RSHIFT(motion_y[0] + motion_y[1], 1); -motion_x[1] = RSHIFT(motion_x[2] + motion_x[3], 1); -motion_y[1] = RSHIFT(motion_y[2] + motion_y[3], 1); +motion_x[0] = ROUNDED_RSHIFT(motion_x[0] + motion_x[1], 1); +motion_y[0] = ROUNDED_RSHIFT(motion_y[0] + motion_y[1], 1); +motion_x[1] = ROUNDED_RSHIFT(motion_x[2] + motion_x[3], 1); +motion_y[1] = ROUNDED_RSHIFT(motion_y[2] + motion_y[3], 1); } else { motion_x[1] = motion_x[0]; motion_y[1] = motion_y[0]; diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c index b69fe6c176..9359b48bc6 100644 --- a/libavcodec/vp56.c +++ b/libavcodec/vp56.c @@ -197,8 +197,8 @@ static void vp56_decode_4mv(VP56Context *s, int row, int col) /* chroma vectors are average luma vectors */ if (s->avctx->codec->id == AV_CODEC_ID_VP5) { -s->mv[4].x = s->mv[5].x = RSHIFT(mv.x,2); -s->mv[4].y = s->mv[5].y = RSHIFT(mv.y,2); +s->mv[4].x = s->mv[5].x = ROUNDED_RSHIFT(mv.x,2); +s->mv[4].y = s->mv[5].y = ROUNDED_RSHIFT(mv.y,2); } else { s->mv[4] = s->mv[5] = (VP56mv) {mv.x/4, mv.y/4}; } -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avutil: Rename RSHIFT macro to ROUNDED_RSHIFT
libavutil/common.h contains a pair of macros on lines 54-55, which the comment on line 53 describes as "rounded division & shift". The division macro is named ROUNDED_DIV. The shift macro is named RSHIFT. Since "RSHIFT" is a common name for a bitwise right-shift operation without rounding (see e.g. FORTRAN, IBM XL C/C++), this seems needlessly confusing. This change renames RSHIFT to ROUNDED_RSHIFT, matching the naming style of the ROUNDED_DIV macro. Signed-off-by: FeRD (Frank Dana) --- libavutil/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/common.h b/libavutil/common.h index 8db0291170..0bff7f8f72 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -51,7 +51,7 @@ #endif //rounded division & shift -#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) +#define ROUNDED_RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) /* assume b>0 */ #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) /* Fast a/(1<=0 and b>=0 */ -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/tests: Add codec_desc to .gitignore
The compiled libavcodec/tests/codec_desc was left out of that dir's .gitignore when the test was added, so it shows up in 'git status' as an untracked file if it's been built. Signed-off-by: FeRD (Frank Dana) --- libavcodec/tests/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/tests/.gitignore b/libavcodec/tests/.gitignore index 73945a7c82..56ddb2cbeb 100644 --- a/libavcodec/tests/.gitignore +++ b/libavcodec/tests/.gitignore @@ -2,6 +2,7 @@ /avpacket /cabac /celp_math +/codec_desc /dct /fft /fft-fixed -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Refact qsv decoder parser and add new decoders
> -Original Message- > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > Zhong Li > Sent: Monday, January 21, 2019 4:42 AM > To: ffmpeg-devel@ffmpeg.org > Cc: Li, Zhong > Subject: [FFmpeg-devel] [PATCH 0/5] Refact qsv decoder parser and add new > decoders > > Replace current parser with MFXVideoDECODE_DecodeHeader(), > and add MJPEG/VP9 decoders. > > Zhong Li (5): > lavc/qsvdec: add function ff_qsv_map_picstruct() > lavc/qsvdec: Replace current parser with MFXVideoDECODE_DecodeHeader() > lavc/qsvdec: remove orignal parser code since not needed now > lavc/qsvdec: Add mjpeg decoder support > lavc/qsvdec: Add VP9 decoder support > > Changelog | 2 + > configure | 12 +++-- > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c| 2 + > libavcodec/qsv.c | 23 + > libavcodec/qsv_internal.h | 2 + > libavcodec/qsvdec.c | 119 > +- > libavcodec/qsvdec.h | 4 +- > libavcodec/qsvdec_other.c | 72 ++-- > 9 files changed, 140 insertions(+), 97 deletions(-) > > -- > 2.7.4 > [UAE] This series breaks hevc 10 bit decoder: $ ffmpeg -hwaccel qsv -hwaccel_device /dev/dri/renderD128 -v verbose \ -c:v hevc_qsv -load_plugin hevc_hw -I test-10bit.h265 \ -vf 'hwdownload,format=p010le' -pix_fmt p010le \ -f rawvideo -vsync passthrough -vframes 5 -y test.yuv [hevc_qsv @ 0x1f39740] Error initializing the MFX video decoder: unsupported (-3) Error while decoding stream #0:0: Function not implemented [hevc_qsv @ 0x1f39740] Error decoding stream header: expect more data at input (-10) Error while decoding stream #0:0: Unknown error occurred [hevc_qsv @ 0x1f39740] video_get_buffer: image parameters invalid [hevc_qsv @ 0x1f39740] get_buffer() failed Error while decoding stream #0:0: Invalid argument [hevc_qsv @ 0x1f39740] Too many errors when draining, this is a bug. Stop draining and force EOF. Error while decoding stream #0:0: Internal bug, should not have happened > ___ > 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] Rename RSHIFT macro to ROUNDED_RSHIFT
On Mon, Jan 21, 2019 at 12:38:58 -0500, FeRD (Frank Dana) wrote: > After applying both patches, 'make fate' succeeds and ffmpeg is still > functional. You're not allowed to break fate (or compilation). So the two pathes need to be merged. If, OTOH, the libraries are to be considered independent, you would first introduce the new macro alongside the old one, change all uses, then drop the old macro in a third commit. Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Rename RSHIFT macro to ROUNDED_RSHIFT
On Mon, Jan 21, 2019 at 1:55 PM Moritz Barsnick wrote: > On Mon, Jan 21, 2019 at 12:38:58 -0500, FeRD (Frank Dana) wrote: > > > After applying both patches, 'make fate' succeeds and ffmpeg is still > > functional. > > You're not allowed to break fate (or compilation). So the two pathes > need to be merged. Aha, thanks. I'll resubmit squashed into a single patch. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avutil: Rename RSHIFT macro to ROUNDED_RSHIFT
The RSHIFT macro in libavutil/common.h does not actually perform a bitwise right-shift, but rather a rounded version of the same operation, as is noted by a comment above the macro. The rounded divsion macro on the very next line is named ROUNDED_DIV, which seems far more clear. This patch renames RSHIFT to ROUNDED_RSHIFT, then updates all uses of the macro to use the new name. (These are all located in three codec files under libavcodec/.) Signed-off-by: FeRD (Frank Dana) --- libavcodec/mpeg4videodec.c | 4 ++-- libavcodec/vp3.c | 16 libavcodec/vp56.c | 4 ++-- libavutil/common.h | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index f44ee76bd4..5d63ba12ba 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -601,7 +601,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n) if (ctx->divx_version == 500 && ctx->divx_build == 413 && a >= s->quarter_sample) sum = s->sprite_offset[0][n] / (1 << (a - s->quarter_sample)); else -sum = RSHIFT(s->sprite_offset[0][n] * (1 << s->quarter_sample), a); +sum = ROUNDED_RSHIFT(s->sprite_offset[0][n] * (1 << s->quarter_sample), a); } else { dx= s->sprite_delta[n][0]; dy= s->sprite_delta[n][1]; @@ -623,7 +623,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n) v += dx; } } -sum = RSHIFT(sum, a + 8 - s->quarter_sample); +sum = ROUNDED_RSHIFT(sum, a + 8 - s->quarter_sample); } if (sum < -len) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index a5d8c2ed0b..13b3d6e22a 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -861,10 +861,10 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb) if (s->chroma_y_shift) { if (s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV) { -motion_x[0] = RSHIFT(motion_x[0] + motion_x[1] + - motion_x[2] + motion_x[3], 2); -motion_y[0] = RSHIFT(motion_y[0] + motion_y[1] + - motion_y[2] + motion_y[3], 2); +motion_x[0] = ROUNDED_RSHIFT(motion_x[0] + motion_x[1] + + motion_x[2] + motion_x[3], 2); +motion_y[0] = ROUNDED_RSHIFT(motion_y[0] + motion_y[1] + + motion_y[2] + motion_y[3], 2); } motion_x[0] = (motion_x[0] >> 1) | (motion_x[0] & 1); motion_y[0] = (motion_y[0] >> 1) | (motion_y[0] & 1); @@ -873,10 +873,10 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb) s->motion_val[1][frag][1] = motion_y[0]; } else if (s->chroma_x_shift) { if (s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV) { -motion_x[0] = RSHIFT(motion_x[0] + motion_x[1], 1); -motion_y[0] = RSHIFT(motion_y[0] + motion_y[1], 1); -motion_x[1] = RSHIFT(motion_x[2] + motion_x[3], 1); -motion_y[1] = RSHIFT(motion_y[2] + motion_y[3], 1); +motion_x[0] = ROUNDED_RSHIFT(motion_x[0] + motion_x[1], 1); +motion_y[0] = ROUNDED_RSHIFT(motion_y[0] + motion_y[1], 1); +motion_x[1] = ROUNDED_RSHIFT(motion_x[2] + motion_x[3], 1); +motion_y[1] = ROUNDED_RSHIFT(motion_y[2] + motion_y[3], 1); } else { motion_x[1] = motion_x[0]; motion_y[1] = motion_y[0]; diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c index b69fe6c176..9359b48bc6 100644 --- a/libavcodec/vp56.c +++ b/libavcodec/vp56.c @@ -197,8 +197,8 @@ static void vp56_decode_4mv(VP56Context *s, int row, int col) /* chroma vectors are average luma vectors */ if (s->avctx->codec->id == AV_CODEC_ID_VP5) { -s->mv[4].x = s->mv[5].x = RSHIFT(mv.x,2); -s->mv[4].y = s->mv[5].y = RSHIFT(mv.y,2); +s->mv[4].x = s->mv[5].x = ROUNDED_RSHIFT(mv.x,2); +s->mv[4].y = s->mv[5].y = ROUNDED_RSHIFT(mv.y,2); } else { s->mv[4] = s->mv[5] = (VP56mv) {mv.x/4, mv.y/4}; } diff --git a/libavutil/common.h b/libavutil/common.h index 8db0291170..0bff7f8f72 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -51,7 +51,7 @@ #endif //rounded division & shift -#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) +#define ROUNDED_RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) /* assume b>0 */ #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) -
Re: [FFmpeg-devel] [PATCH v3] Improved the performance of 1 decode + N filter graphs and adaptive bitrate.
On Mon, Jan 21, 2019 at 08:19:38AM +, Wang, Shaofei wrote: > > -Original Message- > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > > Michael Niedermayer > > Sent: Thursday, January 17, 2019 8:30 PM > > To: FFmpeg development discussions and patches > > Cc: Nicolas George > > Subject: Re: [FFmpeg-devel] [PATCH v3] Improved the performance of 1 > > decode + N filter graphs and adaptive bitrate. > > > > On Wed, Jan 16, 2019 at 04:17:07PM -0500, Shaofei Wang wrote: > > > With new option "-abr_pipeline" > > > It enabled multiple filter graph concurrency, which bring obove about > > > 4%~20% improvement in some 1:N scenarios by CPU or GPU acceleration > > > > > > Below are some test cases and comparison as reference. > > > (Hardware platform: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz) > > > (Software: Intel iHD driver - 16.9.00100, CentOS 7) > > > > > > For 1:N transcode by GPU acceleration with vaapi: > > > ./ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ > > > -hwaccel_output_format vaapi \ > > > -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > > > -vf "scale_vaapi=1280:720" -c:v h264_vaapi -f null /dev/null \ > > > -vf "scale_vaapi=720:480" -c:v h264_vaapi -f null /dev/null \ > > > -abr_pipeline > > > > > > test results: > > > 2 encoders 5 encoders 10 encoders > > > Improved 6.1%6.9% 5.5% > > > > > > For 1:N transcode by GPU acceleration with QSV: > > > ./ffmpeg -hwaccel qsv -c:v h264_qsv \ > > > -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > > > -vf "scale_qsv=1280:720:format=nv12" -c:v h264_qsv -f null /dev/null > > \ > > > -vf "scale_qsv=720:480:format=nv12" -c:v h264_qsv -f null > > > /dev/null > > > > > > test results: > > > 2 encoders 5 encoders 10 encoders > > > Improved 6% 4% 15% > > > > > > For Intel GPU acceleration case, 1 decode to N scaling, by QSV: > > > ./ffmpeg -hwaccel qsv -c:v h264_qsv \ > > > -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > > > -vf "scale_qsv=1280:720:format=nv12,hwdownload" -pix_fmt nv12 -f > > null /dev/null \ > > > -vf "scale_qsv=720:480:format=nv12,hwdownload" -pix_fmt nv12 -f > > > null /dev/null > > > > > > test results: > > > 2 scale 5 scale 10 scale > > > Improved 12% 21%21% > > > > > > For CPU only 1 decode to N scaling: > > > ./ffmpeg -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > > > -vf "scale=1280:720" -pix_fmt nv12 -f null /dev/null \ > > > -vf "scale=720:480" -pix_fmt nv12 -f null /dev/null \ > > > -abr_pipeline > > > > > > test results: > > > 2 scale 5 scale 10 scale > > > Improved 25%107% 148% > > > > > > Signed-off-by: Wang, Shaofei > > > Reviewed-by: Zhao, Jun > > > --- > > > fftools/ffmpeg.c| 228 > > > > > fftools/ffmpeg.h| 15 > > > fftools/ffmpeg_filter.c | 4 + > > > fftools/ffmpeg_opt.c| 6 +- > > > 4 files changed, 237 insertions(+), 16 deletions(-) > > > > Looking at this i see alot of duplicated code and alot of ifdefs > Since I didn't want to change the function interface of reap_filters(), a > none-loop reap > function generated. > Will change it base on the reap_filters() to avoid duplicated lines in the > next patch. > > > Preferably one codepath when possible, and best results by default no need > > to > > manually enable the fast path. > If disable/enable the fast path option is not needed for users, i'll remove > it. But before > that, there are some reasons: > 1. it provide more choice for user to decide whether to use it depend on > their cases, > otherwise we need to implement the 'strategies' for users to decide when to > enable/disable > the fast path. > 2. it's easy to compare the result to make sure which is the best its fine if users have the option to tune it but IMHO it should "just work" well by default thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil: Rename RSHIFT macro to ROUNDED_RSHIFT
On 1/21/2019 4:09 PM, FeRD (Frank Dana) wrote: > The RSHIFT macro in libavutil/common.h does not actually perform > a bitwise right-shift, but rather a rounded version of the same > operation, as is noted by a comment above the macro. The rounded > divsion macro on the very next line is named ROUNDED_DIV, which > seems far more clear. > > This patch renames RSHIFT to ROUNDED_RSHIFT, then updates all > uses of the macro to use the new name. (These are all located > in three codec files under libavcodec/.) > > Signed-off-by: FeRD (Frank Dana) > --- > libavcodec/mpeg4videodec.c | 4 ++-- > libavcodec/vp3.c | 16 > libavcodec/vp56.c | 4 ++-- > libavutil/common.h | 2 +- > 4 files changed, 13 insertions(+), 13 deletions(-) > > diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c > index f44ee76bd4..5d63ba12ba 100644 > --- a/libavcodec/mpeg4videodec.c > +++ b/libavcodec/mpeg4videodec.c > @@ -601,7 +601,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n) > if (ctx->divx_version == 500 && ctx->divx_build == 413 && a >= > s->quarter_sample) > sum = s->sprite_offset[0][n] / (1 << (a - s->quarter_sample)); > else > -sum = RSHIFT(s->sprite_offset[0][n] * (1 << s->quarter_sample), > a); > +sum = ROUNDED_RSHIFT(s->sprite_offset[0][n] * (1 << > s->quarter_sample), a); > } else { > dx= s->sprite_delta[n][0]; > dy= s->sprite_delta[n][1]; > @@ -623,7 +623,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n) > v += dx; > } > } > -sum = RSHIFT(sum, a + 8 - s->quarter_sample); > +sum = ROUNDED_RSHIFT(sum, a + 8 - s->quarter_sample); > } > > if (sum < -len) > diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c > index a5d8c2ed0b..13b3d6e22a 100644 > --- a/libavcodec/vp3.c > +++ b/libavcodec/vp3.c > @@ -861,10 +861,10 @@ static int unpack_vectors(Vp3DecodeContext *s, > GetBitContext *gb) > > if (s->chroma_y_shift) { > if (s->macroblock_coding[current_macroblock] == > MODE_INTER_FOURMV) { > -motion_x[0] = RSHIFT(motion_x[0] + motion_x[1] + > - motion_x[2] + motion_x[3], 2); > -motion_y[0] = RSHIFT(motion_y[0] + motion_y[1] + > - motion_y[2] + motion_y[3], 2); > +motion_x[0] = ROUNDED_RSHIFT(motion_x[0] + > motion_x[1] + > + motion_x[2] + > motion_x[3], 2); > +motion_y[0] = ROUNDED_RSHIFT(motion_y[0] + > motion_y[1] + > + motion_y[2] + > motion_y[3], 2); > } > motion_x[0] = (motion_x[0] >> 1) | (motion_x[0] & 1); > motion_y[0] = (motion_y[0] >> 1) | (motion_y[0] & 1); > @@ -873,10 +873,10 @@ static int unpack_vectors(Vp3DecodeContext *s, > GetBitContext *gb) > s->motion_val[1][frag][1] = motion_y[0]; > } else if (s->chroma_x_shift) { > if (s->macroblock_coding[current_macroblock] == > MODE_INTER_FOURMV) { > -motion_x[0] = RSHIFT(motion_x[0] + motion_x[1], 1); > -motion_y[0] = RSHIFT(motion_y[0] + motion_y[1], 1); > -motion_x[1] = RSHIFT(motion_x[2] + motion_x[3], 1); > -motion_y[1] = RSHIFT(motion_y[2] + motion_y[3], 1); > +motion_x[0] = ROUNDED_RSHIFT(motion_x[0] + > motion_x[1], 1); > +motion_y[0] = ROUNDED_RSHIFT(motion_y[0] + > motion_y[1], 1); > +motion_x[1] = ROUNDED_RSHIFT(motion_x[2] + > motion_x[3], 1); > +motion_y[1] = ROUNDED_RSHIFT(motion_y[2] + > motion_y[3], 1); > } else { > motion_x[1] = motion_x[0]; > motion_y[1] = motion_y[0]; > diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c > index b69fe6c176..9359b48bc6 100644 > --- a/libavcodec/vp56.c > +++ b/libavcodec/vp56.c > @@ -197,8 +197,8 @@ static void vp56_decode_4mv(VP56Context *s, int row, int > col) > > /* chroma vectors are average luma vectors */ > if (s->avctx->codec->id == AV_CODEC_ID_VP5) { > -s->mv[4].x = s->mv[5].x = RSHIFT(mv.x,2); > -s->mv[4].y = s->mv[5].y = RSHIFT(mv.y,2); > +s->mv[4].x = s->mv[5].x = ROUNDED_RSHIFT(mv.x,2); > +s->mv[4].y = s->mv[5].y = ROUNDED_RSHIFT(mv.y,2); > } else { > s->mv[4] = s->mv[5] = (VP56mv) {mv.x/4, mv.y/4}; > } > diff --git a/libavutil/common.h b/libavutil/common.h > index 8db0291170..0bff7f8f72 100644 > --- a/libavutil/common.h > +++ b/libavutil/common.h > @@ -51,7 +51,7 @@ > #endif > > //rounded division &
Re: [FFmpeg-devel] [PATCH] avfilter: add colorhold filter
On Mon, Jan 14, 2019 at 07:14:13PM +0100, Paul B Mahol wrote: > On 1/14/19, Nicolas George wrote: > > Paul B Mahol (12019-01-14): > >> Will apply ASAP! > > > > I have spotted at least one problem (conditional compilation) but I have > > no time to make a real review until at least ten days, alas. > > If you have no time for real review why not disconnect from > internet/mailing list. on IRC: michaelni: please tell nicolas to stop blocking my patches for no reason * durandal_1707 has quit (Ping timeout: 245 seconds) i dont really want to be drawn into this. Why? because you are both inteligent adults, and you are certainly capable to resolve this together yourself without anyone else ... if you want to solve it instead of both wanting to win against the other. Try to win together Each of you try to understand the other and help him achieve what he wants. I think nicolas wants a issue with conditional compilation fixed and wants someone to do a more complete review I think paul wants the patch pushed into git. anyway, just me 2 cents, iam not good at these "mediation" things also iam not sure iam neutral enough, so if anyone someone else should do this. just replying as i was asked Thanks and sorry that my mail here likely wont solve things, as i said iam not good at this :( [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many that live deserve death. And some that die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement. For even the very wise cannot see all ends. -- Gandalf signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/tests: Add codec_desc to .gitignore
On Mon, Jan 21, 2019 at 01:21:51PM -0500, FeRD (Frank Dana) wrote: > The compiled libavcodec/tests/codec_desc was left out of that dir's > .gitignore when the test was added, so it shows up in 'git status' > as an untracked file if it's been built. > > Signed-off-by: FeRD (Frank Dana) > --- > libavcodec/tests/.gitignore | 1 + > 1 file changed, 1 insertion(+) will apply thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Asymptotically faster algorithms should always be preferred if you have asymptotical amounts of data signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/mips: [loongson] optimize put_hevc_qpel_hv_8 with mmi.
On Mon, Jan 21, 2019 at 06:10:24PM +0800, Shiyou Yin wrote: > Optimize put_hevc_qpel_hv_8 with mmi in the case width=4/8/12/16/24/32/48/64. > This optimization improved HEVC decoding performance 11%(1.81x to 2.01x, > tested on loongson 3A3000). > --- > libavcodec/mips/hevcdsp_init_mips.c | 9 ++ > libavcodec/mips/hevcdsp_mips.h | 37 +-- > libavcodec/mips/hevcdsp_mmi.c | 195 > > libavutil/mips/mmiutils.h | 9 ++ > 4 files changed, 240 insertions(+), 10 deletions(-) will apply the 2 patches thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "You are 36 times more likely to die in a bathtub than at the hands of a terrorist. Also, you are 2.5 times more likely to become a president and 2 times more likely to become an astronaut, than to die in a terrorist attack." -- Thoughty2 signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] CENC cbcs
Hi, I noticed that ffmpeg supports CENC AES-CTR: https://lists.ffmpeg.org/pipermail/ffmpeg-user/2016-August/033130.html Are there any plans to add the other 3 common encryption protection schemes: cbc1, cens, and cbcs? I'm mainly interested in cbcs as I believe it's the only one used with HLS. -- Peter Tseng ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH V1] avfilter: clean vaapi vpp code
params.pipeline_flags: https://github.com/intel/libva/blob/master/va/va_vpp.h#L503-L529 params.filter_flags: https://github.com/intel/libva/blob/master/va/va.h#L217-L220 Signed-off-by: Zachary Zhou --- libavfilter/vf_deinterlace_vaapi.c | 4 libavfilter/vf_misc_vaapi.c| 10 +++--- libavfilter/vf_procamp_vaapi.c | 5 + libavfilter/vf_scale_vaapi.c | 2 -- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/libavfilter/vf_deinterlace_vaapi.c b/libavfilter/vf_deinterlace_vaapi.c index 97aee6588f..36adeebeb7 100644 --- a/libavfilter/vf_deinterlace_vaapi.c +++ b/libavfilter/vf_deinterlace_vaapi.c @@ -255,13 +255,9 @@ static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) params.surface_color_standard = ff_vaapi_vpp_colour_standard(input_frame->colorspace); -params.output_region = NULL; params.output_background_color = VAAPI_VPP_BACKGROUND_BLACK; params.output_color_standard = params.surface_color_standard; -params.pipeline_flags = 0; -params.filter_flags = VA_FRAME_PICTURE; - if (!ctx->auto_enable || input_frame->interlaced_frame) { vas = vaMapBuffer(vpp_ctx->hwctx->display, vpp_ctx->filter_buffers[0], &filter_params_addr); diff --git a/libavfilter/vf_misc_vaapi.c b/libavfilter/vf_misc_vaapi.c index e227c9ff6b..df32478a09 100644 --- a/libavfilter/vf_misc_vaapi.c +++ b/libavfilter/vf_misc_vaapi.c @@ -164,10 +164,9 @@ static int misc_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) .height = input_frame->height, }; -if (vpp_ctx->nb_filter_buffers) { -params.filters = &vpp_ctx->filter_buffers[0]; -params.num_filters = vpp_ctx->nb_filter_buffers; -} +params.filters = &vpp_ctx->filter_buffers[0]; +params.num_filters = vpp_ctx->nb_filter_buffers; + params.surface = input_surface; params.surface_region = &input_region; params.surface_color_standard = @@ -177,9 +176,6 @@ static int misc_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) params.output_background_color = VAAPI_VPP_BACKGROUND_BLACK; params.output_color_standard = params.surface_color_standard; -params.pipeline_flags = 0; -params.filter_flags = VA_FRAME_PICTURE; - err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_surface); if (err < 0) goto fail; diff --git a/libavfilter/vf_procamp_vaapi.c b/libavfilter/vf_procamp_vaapi.c index 46f3ab6465..e528dc5f5e 100644 --- a/libavfilter/vf_procamp_vaapi.c +++ b/libavfilter/vf_procamp_vaapi.c @@ -174,11 +174,8 @@ static int procamp_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame params.output_background_color = VAAPI_VPP_BACKGROUND_BLACK; params.output_color_standard = params.surface_color_standard; -params.pipeline_flags = 0; -params.filter_flags = VA_FRAME_PICTURE; - params.filters = &vpp_ctx->filter_buffers[0]; -params.num_filters = 1; +params.num_filters = vpp_ctx->nb_filter_buffers; err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_surface); if (err < 0) diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c index 3699363140..9fcf44d2f8 100644 --- a/libavfilter/vf_scale_vaapi.c +++ b/libavfilter/vf_scale_vaapi.c @@ -132,11 +132,9 @@ static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) params.surface_color_standard = ff_vaapi_vpp_colour_standard(input_frame->colorspace); -params.output_region = 0; params.output_background_color = VAAPI_VPP_BACKGROUND_BLACK; params.output_color_standard = params.surface_color_standard; -params.pipeline_flags = 0; params.filter_flags = ctx->mode; err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_surface); -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil: Rename RSHIFT macro to ROUNDED_RSHIFT
On Mon, Jan 21, 2019 at 3:54 PM James Almer wrote: > On 1/21/2019 4:09 PM, FeRD (Frank Dana) wrote: > > diff --git a/libavutil/common.h b/libavutil/common.h > > index 8db0291170..0bff7f8f72 100644 > > --- a/libavutil/common.h > > +++ b/libavutil/common.h > > @@ -51,7 +51,7 @@ > > #endif > > > > //rounded division & shift > > -#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + > ((1<<(b))>>1)-1)>>(b)) > > +#define ROUNDED_RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : > ((a) + ((1<<(b))>>1)-1)>>(b)) > > common.h is a public installed library, so this would be an API break. > > There's also no good way to deprecate a define and replace it with > another while informing the library user, so for something purely > cosmetic like this i don't think it's worth the trouble. > Well... not *purely* cosmetic. See [1] for an example of one issue. Ruby's `ruby/config.h` header also defines an `RSHIFT` macro, with different semantics (it doesn't round), so when building code which includes both headers the macro ends up being redefined. That being said, I can definitely accept "still not worth the trouble". Thanks. [1]: https://github.com/OpenShot/libopenshot/issues/164 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] CENC cbcs
> 在 2019年1月22日,上午8:34,Peter Tseng 写道: > > Hi, I noticed that ffmpeg supports CENC AES-CTR: > https://lists.ffmpeg.org/pipermail/ffmpeg-user/2016-August/033130.html > > Are there any plans to add the other 3 common encryption protection > schemes: cbc1, cens, and cbcs? I'm mainly interested in cbcs as I believe > it's the only one used with HLS. Patch Welcome :D > > -- > Peter Tseng > ___ > 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
[FFmpeg-devel] [PATCH 1/3] lavc/libxavs2: remove unused context parameter
Signed-off-by: hwrenx --- libavcodec/libxavs2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index 52c50a1..2d29427 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -46,7 +46,6 @@ typedef struct XAVS2EContext { int min_qp; int preset_level; int log_level; -int hierarchical_reference; void *encoder; char *xavs2_opts; -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] lavc/libdavs2: fix parameter setting error
Signed-off-by: hwrenx --- libavcodec/libdavs2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c index cf75656..f8f1b05 100644 --- a/libavcodec/libdavs2.c +++ b/libavcodec/libdavs2.c @@ -45,10 +45,11 @@ static av_cold int davs2_init(AVCodecContext *avctx) /* init the decoder */ cad->param.threads = avctx->thread_count; cad->param.info_level = 0; -cad->decoder= davs2_decoder_open(&cad->param); cad->param.disable_avx = !(cpu_flags & AV_CPU_FLAG_AVX && cpu_flags & AV_CPU_FLAG_AVX2); +cad->decoder= davs2_decoder_open(&cad->param); + if (!cad->decoder) { av_log(avctx, AV_LOG_ERROR, "decoder created error."); return AVERROR_EXTERNAL; -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/3] lavc/libxavs2: use upper layer qp parameters first
Signed-off-by: hwrenx --- libavcodec/libxavs2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index 2d29427..0ad9ca9 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -109,8 +109,9 @@ static av_cold int xavs2_init(AVCodecContext *avctx) xavs2_opt_set2("RateControl", "%d", 1); xavs2_opt_set2("TargetBitRate", "%"PRId64"", avctx->bit_rate); xavs2_opt_set2("InitialQP", "%d", cae->initial_qp); -xavs2_opt_set2("MaxQP", "%d", cae->max_qp); -xavs2_opt_set2("MinQP", "%d", cae->min_qp); +xavs2_opt_set2("MaxQP", "%d", avctx->qmax >= 0 ? avctx->qmax : cae->max_qp); +xavs2_opt_set2("MinQP", "%d", avctx->qmin >= 0 ? avctx->qmin : cae->min_qp); + } else { xavs2_opt_set2("InitialQP", "%d", cae->qp); } -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] lavc/libxavs2: remove unused context parameter
On Tue, Jan 22, 2019 at 2:38 PM hwrenx wrote: > > Signed-off-by: hwrenx > --- > libavcodec/libxavs2.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c > index 52c50a1..2d29427 100644 > --- a/libavcodec/libxavs2.c > +++ b/libavcodec/libxavs2.c > @@ -46,7 +46,6 @@ typedef struct XAVS2EContext { > int min_qp; > int preset_level; > int log_level; > -int hierarchical_reference; > > void *encoder; > char *xavs2_opts; > -- > 2.7.4 > Patch 1-3 LGTM, Tks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/5] lavu/opencl: replace va_ext.h with standard name
Khronos OpenCL header (https://github.com/KhronosGroup/OpenCL-Headers) uses cl_va_api_media_sharing_intel.h. And Intel's official OpenCL driver for Intel GPU (https://github.com/intel/compute-runtime) was compiled against Khronos OpenCL header. So it's better to align with Khronos. Signed-off-by: Ruiling Song --- configure| 2 +- libavutil/hwcontext_opencl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index c2b8fac..48fdc8e 100755 --- a/configure +++ b/configure @@ -6427,7 +6427,7 @@ fi if enabled_all opencl vaapi ; then enabled opencl_drm_beignet && enable opencl_vaapi_beignet -check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" && +check_type "CL/cl.h CL/cl_va_api_media_sharing_intel.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" && enable opencl_vaapi_intel_media fi diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index d3df622..b116c5b 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -50,7 +50,7 @@ #include #endif #include -#include +#include #include "hwcontext_vaapi.h" #endif -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/5] lavfi/colorspace: move some functions to common file
These functions can be reused by other colorspace filters, so move them to common file. No functional changes. Signed-off-by: Ruiling Song --- libavfilter/colorspace.c| 71 libavfilter/colorspace.h| 4 +++ libavfilter/vf_colorspace.c | 80 +++-- 3 files changed, 79 insertions(+), 76 deletions(-) diff --git a/libavfilter/colorspace.c b/libavfilter/colorspace.c index c668221..19616e4 100644 --- a/libavfilter/colorspace.c +++ b/libavfilter/colorspace.c @@ -93,6 +93,77 @@ void ff_fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs, rgb2xyz[2][1] *= sg; rgb2xyz[2][2] *= sb; } +static const double ycgco_matrix[3][3] = +{ +{ 0.25, 0.5, 0.25 }, +{ -0.25, 0.5, -0.25 }, +{ 0.5, 0, -0.5 }, +}; + +static const double gbr_matrix[3][3] = +{ +{ 0,1, 0 }, +{ 0, -0.5, 0.5 }, +{ 0.5, -0.5, 0 }, +}; + +/* + * All constants explained in e.g. https://linuxtv.org/downloads/v4l-dvb-apis/ch02s06.html + * The older ones (bt470bg/m) are also explained in their respective ITU docs + * (e.g. https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.470-5-199802-S!!PDF-E.pdf) + * whereas the newer ones can typically be copied directly from wikipedia :) + */ +static const struct LumaCoefficients luma_coefficients[AVCOL_SPC_NB] = { +[AVCOL_SPC_FCC]= { 0.30, 0.59, 0.11 }, +[AVCOL_SPC_BT470BG]= { 0.299, 0.587, 0.114 }, +[AVCOL_SPC_SMPTE170M] = { 0.299, 0.587, 0.114 }, +[AVCOL_SPC_BT709] = { 0.2126, 0.7152, 0.0722 }, +[AVCOL_SPC_SMPTE240M] = { 0.212, 0.701, 0.087 }, +[AVCOL_SPC_YCOCG] = { 0.25, 0.5,0.25 }, +[AVCOL_SPC_RGB]= { 1, 1, 1 }, +[AVCOL_SPC_BT2020_NCL] = { 0.2627, 0.6780, 0.0593 }, +[AVCOL_SPC_BT2020_CL] = { 0.2627, 0.6780, 0.0593 }, +}; + +const struct LumaCoefficients *ff_get_luma_coefficients(enum AVColorSpace csp) +{ +const struct LumaCoefficients *coeffs; + +if (csp >= AVCOL_SPC_NB) +return NULL; +coeffs = &luma_coefficients[csp]; +if (!coeffs->cr) +return NULL; + +return coeffs; +} + +void ff_fill_rgb2yuv_table(const struct LumaCoefficients *coeffs, + double rgb2yuv[3][3]) +{ +double bscale, rscale; + +// special ycgco matrix +if (coeffs->cr == 0.25 && coeffs->cg == 0.5 && coeffs->cb == 0.25) { +memcpy(rgb2yuv, ycgco_matrix, sizeof(double) * 9); +return; +} else if (coeffs->cr == 1 && coeffs->cg == 1 && coeffs->cb == 1) { +memcpy(rgb2yuv, gbr_matrix, sizeof(double) * 9); +return; +} + +rgb2yuv[0][0] = coeffs->cr; +rgb2yuv[0][1] = coeffs->cg; +rgb2yuv[0][2] = coeffs->cb; +bscale = 0.5 / (coeffs->cb - 1.0); +rscale = 0.5 / (coeffs->cr - 1.0); +rgb2yuv[1][0] = bscale * coeffs->cr; +rgb2yuv[1][1] = bscale * coeffs->cg; +rgb2yuv[1][2] = 0.5; +rgb2yuv[2][0] = 0.5; +rgb2yuv[2][1] = rscale * coeffs->cg; +rgb2yuv[2][2] = rscale * coeffs->cb; +} double ff_determine_signal_peak(AVFrame *in) { diff --git a/libavfilter/colorspace.h b/libavfilter/colorspace.h index 9366818..459a5df 100644 --- a/libavfilter/colorspace.h +++ b/libavfilter/colorspace.h @@ -44,6 +44,10 @@ void ff_fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs, const struct WhitepointCoefficients *wp, double rgb2xyz[3][3]); +const struct LumaCoefficients *ff_get_luma_coefficients(enum AVColorSpace csp); +void ff_fill_rgb2yuv_table(const struct LumaCoefficients *coeffs, + double rgb2yuv[3][3]); + double ff_determine_signal_peak(AVFrame *in); void ff_update_hdr_metadata(AVFrame *in, double peak); diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c index f8d1ecd..2120199 100644 --- a/libavfilter/vf_colorspace.c +++ b/libavfilter/vf_colorspace.c @@ -170,78 +170,6 @@ typedef struct ColorSpaceContext { // FIXME dithering if bitdepth goes down? // FIXME bitexact for fate integration? -static const double ycgco_matrix[3][3] = -{ -{ 0.25, 0.5, 0.25 }, -{ -0.25, 0.5, -0.25 }, -{ 0.5, 0, -0.5 }, -}; - -static const double gbr_matrix[3][3] = -{ -{ 0,1, 0 }, -{ 0, -0.5, 0.5 }, -{ 0.5, -0.5, 0 }, -}; - -/* - * All constants explained in e.g. https://linuxtv.org/downloads/v4l-dvb-apis/ch02s06.html - * The older ones (bt470bg/m) are also explained in their respective ITU docs - * (e.g. https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.470-5-199802-S!!PDF-E.pdf) - * whereas the newer ones can typically be copied directly from wikipedia :) - */ -static const struct LumaCoefficients luma_coefficients[AVCOL_SPC_NB] = { -[AVCOL_SPC_FCC]= { 0.30, 0.59, 0.11 }, -[AVCOL_SPC_BT470BG]= { 0.299, 0.587, 0.114 }, -[AVCOL_SPC_SMPTE170M] = { 0.299, 0.587, 0.114 }, -[AVCOL_SPC_BT709]
[FFmpeg-devel] [PATCH 4/5] lavfi/tonemap_opencl: reuse color matrix calculation from colorspace.c
Signed-off-by: Ruiling Song --- libavfilter/opencl/colorspace_common.cl | 25 - libavfilter/vf_tonemap_opencl.c | 64 +++-- 2 files changed, 29 insertions(+), 60 deletions(-) diff --git a/libavfilter/opencl/colorspace_common.cl b/libavfilter/opencl/colorspace_common.cl index 94a4dd0..1d68a54 100644 --- a/libavfilter/opencl/colorspace_common.cl +++ b/libavfilter/opencl/colorspace_common.cl @@ -39,31 +39,6 @@ constant const float ST2084_C1 = 0.8359375f; constant const float ST2084_C2 = 18.8515625f; constant const float ST2084_C3 = 18.6875f; -__constant float yuv2rgb_bt2020[] = { -1.0f, 0.0f, 1.4746f, -1.0f, -0.16455f, -0.57135f, -1.0f, 1.8814f, 0.0f -}; - -__constant float yuv2rgb_bt709[] = { -1.0f, 0.0f, 1.5748f, -1.0f, -0.18732f, -0.46812f, -1.0f, 1.8556f, 0.0f -}; - -__constant float rgb2yuv_bt709[] = { -0.2126f, 0.7152f, 0.0722f, --0.11457f, -0.38543f, 0.5f, -0.5f, -0.45415f, -0.04585f -}; - -__constant float rgb2yuv_bt2020[] ={ -0.2627f, 0.678f, 0.0593f, --0.1396f, -0.36037f, 0.5f, -0.5f, -0.4598f, -0.0402f, -}; - - float get_luma_dst(float3 c) { return luma_dst.x * c.x + luma_dst.y * c.y + luma_dst.z * c.z; } diff --git a/libavfilter/vf_tonemap_opencl.c b/libavfilter/vf_tonemap_opencl.c index ae3f98d..315ead4 100644 --- a/libavfilter/vf_tonemap_opencl.c +++ b/libavfilter/vf_tonemap_opencl.c @@ -18,7 +18,6 @@ #include #include "libavutil/avassert.h" -#include "libavutil/bprint.h" #include "libavutil/common.h" #include "libavutil/imgutils.h" #include "libavutil/mem.h" @@ -35,7 +34,6 @@ // TODO: // - separate peak-detection from tone-mapping kernel to solve //one-frame-delay issue. -// - import colorspace matrix generation from vf_colorspace.c // - more format support #define DETECTION_FRAMES 63 @@ -73,16 +71,6 @@ typedef struct TonemapOpenCLContext { cl_memutil_mem; } TonemapOpenCLContext; -static const char *yuv_coff[AVCOL_SPC_NB] = { -[AVCOL_SPC_BT709] = "rgb2yuv_bt709", -[AVCOL_SPC_BT2020_NCL] = "rgb2yuv_bt2020", -}; - -static const char *rgb_coff[AVCOL_SPC_NB] = { -[AVCOL_SPC_BT709] = "yuv2rgb_bt709", -[AVCOL_SPC_BT2020_NCL] = "yuv2rgb_bt2020", -}; - static const char *linearize_funcs[AVCOL_TRC_NB] = { [AVCOL_TRC_SMPTE2084] = "eotf_st2084", [AVCOL_TRC_ARIB_STD_B67] = "inverse_oetf_hlg", @@ -93,11 +81,6 @@ static const char *delinearize_funcs[AVCOL_TRC_NB] = { [AVCOL_TRC_BT2020_10] = "inverse_eotf_bt1886", }; -static const struct LumaCoefficients luma_coefficients[AVCOL_SPC_NB] = { -[AVCOL_SPC_BT709] = { 0.2126, 0.7152, 0.0722 }, -[AVCOL_SPC_BT2020_NCL] = { 0.2627, 0.6780, 0.0593 }, -}; - static const struct PrimaryCoefficients primaries_table[AVCOL_PRI_NB] = { [AVCOL_PRI_BT709] = { 0.640, 0.330, 0.300, 0.600, 0.150, 0.060 }, [AVCOL_PRI_BT2020] = { 0.708, 0.292, 0.170, 0.797, 0.131, 0.046 }, @@ -137,8 +120,8 @@ static int tonemap_opencl_init(AVFilterContext *avctx) { TonemapOpenCLContext *ctx = avctx->priv; int rgb2rgb_passthrough = 1; -double rgb2rgb[3][3]; -struct LumaCoefficients luma_src, luma_dst; +double rgb2rgb[3][3], rgb2yuv[3][3], yuv2rgb[3][3]; +const struct LumaCoefficients *luma_src, *luma_dst; cl_int cle; int err; AVBPrint header; @@ -215,27 +198,37 @@ static int tonemap_opencl_init(AVFilterContext *avctx) if (rgb2rgb_passthrough) av_bprintf(&header, "#define RGB2RGB_PASSTHROUGH\n"); -else { -av_bprintf(&header, "__constant float rgb2rgb[9] = {\n"); -av_bprintf(&header, "%.4ff, %.4ff, %.4ff,\n", - rgb2rgb[0][0], rgb2rgb[0][1], rgb2rgb[0][2]); -av_bprintf(&header, "%.4ff, %.4ff, %.4ff,\n", - rgb2rgb[1][0], rgb2rgb[1][1], rgb2rgb[1][2]); -av_bprintf(&header, "%.4ff, %.4ff, %.4ff};\n", - rgb2rgb[2][0], rgb2rgb[2][1], rgb2rgb[2][2]); +else +ff_opencl_print_const_matrix_3x3(&header, "rgb2rgb", rgb2rgb); + + +luma_src = ff_get_luma_coefficients(ctx->colorspace_in); +if (!luma_src) { +err = AVERROR(EINVAL); +av_log(avctx, AV_LOG_ERROR, "unsupported input colorspace %d (%s)\n", + ctx->colorspace_in, av_color_space_name(ctx->colorspace_in)); +goto fail; } -av_bprintf(&header, "#define rgb_matrix %s\n", - rgb_coff[ctx->colorspace_in]); -av_bprintf(&header, "#define yuv_matrix %s\n", - yuv_coff[ctx->colorspace_out]); +luma_dst = ff_get_luma_coefficients(ctx->colorspace_out); +if (!luma_dst) { +err = AVERROR(EINVAL); +av_log(avctx, AV_LOG_ERROR, "unsupported output colorspace %d (%s)\n", + ctx->colorspace_out, av_color_space_name(ctx->colorspace_out)); +goto fail; +} + +ff_fill_rgb2yuv_table(luma_dst, rgb2yuv); +ff_opencl_print_const_matrix_3x3(&header, "yuv_matrix", rgb2yuv);
[FFmpeg-devel] [PATCH 5/5] lavfi/colorspace_common: add ifdef check to be more compatible.
Some filters may not need to do linearize/delinearize, thus will even not define them. Add ifdef check, so they could easily re-use the .cl file. Signed-off-by: Ruiling Song --- libavfilter/opencl/colorspace_common.cl | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libavfilter/opencl/colorspace_common.cl b/libavfilter/opencl/colorspace_common.cl index 1d68a54..ac911f0 100644 --- a/libavfilter/opencl/colorspace_common.cl +++ b/libavfilter/opencl/colorspace_common.cl @@ -124,10 +124,14 @@ float3 yuv2rgb(float y, float u, float v) { float3 yuv2lrgb(float3 yuv) { float3 rgb = yuv2rgb(yuv.x, yuv.y, yuv.z); +#ifdef linearize float r = linearize(rgb.x); float g = linearize(rgb.y); float b = linearize(rgb.z); return (float3)(r, g, b); +#else +return rgb; +#endif } float3 rgb2yuv(float r, float g, float b) { @@ -151,19 +155,25 @@ float rgb2y(float r, float g, float b) { } float3 lrgb2yuv(float3 c) { +#ifdef delinearize float r = delinearize(c.x); float g = delinearize(c.y); float b = delinearize(c.z); - return rgb2yuv(r, g, b); +#else +return rgb2yuv(c.x, c.y, c.z); +#endif } float lrgb2y(float3 c) { +#ifdef delinearize float r = delinearize(c.x); float g = delinearize(c.y); float b = delinearize(c.z); - return rgb2y(r, g, b); +#else +return rgb2y(c.x, c.y, c.z); +#endif } float3 lrgb2lrgb(float3 c) { -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/5] lavfi/opencl: add ff_opencl_print_const_matrix_3x3()
This is used to print a 3x3 matrix into a part of OpenCL source code. Signed-off-by: Ruiling Song --- libavfilter/opencl.c | 13 + libavfilter/opencl.h | 8 2 files changed, 21 insertions(+) diff --git a/libavfilter/opencl.c b/libavfilter/opencl.c index ac5eec6..95f0bfc 100644 --- a/libavfilter/opencl.c +++ b/libavfilter/opencl.c @@ -337,3 +337,16 @@ int ff_opencl_filter_work_size_from_image(AVFilterContext *avctx, return 0; } + +void ff_opencl_print_const_matrix_3x3(AVBPrint *buf, const char *name_str, + double mat[3][3]) +{ +int i, j; +av_bprintf(buf, "__constant float %s[9] = {\n", name_str); +for (i = 0; i < 3; i++) { +for (j = 0; j < 3; j++) +av_bprintf(buf, " %.5ff,", mat[i][j]); +av_bprintf(buf, "\n"); +} +av_bprintf(buf, "};\n"); +} diff --git a/libavfilter/opencl.h b/libavfilter/opencl.h index 1b7f117..0b06232 100644 --- a/libavfilter/opencl.h +++ b/libavfilter/opencl.h @@ -25,6 +25,7 @@ // it was introduced in OpenCL 2.0. #define CL_USE_DEPRECATED_OPENCL_1_2_APIS +#include "libavutil/bprint.h" #include "libavutil/buffer.h" #include "libavutil/hwcontext.h" #include "libavutil/hwcontext_opencl.h" @@ -124,5 +125,12 @@ int ff_opencl_filter_work_size_from_image(AVFilterContext *avctx, size_t *work_size, AVFrame *frame, int plane, int block_alignment); +/** + * Print a 3x3 matrix into a buffer as __constant array, which could + * be included in an OpenCL program. +*/ + +void ff_opencl_print_const_matrix_3x3(AVBPrint *buf, const char *name_str, + double mat[3][3]); #endif /* AVFILTER_OPENCL_H */ -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add astretch filter
On 21.01.2019 17:43, Paul B Mahol wrote: On 11/10/18, Paul B Mahol wrote: Signed-off-by: Paul B Mahol --- libavfilter/Makefile | 1 + libavfilter/af_astretch.c | 330 ++ libavfilter/allfilters.c | 1 + 3 files changed, 332 insertions(+) create mode 100644 libavfilter/af_astretch.c will apply ASAP! Please add some (short) documentation. Also FATE tests are welcome. Best regards, Tobias ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel