[FFmpeg-devel] [PATCH v3 2/4] lavc/libxavs2: optimize data access
From: hwren Optimize data access from multiplication to iteration. Signed-off-by: hwren --- libavcodec/libxavs2.c | 45 + 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index 0179a1e..b5c07ec 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -132,29 +132,42 @@ static av_cold int xavs2_init(AVCodecContext *avctx) static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame *frame, const int shift_in) { -int j, k; -for (k = 0; k < 3; k++) { -int i_stride = pic->img.i_stride[k]; -for (j = 0; j < pic->img.i_lines[k]; j++) { -uint16_t *p_plane = (uint16_t *)&pic->img.img_planes[k][j * i_stride]; -int i; -uint8_t *p_buffer = frame->data[k] + frame->linesize[k] * j; -memset(p_plane, 0, i_stride); -for (i = 0; i < pic->img.i_width[k]; i++) { -p_plane[i] = p_buffer[i] << shift_in; +uint16_t *p_plane; +uint8_t *p_buffer; +int wIdx; +int hIdx; +int plane; + +for (plane = 0; plane < 3; ++plane) { +p_plane = (uint16_t *)pic->img.img_planes[plane]; +p_buffer = frame->data[plane]; +for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) { +memset(p_plane, 0, pic->img.i_stride[plane]); +for (wIdx = 0; wIdx < pic->img.i_width[plane]; ++wIdx) { +p_plane[wIdx] = p_buffer[wIdx] << shift_in; } +p_plane += pic->img.i_stride[plane]; +p_buffer += frame->linesize[plane]; } } } static void xavs2_copy_frame(xavs2_picture_t *pic, const AVFrame *frame) { -int j, k; -for (k = 0; k < 3; k++) { -for (j = 0; j < pic->img.i_lines[k]; j++) { -memcpy( pic->img.img_planes[k] + pic->img.i_stride[k] * j, -frame->data[k]+frame->linesize[k] * j, -pic->img.i_width[k] * pic->img.in_sample_size); +uint8_t *p_plane; +uint8_t *p_buffer; +int hIdx; +int plane; +int stride; + +for (plane = 0; plane < 3; ++plane) { +p_plane = pic->img.img_planes[plane]; +p_buffer = frame->data[plane]; +stride = pic->img.i_width[plane] * pic->img.in_sample_size; +for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) { +memcpy(p_plane, p_buffer, stride); +p_plane += pic->img.i_stride[plane]; +p_buffer += frame->linesize[plane]; } } } -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 3/4] lavc/libxavs2: optimize using of spaces and indents
From: hwren Signed-off-by: hwren --- libavcodec/libxavs2.c | 51 +++ 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index b5c07ec..8077607 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -26,15 +26,16 @@ #include "mpeg12.h" #include "libavutil/avstring.h" -#define xavs2_opt_set2(name, format, ...) do{ \ -char opt_str[16] = {0}; \ -int err; \ -av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \ -err = cae->api->opt_set2(cae->param, name, opt_str); \ -if (err < 0) {\ -av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, opt_str);\ -}\ -} while(0); +#define xavs2_opt_set2(name, format, ...) \ +do { \ +char opt_str[16] = {0}; \ +int err; \ +av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \ +err = cae->api->opt_set2(cae->param, name, opt_str); \ +if (err < 0) { \ +av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, opt_str); \ +} \ +} while (0); typedef struct XAVS2EContext { AVClass *class; @@ -59,12 +60,12 @@ typedef struct XAVS2EContext { static av_cold int xavs2_init(AVCodecContext *avctx) { -XAVS2EContext *cae= avctx->priv_data; +XAVS2EContext *cae = avctx->priv_data; int bit_depth, code; bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10; -/* get API handler */ +// get API handler cae->api = xavs2_api_get(bit_depth); if (!cae->api) { av_log(avctx, AV_LOG_ERROR, "api get failed\n"); @@ -83,17 +84,15 @@ static av_cold int xavs2_init(AVCodecContext *avctx) xavs2_opt_set2("BitDepth", "%d", bit_depth); xavs2_opt_set2("Log", "%d", cae->log_level); xavs2_opt_set2("Preset","%d", cae->preset_level); +xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)); xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size); xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size); - xavs2_opt_set2("ThreadFrames", "%d", avctx->thread_count); xavs2_opt_set2("ThreadRows","%d", cae->lcu_row_threads); -xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)); - if (cae->xavs2_opts) { -AVDictionary *dict= NULL; +AVDictionary *dict = NULL; AVDictionaryEntry *en = NULL; if (!av_dict_parse_string(&dict, cae->xavs2_opts, "=", ":", 0)) { @@ -104,7 +103,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx) } } -/* Rate control */ +// Rate control if (avctx->bit_rate > 0) { xavs2_opt_set2("RateControl", "%d", 1); xavs2_opt_set2("TargetBitRate", "%"PRId64"", avctx->bit_rate); @@ -115,15 +114,14 @@ static av_cold int xavs2_init(AVCodecContext *avctx) xavs2_opt_set2("InitialQP", "%d", cae->qp); } - ff_mpeg12_find_best_frame_rate(avctx->framerate, &code, NULL, NULL, 0); -xavs2_opt_set2("FrameRate", "%d", code); +xavs2_opt_set2("FrameRate", "%d", code); cae->encoder = cae->api->encoder_create(cae->param); if (!cae->encoder) { -av_log(avctx,AV_LOG_ERROR, "Can not create encoder. Null pointer returned\n"); +av_log(avctx, AV_LOG_ERROR, "Can not create encoder. Null pointer returned\n"); return AVERROR(EINVAL); } @@ -179,10 +177,10 @@ static int xavs2_encode_frame(AVCodecContext *avctx, AVPacket *pkt, xavs2_picture_t pic; int ret; -/* create the XAVS2 video encoder */ -/* read frame data and send to the XAVS2 video encoder */ +// create the XAVS2 video encoder +// read frame data and send to the XAVS2 video encoder if (cae->api->encoder_get_buffer(cae->encoder, &pic) < 0) { -av_log(avctx,AV_LOG_ERROR, "failed to get frame buffer\n"); +av_log(avctx, AV_LOG_ERROR, "failed to get frame buffer\n"); return AVERROR_EXTERNAL; } if (frame) { @@ -216,14 +214,12 @@ static int xavs2_encode_frame(AVCodecContext *avctx, AVPacket *pkt, av_log(avctx, AV_LOG_ERROR, "encode failed\n"); return AVERROR_EXTERNAL; } - } else { cae->api->encoder_encode(cae->encoder, NULL, &cae->packet); } -if ((cae->packet.len) && (cae->packet.state != XAVS2_STATE_FLUSH_END)){ - -if (av_new_packet(pkt, cae->packet.len) < 0){ +if ((cae->packet.len) && (cae->pa
[FFmpeg-devel] [PATCH v3 1/4] lavc/libxavs2: fix parameter setting result determination
From: hwren Signed-off-by: hwren --- libavcodec/libxavs2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index d5c4557..0179a1e 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -31,7 +31,7 @@ int err; \ av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \ err = cae->api->opt_set2(cae->param, name, opt_str); \ -if (err) {\ +if (err < 0) {\ av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, opt_str);\ }\ } while(0); -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 4/4] lavc/libxavs2: replace 'FrameRate' with 'fps'
From: hwren Remove deprecated parameter FrameRate (frame rate code) and use fps (frame rate) instead. Avoid encoder warnings. Signed-off-by: hwren --- libavcodec/libxavs2.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index 8077607..382f745 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -61,7 +61,8 @@ typedef struct XAVS2EContext { static av_cold int xavs2_init(AVCodecContext *avctx) { XAVS2EContext *cae = avctx->priv_data; -int bit_depth, code; +int bit_depth; +float framerate; bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10; @@ -78,6 +79,10 @@ static av_cold int xavs2_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } +if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { +framerate = (float)avctx->framerate.num / (float)avctx->framerate.den; +} + xavs2_opt_set2("Width", "%d", avctx->width); xavs2_opt_set2("Height","%d", avctx->height); xavs2_opt_set2("BFrames", "%d", avctx->max_b_frames); @@ -85,6 +90,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx) xavs2_opt_set2("Log", "%d", cae->log_level); xavs2_opt_set2("Preset","%d", cae->preset_level); xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)); +xavs2_opt_set2("fps", "%.3f", framerate); xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size); xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size); @@ -114,10 +120,6 @@ static av_cold int xavs2_init(AVCodecContext *avctx) xavs2_opt_set2("InitialQP", "%d", cae->qp); } -ff_mpeg12_find_best_frame_rate(avctx->framerate, &code, NULL, NULL, 0); - -xavs2_opt_set2("FrameRate", "%d", code); - cae->encoder = cae->api->encoder_create(cae->param); if (!cae->encoder) { -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2 3/4] lavc/libxavs2: optimize using of spaces and indents
> 在 2019年10月14日,11:09,hwren 写道: > > Signed-off-by: hwren > --- > libavcodec/libxavs2.c | 98 --- > 1 file changed, 46 insertions(+), 52 deletions(-) > > diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c > index 7a41ca2..e52f0c4 100644 > --- a/libavcodec/libxavs2.c > +++ b/libavcodec/libxavs2.c > @@ -26,15 +26,16 @@ > #include "mpeg12.h" > #include "libavutil/avstring.h" > > -#define xavs2_opt_set2(name, format, ...) do{ \ > -char opt_str[16] = {0}; \ > -int err; \ > -av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \ > -err = cae->api->opt_set2(cae->param, name, opt_str); \ > -if (err < 0) {\ > -av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, > opt_str);\ > -}\ > -} while(0); > +#define xavs2_opt_set2(name, format, ...) >\ > +do { >\ > +char opt_str[16] = {0}; >\ > +int err; >\ > +av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); >\ > +err = cae->api->opt_set2(cae->param, name, opt_str); >\ > +if (err < 0) { >\ > +av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", > name, opt_str); \ > +} >\ > +} while (0); > > typedef struct XAVS2EContext { > AVClass *class; > @@ -51,7 +52,7 @@ typedef struct XAVS2EContext { > char *xavs2_opts; > > xavs2_outpacket_t packet; > -xavs2_param_t *param; > +xavs2_param_t * param; maybe ok before modify. > > const xavs2_api_t *api; > > @@ -59,12 +60,12 @@ typedef struct XAVS2EContext { > > static av_cold int xavs2_init(AVCodecContext *avctx) > { > -XAVS2EContext *cae= avctx->priv_data; > -int bit_depth, code; > +XAVS2EContext *cae = avctx->priv_data; > +intbit_depth, code; > > bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10; > > -/* get API handler */ > +// get API handler > cae->api = xavs2_api_get(bit_depth); > if (!cae->api) { > av_log(avctx, AV_LOG_ERROR, "api get failed\n"); > @@ -77,24 +78,21 @@ static av_cold int xavs2_init(AVCodecContext *avctx) > return AVERROR(ENOMEM); > } > > -xavs2_opt_set2("Width", "%d", avctx->width); > -xavs2_opt_set2("Height","%d", avctx->height); > -xavs2_opt_set2("BFrames", "%d", avctx->max_b_frames); > -xavs2_opt_set2("BitDepth", "%d", bit_depth); > -xavs2_opt_set2("Log", "%d", cae->log_level); > -xavs2_opt_set2("Preset","%d", cae->preset_level); > - > -xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size); > -xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size); > - > -xavs2_opt_set2("ThreadFrames", "%d", avctx->thread_count); > -xavs2_opt_set2("ThreadRows","%d", cae->lcu_row_threads); > - > -xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & > AV_CODEC_FLAG_CLOSED_GOP)); > +xavs2_opt_set2("Width", "%d", avctx->width); > +xavs2_opt_set2("Height", "%d", avctx->height); > +xavs2_opt_set2("BFrames", "%d", avctx->max_b_frames); > +xavs2_opt_set2("BitDepth", "%d", bit_depth); > +xavs2_opt_set2("Log", "%d", cae->log_level); > +xavs2_opt_set2("Preset", "%d", cae->preset_level); > +xavs2_opt_set2("IntraPeriodMax", "%d", avctx->gop_size); > +xavs2_opt_set2("IntraPeriodMin", "%d", avctx->gop_size); > +xavs2_opt_set2("ThreadFrames", "%d", avctx->thread_count); > +xavs2_opt_set2("ThreadRows", "%d", cae->lcu_row_threads); > +xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & > AV_CODEC_FLAG_CLOSED_GOP)); > > if (cae->xavs2_opts) { > -AVDictionary *dict= NULL; > -AVDictionaryEntry *en = NULL; > +AVDictionary * dict = NULL; maybe ok before modify. > +AVDictionaryEntry *en = NULL; > > if (!av_dict_parse_string(&dict, cae->xavs2_opts, "=", ":", 0)) { > while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) { > @@ -104,26 +102,23 @@ static av_cold int xavs2_init(AVCodecContext *avctx) > } > } > > -/* Rate control */ > +// Rate control > if (avctx->bit_rate > 0) { > -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", avctx->qmax >= 0 ? avctx->qmax > : cae->max_qp); > -xavs2_opt_set2("MinQP", "%d", avctx->qmin >= 0 ? avctx->qmin > : cae->min_qp); > +xav
Re: [FFmpeg-devel] [PATCH v2 2/4] lavc/libxavs2: optimize data access
> 在 2019年10月14日,11:09,hwren 写道: > > Optimize data access from multiplication to iteration. > > Signed-off-by: hwren > --- > libavcodec/libxavs2.c | 41 + > 1 file changed, 25 insertions(+), 16 deletions(-) > > diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c > index 0179a1e..7a41ca2 100644 > --- a/libavcodec/libxavs2.c > +++ b/libavcodec/libxavs2.c > @@ -132,29 +132,38 @@ static av_cold int xavs2_init(AVCodecContext *avctx) > > static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame > *frame, const int shift_in) > { > -int j, k; > -for (k = 0; k < 3; k++) { > -int i_stride = pic->img.i_stride[k]; > -for (j = 0; j < pic->img.i_lines[k]; j++) { > -uint16_t *p_plane = (uint16_t *)&pic->img.img_planes[k][j * > i_stride]; > -int i; > -uint8_t *p_buffer = frame->data[k] + frame->linesize[k] * j; > -memset(p_plane, 0, i_stride); > -for (i = 0; i < pic->img.i_width[k]; i++) { > -p_plane[i] = p_buffer[i] << shift_in; > +uint16_t *p_plane; > +uint8_t * p_buffer; > +int wIdx, hIdx, plane; Code style need fix, > + > +for (plane = 0; plane < 3; ++plane) { > +p_plane = (uint16_t *)pic->img.img_planes[plane]; > +p_buffer = frame->data[plane]; > +for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) { > +memset(p_plane, 0, pic->img.i_stride[plane]); > +for (wIdx = 0; wIdx < pic->img.i_width[plane]; ++wIdx) { > +p_plane[wIdx] = p_buffer[wIdx] << shift_in; > } > +p_plane += pic->img.i_stride[plane]; > +p_buffer += frame->linesize[plane]; > } > } > } > > static void xavs2_copy_frame(xavs2_picture_t *pic, const AVFrame *frame) > { > -int j, k; > -for (k = 0; k < 3; k++) { > -for (j = 0; j < pic->img.i_lines[k]; j++) { > -memcpy( pic->img.img_planes[k] + pic->img.i_stride[k] * j, > -frame->data[k]+frame->linesize[k] * j, > -pic->img.i_width[k] * pic->img.in_sample_size); > +uint8_t *p_plane; > +uint8_t *p_buffer; > +int hIdx, plane, stride; need fix > + > +for (plane = 0; plane < 3; ++plane) { > +p_plane = pic->img.img_planes[plane]; > +p_buffer = frame->data[plane]; > + stride = pic->img.i_width[plane] * pic->img.in_sample_size; > +for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) { > +memcpy(p_plane, p_buffer, stride); > +p_plane += pic->img.i_stride[plane]; > +p_buffer += frame->linesize[plane]; > } > } > } > -- > 2.7.4 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". Thanks Steven ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 4/4] lavc/libxavs2: replace 'FrameRate' with 'fps'
Remove deprecated parameter FrameRate (frame rate code) and use fps (frame rate) instead. Avoid encoder warnings. Signed-off-by: hwren --- libavcodec/libxavs2.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index e52f0c4..4e4e1b2 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -61,7 +61,8 @@ typedef struct XAVS2EContext { static av_cold int xavs2_init(AVCodecContext *avctx) { XAVS2EContext *cae = avctx->priv_data; -intbit_depth, code; +intbit_depth; +float framerate; bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10; @@ -78,8 +79,13 @@ static av_cold int xavs2_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } +if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { +framerate = (float)avctx->framerate.num / (float)avctx->framerate.den; +} + xavs2_opt_set2("Width", "%d", avctx->width); xavs2_opt_set2("Height", "%d", avctx->height); +xavs2_opt_set2("fps", "%.3f", framerate); xavs2_opt_set2("BFrames", "%d", avctx->max_b_frames); xavs2_opt_set2("BitDepth", "%d", bit_depth); xavs2_opt_set2("Log", "%d", cae->log_level); @@ -113,9 +119,6 @@ static av_cold int xavs2_init(AVCodecContext *avctx) xavs2_opt_set2("InitialQP", "%d", cae->qp); } -ff_mpeg12_find_best_frame_rate(avctx->framerate, &code, NULL, NULL, 0); -xavs2_opt_set2("FrameRate", "%d", code); - cae->encoder = cae->api->encoder_create(cae->param); if (!cae->encoder) { av_log(avctx, AV_LOG_ERROR, "Can not create encoder. Null pointer returned\n"); -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 1/4] lavc/libxavs2: fix parameter setting result determination
Signed-off-by: hwren --- libavcodec/libxavs2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index d5c4557..0179a1e 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -31,7 +31,7 @@ int err; \ av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \ err = cae->api->opt_set2(cae->param, name, opt_str); \ -if (err) {\ +if (err < 0) {\ av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, opt_str);\ }\ } while(0); -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 3/4] lavc/libxavs2: optimize using of spaces and indents
Signed-off-by: hwren --- libavcodec/libxavs2.c | 98 --- 1 file changed, 46 insertions(+), 52 deletions(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index 7a41ca2..e52f0c4 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -26,15 +26,16 @@ #include "mpeg12.h" #include "libavutil/avstring.h" -#define xavs2_opt_set2(name, format, ...) do{ \ -char opt_str[16] = {0}; \ -int err; \ -av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \ -err = cae->api->opt_set2(cae->param, name, opt_str); \ -if (err < 0) {\ -av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, opt_str);\ -}\ -} while(0); +#define xavs2_opt_set2(name, format, ...) \ +do { \ +char opt_str[16] = {0}; \ +int err; \ +av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \ +err = cae->api->opt_set2(cae->param, name, opt_str); \ +if (err < 0) { \ +av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, opt_str); \ +} \ +} while (0); typedef struct XAVS2EContext { AVClass *class; @@ -51,7 +52,7 @@ typedef struct XAVS2EContext { char *xavs2_opts; xavs2_outpacket_t packet; -xavs2_param_t *param; +xavs2_param_t * param; const xavs2_api_t *api; @@ -59,12 +60,12 @@ typedef struct XAVS2EContext { static av_cold int xavs2_init(AVCodecContext *avctx) { -XAVS2EContext *cae= avctx->priv_data; -int bit_depth, code; +XAVS2EContext *cae = avctx->priv_data; +intbit_depth, code; bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10; -/* get API handler */ +// get API handler cae->api = xavs2_api_get(bit_depth); if (!cae->api) { av_log(avctx, AV_LOG_ERROR, "api get failed\n"); @@ -77,24 +78,21 @@ static av_cold int xavs2_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } -xavs2_opt_set2("Width", "%d", avctx->width); -xavs2_opt_set2("Height","%d", avctx->height); -xavs2_opt_set2("BFrames", "%d", avctx->max_b_frames); -xavs2_opt_set2("BitDepth", "%d", bit_depth); -xavs2_opt_set2("Log", "%d", cae->log_level); -xavs2_opt_set2("Preset","%d", cae->preset_level); - -xavs2_opt_set2("IntraPeriodMax","%d", avctx->gop_size); -xavs2_opt_set2("IntraPeriodMin","%d", avctx->gop_size); - -xavs2_opt_set2("ThreadFrames", "%d", avctx->thread_count); -xavs2_opt_set2("ThreadRows","%d", cae->lcu_row_threads); - -xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)); +xavs2_opt_set2("Width", "%d", avctx->width); +xavs2_opt_set2("Height", "%d", avctx->height); +xavs2_opt_set2("BFrames", "%d", avctx->max_b_frames); +xavs2_opt_set2("BitDepth", "%d", bit_depth); +xavs2_opt_set2("Log", "%d", cae->log_level); +xavs2_opt_set2("Preset", "%d", cae->preset_level); +xavs2_opt_set2("IntraPeriodMax", "%d", avctx->gop_size); +xavs2_opt_set2("IntraPeriodMin", "%d", avctx->gop_size); +xavs2_opt_set2("ThreadFrames", "%d", avctx->thread_count); +xavs2_opt_set2("ThreadRows", "%d", cae->lcu_row_threads); +xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)); if (cae->xavs2_opts) { -AVDictionary *dict= NULL; -AVDictionaryEntry *en = NULL; +AVDictionary * dict = NULL; +AVDictionaryEntry *en = NULL; if (!av_dict_parse_string(&dict, cae->xavs2_opts, "=", ":", 0)) { while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) { @@ -104,26 +102,23 @@ static av_cold int xavs2_init(AVCodecContext *avctx) } } -/* Rate control */ +// Rate control if (avctx->bit_rate > 0) { -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", avctx->qmax >= 0 ? avctx->qmax : cae->max_qp); -xavs2_opt_set2("MinQP", "%d", avctx->qmin >= 0 ? avctx->qmin : cae->min_qp); +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", avctx->qmax >= 0 ? avctx->qmax : cae->max_qp); +xavs2_opt_set2("MinQP", "%d", avct
[FFmpeg-devel] [PATCH v2 2/4] lavc/libxavs2: optimize data access
Optimize data access from multiplication to iteration. Signed-off-by: hwren --- libavcodec/libxavs2.c | 41 + 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index 0179a1e..7a41ca2 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -132,29 +132,38 @@ static av_cold int xavs2_init(AVCodecContext *avctx) static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame *frame, const int shift_in) { -int j, k; -for (k = 0; k < 3; k++) { -int i_stride = pic->img.i_stride[k]; -for (j = 0; j < pic->img.i_lines[k]; j++) { -uint16_t *p_plane = (uint16_t *)&pic->img.img_planes[k][j * i_stride]; -int i; -uint8_t *p_buffer = frame->data[k] + frame->linesize[k] * j; -memset(p_plane, 0, i_stride); -for (i = 0; i < pic->img.i_width[k]; i++) { -p_plane[i] = p_buffer[i] << shift_in; +uint16_t *p_plane; +uint8_t * p_buffer; +int wIdx, hIdx, plane; + +for (plane = 0; plane < 3; ++plane) { +p_plane = (uint16_t *)pic->img.img_planes[plane]; +p_buffer = frame->data[plane]; +for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) { +memset(p_plane, 0, pic->img.i_stride[plane]); +for (wIdx = 0; wIdx < pic->img.i_width[plane]; ++wIdx) { +p_plane[wIdx] = p_buffer[wIdx] << shift_in; } +p_plane += pic->img.i_stride[plane]; +p_buffer += frame->linesize[plane]; } } } static void xavs2_copy_frame(xavs2_picture_t *pic, const AVFrame *frame) { -int j, k; -for (k = 0; k < 3; k++) { -for (j = 0; j < pic->img.i_lines[k]; j++) { -memcpy( pic->img.img_planes[k] + pic->img.i_stride[k] * j, -frame->data[k]+frame->linesize[k] * j, -pic->img.i_width[k] * pic->img.in_sample_size); +uint8_t *p_plane; +uint8_t *p_buffer; +int hIdx, plane, stride; + +for (plane = 0; plane < 3; ++plane) { +p_plane = pic->img.img_planes[plane]; +p_buffer = frame->data[plane]; +stride = pic->img.i_width[plane] * pic->img.in_sample_size; +for (hIdx = 0; hIdx < pic->img.i_lines[plane]; ++hIdx) { +memcpy(p_plane, p_buffer, stride); +p_plane += pic->img.i_stride[plane]; +p_buffer += frame->linesize[plane]; } } } -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH, v2] lavc/vaapi_encode: grow packet if vaMapBuffer returns multiple buffers
> -Original Message- > From: ffmpeg-devel On Behalf Of Fu, > Linjie > Sent: Sunday, September 29, 2019 09:19 > To: Li, Zhong ; FFmpeg development discussions and > patches > Subject: Re: [FFmpeg-devel] [PATCH, v2] lavc/vaapi_encode: grow packet if > vaMapBuffer returns multiple buffers > > > -Original Message- > > From: Li, Zhong > > Sent: Friday, September 13, 2019 00:05 > > To: FFmpeg development discussions and patches > de...@ffmpeg.org> > > Cc: Fu, Linjie > > Subject: RE: [FFmpeg-devel] [PATCH, v2] lavc/vaapi_encode: grow packet if > > vaMapBuffer returns multiple buffers > > > > > From: ffmpeg-devel On Behalf Of > > Linjie Fu > > > Sent: Friday, May 31, 2019 8:35 AM > > > To: ffmpeg-devel@ffmpeg.org > > > Cc: Fu, Linjie > > > Subject: [FFmpeg-devel] [PATCH, v2] lavc/vaapi_encode: grow packet if > > > vaMapBuffer returns multiple buffers > > > > > > It seems that VA_CODED_BUF_STATUS_SINGLE_NALU allows driver to > > map > > > buffer for each slice. > > > > > > Currently, assigning new buffer for pkt when multiple buffer returns > from > > > vaMapBuffer will cover the previous encoded pkt data and lead to > encode > > issues. > > > > > > Iterate through the buf_list first to find out the total buffer size > > > needed > for > > the > > > pkt, allocate the whole pkt to avoid repeated reallocation and memcpy, > > then copy > > > data from each buf to pkt. > > > > > > Signed-off-by: Linjie Fu > > > --- > > > [v2]: allocate the whole pkt to avoid repeated reallocation and memcpy > > > > > > libavcodec/vaapi_encode.c | 18 +- > > > 1 file changed, 13 insertions(+), 5 deletions(-) > > > > > > diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c > index > > > 2dda451..9c9e5dd 100644 > > > --- a/libavcodec/vaapi_encode.c > > > +++ b/libavcodec/vaapi_encode.c > > > @@ -489,6 +489,8 @@ static int vaapi_encode_output(AVCodecContext > > *avctx, > > > VAAPIEncodeContext *ctx = avctx->priv_data; > > > VACodedBufferSegment *buf_list, *buf; > > > VAStatus vas; > > > +int total_size = 0; > > > +uint8_t *ptr; > > > int err; > > > > > > err = vaapi_encode_wait(avctx, pic); @@ -505,15 +507,21 @@ static int > > > vaapi_encode_output(AVCodecContext *avctx, > > > goto fail; > > > } > > > > > > +for (buf = buf_list; buf; buf = buf->next) > > > +total_size += buf->size; > > > + > > > +err = av_new_packet(pkt, total_size); > > > +ptr = pkt->data; > > > + > > > +if (err < 0) > > > +goto fail_mapped; > > > + > > > for (buf = buf_list; buf; buf = buf->next) { > > > av_log(avctx, AV_LOG_DEBUG, "Output buffer: %u bytes " > > > "(status %08x).\n", buf->size, buf->status); > > > > > > -err = av_new_packet(pkt, buf->size); > > > -if (err < 0) > > > -goto fail_mapped; > > > - > > > -memcpy(pkt->data, buf->buf, buf->size); > > > +memcpy(ptr, buf->buf, buf->size); > > > +ptr += buf->size; > > > } > > > > > > if (pic->type == PICTURE_TYPE_IDR) > > > -- > > > 2.7.4 > > > > LGTM > > Thanks for review. > A kindly ping. > ping? - linjie ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4 2/2] avcodec/v210dec: add the frame and slice threading support
On Sun, Oct 13, 2019 at 02:10:02PM +0100, Kieran Kunhya wrote: > > > > Michael, I have updated the patch to limit thread_count to [1,1, > > avctx->height/4], > > why height/4, it's borrowed from dxv.c, please give comments whether it's > > proper. > > > > For the lack of big speed improvement, make sure you are giving each thread > a slice in order. Kieran, thanks for your hints, he describe performance data has been tested on my old Mac Pro, so you will find that the improvement is not that great. However, if you use a x86 server with more cores and fewer cpu MHz cpus, you will get even more improvements. Below is my testing results in one server for reference(Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz): ./ffmpeg -y -i /root/UHD_Soccer_4K@50_8Bit_45.7M_HEVC_AAC.ts -c:v v210 -f rawvideo -frames 50 /root/1.v210 ./ffmpeg -threads 1 -s 3840x2160 -stream_loop 20 -i /root/1.v210 -benchmark -f null - frame= 1050 fps= 80 q=-0.0 Lsize=N/A time=00:00:42.00 bitrate=N/A speed=3.19x ./ffmpeg -threads 2 -thread_type frame+slice -s 3840x2160 -stream_loop 20 -i /root/1.v210 -benchmark -f null - frame= 1050 fps=111 q=-0.0 Lsize=N/A time=00:00:42.00 bitrate=N/A speed=4.45x ./ffmpeg -threads 4 -thread_type frame+slice -s 3840x2160 -stream_loop 20 -i /root/1.v210 -benchmark -f null - frame= 1050 fps=145 q=-0.0 Lsize=N/A time=00:00:42.00 bitrate=N/A speed=5.81x Thanks, Limin > > Kieran ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [WinRT] VDD 2019
Hello fellow devs from the FFmpeg community, VideoLAN is happy to invite you to the usual VDD conference, with a twist: VDD2019 is happending in Tokyo, on the other side of the world, for the first time ever. As usual, this is a very technical conference focused on low-level open source multimedia development, codecs, frameworks and playback libraries. We will talk about dav1d, FFv1, x264/x265, VLC, FFmpeg and other related technologies. Developers from VLC, FFmpeg, x26*, libbluray, dav1d, Gnome, Xiph and mpv will be around. We will try to do an FFmpeg meeting during those VDD. There will be a video-conference, for those who cannot attend. You can find all the information you need on https://vdd.videolan.org/ Time is limited, so register soon! As usual, VideoLAN will pay for travel, food and hosting costs, for the active people of the open source community. Because Japan is far, talk to us quickly! If you are working for a company using multimedia open source software, you are, of course, welcome too. Please know that we are looking for sponsorships, for this event, though. We are looking for speakers, sponsors, samples for the pathological competition, and volunteers. More information on: https://vdd.videolan.org/ Registration: https://forms.gle/dUGSE3eG3gyh5SQ6A You should also read https://wiki.videolan.org/VDD19/ https://wiki.videolan.org/VDD19/Sponsor_Policy/ https://wiki.videolan.org/VDD19/Traveling_Advice/ We're available on IRC, Freenode #videolan to answer questions. See you soon, in Tokyo. -- Jean-Baptiste Kempf - President +33 672 704 734 ___ WinRT mailing list wi...@videolan.org https://mailman.videolan.org/listinfo/winrt ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/Makefile: Fix aiffdec replaygain dependency
On Sat, Oct 12, 2019 at 06:22:29AM +0200, Andreas Rheinhardt wrote: > Forgotten in 6390f52a. > > Signed-off-by: Andreas Rheinhardt > --- > Found via ubitux random FATE box: > http://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-random&time=20191012015819 will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship naturally arises out of democracy, and the most aggravated form of tyranny and slavery out of the most extreme liberty. -- Plato signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] avcodec/wmaprodec: Check that the streams channels do not exceed the overall channels
On Sat, Oct 12, 2019 at 09:45:54PM +0200, Paul B Mahol wrote: > lgtm will apply thx [...] -- 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 https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avfilter/vf_geq: Use av_clipd() instead of av_clipf()
On Sat, Oct 12, 2019 at 02:28:03PM +0200, Paul B Mahol wrote: > lgtm will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Breaking DRM is a little like attempting to break through a door even though the window is wide open and the only thing in the house is a bunch of things you dont want and which you would get tomorrow for free anyway signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/mips: Fixed four warnings in vc1dsp
On Sun, Oct 13, 2019 at 05:23:55PM +0800, Shiyou Yin wrote: > >-Original Message- > >From: ffmpeg-devel-boun...@ffmpeg.org > >[mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of gxw > >Sent: Saturday, October 12, 2019 10:48 AM > >To: ffmpeg-devel@ffmpeg.org > >Subject: [FFmpeg-devel] [PATCH] avcodec/mips: Fixed four warnings in vc1dsp > > > >Change the stride argument to ptrdiff_t in the following functions: > >ff_put_no_rnd_vc1_chroma_mc8_mmi, ff_put_no_rnd_vc1_chroma_mc4_mmi, > >ff_avg_no_rnd_vc1_chroma_mc8_mmi, ff_avg_no_rnd_vc1_chroma_mc4_mmi. > >--- > > libavcodec/mips/vc1dsp_mips.h | 8 > > libavcodec/mips/vc1dsp_mmi.c | 8 > > 2 files changed, 8 insertions(+), 8 deletions(-) > > > >diff --git a/libavcodec/mips/vc1dsp_mips.h b/libavcodec/mips/vc1dsp_mips.h > >index 5f72e60..5897dae 100644 > >--- a/libavcodec/mips/vc1dsp_mips.h > >+++ b/libavcodec/mips/vc1dsp_mips.h > >@@ -180,16 +180,16 @@ void ff_vc1_h_loop_filter16_mmi(uint8_t *src, int > >stride, int pq); > > > > void ff_put_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* align 8 */, > > uint8_t *src /* align 1 */, > >- int stride, int h, int x, int y); > >+ ptrdiff_t stride, int h, int x, int > >y); > > void ff_put_no_rnd_vc1_chroma_mc4_mmi(uint8_t *dst /* align 8 */, > > uint8_t *src /* align 1 */, > >- int stride, int h, int x, int y); > >+ ptrdiff_t stride, int h, int x, int > >y); > > void ff_avg_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* align 8 */, > > uint8_t *src /* align 1 */, > >- int stride, int h, int x, int y); > >+ ptrdiff_t stride, int h, int x, int > >y); > > void ff_avg_no_rnd_vc1_chroma_mc4_mmi(uint8_t *dst /* align 8 */, > > uint8_t *src /* align 1 */, > >- int stride, int h, int x, int y); > >+ ptrdiff_t stride, int h, int x, int > >y); > > > > void ff_vc1_inv_trans_8x8_msa(int16_t block[64]); > > void ff_vc1_inv_trans_8x4_msa(uint8_t *dest, ptrdiff_t linesize, int16_t > > *block); > >diff --git a/libavcodec/mips/vc1dsp_mmi.c b/libavcodec/mips/vc1dsp_mmi.c > >index db314de..9837868 100644 > >--- a/libavcodec/mips/vc1dsp_mmi.c > >+++ b/libavcodec/mips/vc1dsp_mmi.c > >@@ -2241,7 +2241,7 @@ DECLARE_FUNCTION(3, 3) > > > > void ff_put_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* align 8 */, > > uint8_t *src /* align 1 */, > >- int stride, int h, int x, int y) > >+ ptrdiff_t stride, int h, int x, int y) > > { > > const int A = (8 - x) * (8 - y); > > const int B = (x) * (8 - y); > >@@ -2296,7 +2296,7 @@ void ff_put_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* > >align 8 */, > > > > void ff_put_no_rnd_vc1_chroma_mc4_mmi(uint8_t *dst /* align 8 */, > > uint8_t *src /* align 1 */, > >- int stride, int h, int x, int y) > >+ ptrdiff_t stride, int h, int x, int y) > > { > > const int A = (8 - x) * (8 - y); > > const int B = (x) * (8 - y); > >@@ -2349,7 +2349,7 @@ void ff_put_no_rnd_vc1_chroma_mc4_mmi(uint8_t *dst /* > >align 8 */, > > > > void ff_avg_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* align 8 */, > > uint8_t *src /* align 1 */, > >- int stride, int h, int x, int y) > >+ ptrdiff_t stride, int h, int x, int y) > > { > > const int A = (8 - x) * (8 - y); > > const int B = (x) * (8 - y); > >@@ -2407,7 +2407,7 @@ void ff_avg_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* > >align 8 */, > > > > void ff_avg_no_rnd_vc1_chroma_mc4_mmi(uint8_t *dst /* align 8 */, > > uint8_t *src /* align 1 */, > >- int stride, int h, int x, int y) > >+ ptrdiff_t stride, int h, int x, int y) > > { > > const int A = (8 - x) * (8 - y); > > const int B = (x) * (8 - y); > >-- > >2.1.0 > > > > LGTM. will apply thx [...] -- 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: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmp
[FFmpeg-devel] [PATCH] avfilter/vf_bwdif: fix heap-buffer overflow
Fixes #8261 Signed-off-by: Paul B Mahol --- libavfilter/vf_bwdif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index 37165584cf..b6aed7a450 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -343,8 +343,8 @@ static int config_props(AVFilterLink *link) if(yadif->mode&1) link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate, (AVRational){2,1}); -if (link->w < 3 || link->h < 3) { -av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines is not supported\n"); +if (link->w < 3 || link->h < 4) { +av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or 4 lines is not supported\n"); return AVERROR(EINVAL); } -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1] avformat/tee.c: steal bsf option before passing to fifo muxer
On Sun, Oct 13, 2019 at 10:39 AM Nicolas George wrote: > Jun Li (12019-10-05): > > Fix #7620 > > In the case tee muxer with both "bsf" and "use_fifo" parameters > > wil trigger this bug. Tee muxer will first steal parameters (like "f", > > will > > > "select"...) and then "use_fifo" will try reading out remaining options > > and pass them to fifo as option "format_options". > > Current code miss the part of stealing "bsf" options. > > --- > > libavformat/tee.c | 12 +--- > > 1 file changed, 9 insertions(+), 3 deletions(-) > > > > diff --git a/libavformat/tee.c b/libavformat/tee.c > > index 89a4ceb280..3530582dbd 100644 > > --- a/libavformat/tee.c > > +++ b/libavformat/tee.c > > @@ -159,7 +159,7 @@ static void close_slaves(AVFormatContext *avf) > > static int open_slave(AVFormatContext *avf, char *slave, TeeSlave > *tee_slave) > > { > > int i, ret; > > -AVDictionary *options = NULL; > > +AVDictionary *options = NULL, *bsf_options = NULL; > > AVDictionaryEntry *entry; > > char *filename; > > char *format = NULL, *select = NULL, *on_fail = NULL; > > @@ -186,6 +186,11 @@ static int open_slave(AVFormatContext *avf, char > *slave, TeeSlave *tee_slave) > > STEAL_OPTION("onfail", on_fail); > > STEAL_OPTION("use_fifo", use_fifo); > > STEAL_OPTION("fifo_options", fifo_options_str); > > +entry = NULL; > > +while ((entry = av_dict_get(options, "bsfs", entry, > AV_DICT_IGNORE_SUFFIX))) { > > > +av_dict_set(&bsf_options, entry->key, entry->value, 0); > > You could use entry->key + 4 to trim the "bsfs" prefix. Thanks for review, version 2 is sent out for addressing it. https://patchwork.ffmpeg.org/patch/15731/ > > > +av_dict_set(&options, entry->key, NULL, 0); > > +} > > > > ret = parse_slave_failure_policy_option(on_fail, tee_slave); > > if (ret < 0) { > > @@ -311,7 +316,7 @@ static int open_slave(AVFormatContext *avf, char > *slave, TeeSlave *tee_slave) > > } > > > > entry = NULL; > > -while (entry = av_dict_get(options, "bsfs", NULL, > AV_DICT_IGNORE_SUFFIX)) { > > +while (entry = av_dict_get(bsf_options, "bsfs", NULL, > AV_DICT_IGNORE_SUFFIX)) { > > const char *spec = entry->key + strlen("bsfs"); > > if (*spec) { > > if (strspn(spec, slave_bsfs_spec_sep) != 1) { > > @@ -352,7 +357,7 @@ static int open_slave(AVFormatContext *avf, char > *slave, TeeSlave *tee_slave) > > } > > } > > > > -av_dict_set(&options, entry->key, NULL, 0); > > +av_dict_set(&bsf_options, entry->key, NULL, 0); > > } > > > > for (i = 0; i < avf->nb_streams; i++){ > > @@ -399,6 +404,7 @@ end: > > av_free(select); > > av_free(on_fail); > > av_dict_free(&options); > > +av_dict_free(&bsf_options); > > av_freep(&tmp_select); > > return ret; > > } > > Apart from that, LGTM. > > Regards, > > -- > Nicolas George > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avformat/tee.c: steal bsf option before passing to fifo muxer
Fix #7620 In the case tee muxer with both "bsf" and "use_fifo" parameters will trigger this bug. Tee muxer will first steal parameters (like "f", "select"...) and then "use_fifo" will try reading out remaining options and pass them to fifo as option "format_options". Current code miss the part of stealing "bsf" options. --- libavformat/tee.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libavformat/tee.c b/libavformat/tee.c index 89a4ceb280..d91993354b 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -159,7 +159,7 @@ static void close_slaves(AVFormatContext *avf) static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave) { int i, ret; -AVDictionary *options = NULL; +AVDictionary *options = NULL, *bsf_options = NULL; AVDictionaryEntry *entry; char *filename; char *format = NULL, *select = NULL, *on_fail = NULL; @@ -186,6 +186,12 @@ static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave) STEAL_OPTION("onfail", on_fail); STEAL_OPTION("use_fifo", use_fifo); STEAL_OPTION("fifo_options", fifo_options_str); +entry = NULL; +while ((entry = av_dict_get(options, "bsfs", entry, AV_DICT_IGNORE_SUFFIX))) { +/* trim out strlen("bsfs") characters from key */ +av_dict_set(&bsf_options, entry->key + 4, entry->value, 0); +av_dict_set(&options, entry->key, NULL, 0); +} ret = parse_slave_failure_policy_option(on_fail, tee_slave); if (ret < 0) { @@ -311,8 +317,8 @@ static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave) } entry = NULL; -while (entry = av_dict_get(options, "bsfs", NULL, AV_DICT_IGNORE_SUFFIX)) { -const char *spec = entry->key + strlen("bsfs"); +while (entry = av_dict_get(bsf_options, "", NULL, AV_DICT_IGNORE_SUFFIX)) { +const char *spec = entry->key; if (*spec) { if (strspn(spec, slave_bsfs_spec_sep) != 1) { av_log(avf, AV_LOG_ERROR, @@ -352,7 +358,7 @@ static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave) } } -av_dict_set(&options, entry->key, NULL, 0); +av_dict_set(&bsf_options, entry->key, NULL, 0); } for (i = 0; i < avf->nb_streams; i++){ @@ -399,6 +405,7 @@ end: av_free(select); av_free(on_fail); av_dict_free(&options); +av_dict_free(&bsf_options); av_freep(&tmp_select); return ret; } -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH V1 2/3] fftools/ffmpeg_opt: add error handle if av_asprintf return null
On Sat, Oct 12, 2019 at 09:14:39AM +0800, Jun Zhao wrote: > From: Jun Zhao > > add error handle if av_asprintf return null. > > Signed-off-by: Jun Zhao > --- > fftools/ffmpeg_opt.c |6 ++ > 1 files changed, 6 insertions(+), 0 deletions(-) LGTM thx [...] -- 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: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] lavc/libxavs2: replace 'FrameRate' with 'fps'
On Sat, Oct 12, 2019 at 09:28:34AM +0800, hwren wrote: > From: hwrenx > > Remove deprecated paramete FrameRate (frame rate code) and use fps (frame > rate). > Avoid encoder warning. theres at least one spelling error in here (paramete) > > Signed-off-by: hwrenx > --- > libavcodec/libxavs2.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c > index 47ba74d..04f4ecb 100644 > --- a/libavcodec/libxavs2.c > +++ b/libavcodec/libxavs2.c > @@ -113,8 +113,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx) > xavs2_opt_set2("InitialQP", "%d", cae->qp); > } > > -ff_mpeg12_find_best_frame_rate(avctx->framerate, &code, NULL, NULL, 0); > -xavs2_opt_set2("FrameRate", "%d", code); > +xavs2_opt_set2("fps", "%d", avctx->framerate); Theres a unused variable after the change [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] lavc/libxvas2: optimize code style and data acces
On Sat, Oct 12, 2019 at 09:28:33AM +0800, hwren wrote: > From: hwrenx > > Optimize using of spaces and indents, change data access from multiplication > to iteration. > > Signed-off-by: hwrenx > --- > libavcodec/libxavs2.c | 139 > ++ > 1 file changed, 71 insertions(+), 68 deletions(-) This mixes functional and cosmetic changes, which makes this hard to review Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I do not agree with what you have to say, but I'll defend to the death your right to say it. -- Voltaire signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 01/14] avutil/opt: add AV_OPT_FLAG_RUNTIME_PARAM flag
Paul B Mahol (12019-10-13): > R is already taken for realtime option. > Another patch uses T for this. I meant the code you did use in the other patch, I neglected to check. -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 01/14] avutil/opt: add AV_OPT_FLAG_RUNTIME_PARAM flag
On 10/13/19, Nicolas George wrote: > Paul B Mahol (12019-10-10): >> Signed-off-by: Paul B Mahol >> --- >> libavutil/opt.h | 1 + >> 1 file changed, 1 insertion(+) > > The patch series looks reasonable on the whole. It changes the return > code of process_command() in a few cases, but that should not have > consequences. > > But it is completely missing the user documentation. I suggest to add a > paragraph like that at the appropriate place: > > Changing options at runtime with a command. > > Some options can be changed during the operation of the filter using > a command. These options are marked 'R' on the output of `ffmpeg -h > filter=...`. The name of the command is the name of the option and > the argument is the new value. R is already taken for realtime option. Another patch uses T for this. > > Then, for each option newly marked with this flag: > > This option can be changed at runtime with a command. See *Changing > options at runtime with a command.* for details. > > I think that should be enough. > > Regards, > > -- > Nicolas George > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1] avformat/tee.c: steal bsf option before passing to fifo muxer
Jun Li (12019-10-05): > Fix #7620 > In the case tee muxer with both "bsf" and "use_fifo" parameters > wil trigger this bug. Tee muxer will first steal parameters (like "f", will > "select"...) and then "use_fifo" will try reading out remaining options > and pass them to fifo as option "format_options". > Current code miss the part of stealing "bsf" options. > --- > libavformat/tee.c | 12 +--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/libavformat/tee.c b/libavformat/tee.c > index 89a4ceb280..3530582dbd 100644 > --- a/libavformat/tee.c > +++ b/libavformat/tee.c > @@ -159,7 +159,7 @@ static void close_slaves(AVFormatContext *avf) > static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave) > { > int i, ret; > -AVDictionary *options = NULL; > +AVDictionary *options = NULL, *bsf_options = NULL; > AVDictionaryEntry *entry; > char *filename; > char *format = NULL, *select = NULL, *on_fail = NULL; > @@ -186,6 +186,11 @@ static int open_slave(AVFormatContext *avf, char *slave, > TeeSlave *tee_slave) > STEAL_OPTION("onfail", on_fail); > STEAL_OPTION("use_fifo", use_fifo); > STEAL_OPTION("fifo_options", fifo_options_str); > +entry = NULL; > +while ((entry = av_dict_get(options, "bsfs", entry, > AV_DICT_IGNORE_SUFFIX))) { > +av_dict_set(&bsf_options, entry->key, entry->value, 0); You could use entry->key + 4 to trim the "bsfs" prefix. > +av_dict_set(&options, entry->key, NULL, 0); > +} > > ret = parse_slave_failure_policy_option(on_fail, tee_slave); > if (ret < 0) { > @@ -311,7 +316,7 @@ static int open_slave(AVFormatContext *avf, char *slave, > TeeSlave *tee_slave) > } > > entry = NULL; > -while (entry = av_dict_get(options, "bsfs", NULL, > AV_DICT_IGNORE_SUFFIX)) { > +while (entry = av_dict_get(bsf_options, "bsfs", NULL, > AV_DICT_IGNORE_SUFFIX)) { > const char *spec = entry->key + strlen("bsfs"); > if (*spec) { > if (strspn(spec, slave_bsfs_spec_sep) != 1) { > @@ -352,7 +357,7 @@ static int open_slave(AVFormatContext *avf, char *slave, > TeeSlave *tee_slave) > } > } > > -av_dict_set(&options, entry->key, NULL, 0); > +av_dict_set(&bsf_options, entry->key, NULL, 0); > } > > for (i = 0; i < avf->nb_streams; i++){ > @@ -399,6 +404,7 @@ end: > av_free(select); > av_free(on_fail); > av_dict_free(&options); > +av_dict_free(&bsf_options); > av_freep(&tmp_select); > return ret; > } Apart from that, LGTM. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 01/14] avutil/opt: add AV_OPT_FLAG_RUNTIME_PARAM flag
Paul B Mahol (12019-10-10): > Signed-off-by: Paul B Mahol > --- > libavutil/opt.h | 1 + > 1 file changed, 1 insertion(+) The patch series looks reasonable on the whole. It changes the return code of process_command() in a few cases, but that should not have consequences. But it is completely missing the user documentation. I suggest to add a paragraph like that at the appropriate place: Changing options at runtime with a command. Some options can be changed during the operation of the filter using a command. These options are marked 'R' on the output of `ffmpeg -h filter=...`. The name of the command is the name of the option and the argument is the new value. Then, for each option newly marked with this flag: This option can be changed at runtime with a command. See *Changing options at runtime with a command.* for details. I think that should be enough. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] avformat/mpegts: add support for non-standard NIT pid
Ping -- Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter: add bilateral filter
Signed-off-by: Paul B Mahol --- doc/filters.texi | 17 ++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_bilateral.c | 372 + 4 files changed, 391 insertions(+) create mode 100644 libavfilter/vf_bilateral.c diff --git a/doc/filters.texi b/doc/filters.texi index 0d4514678c..3f4f37e786 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -6283,6 +6283,23 @@ The filter accepts the following option: Set the minimal luminance value. Default is @code{16}. @end table +@section bilateral +Apply bilateral filter, spatial smoothing while preserving edges. + +The filter accepts the following options: +@table @option +@item sigmaS +Set sigma of gaussian function to calculate spatial weight. +Allowed range is 0 to 1024. Default is 3. + +@item sigmaR +Set sigma of gaussian function to calculate range weight. +Allowed range is 0 to 1024. Default is 0.5 + +@item planes +Set planes to filter. Default is first only. +@end table + @section bitplanenoise Show and measure bit plane noise. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 16bb8cd965..a504a26fca 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -163,6 +163,7 @@ OBJS-$(CONFIG_AVGBLUR_OPENCL_FILTER) += vf_avgblur_opencl.o opencl.o \ opencl/avgblur.o boxblur.o OBJS-$(CONFIG_BBOX_FILTER) += bbox.o vf_bbox.o OBJS-$(CONFIG_BENCH_FILTER) += f_bench.o +OBJS-$(CONFIG_BILATERAL_FILTER) += vf_bilateral.o OBJS-$(CONFIG_BITPLANENOISE_FILTER) += vf_bitplanenoise.o OBJS-$(CONFIG_BLACKDETECT_FILTER)+= vf_blackdetect.o OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 4f8b3039ed..56057cedef 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -154,6 +154,7 @@ extern AVFilter ff_vf_avgblur; extern AVFilter ff_vf_avgblur_opencl; extern AVFilter ff_vf_bbox; extern AVFilter ff_vf_bench; +extern AVFilter ff_vf_bilateral; extern AVFilter ff_vf_bitplanenoise; extern AVFilter ff_vf_blackdetect; extern AVFilter ff_vf_blackframe; diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c new file mode 100644 index 00..dafb9e1d0f --- /dev/null +++ b/libavfilter/vf_bilateral.c @@ -0,0 +1,372 @@ +/* + * Copyright (c) 2017 Ming Yang + * Copyright (c) 2019 Paul B Mahol + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "libavutil/imgutils.h" +#include "libavutil/opt.h" +#include "libavutil/pixdesc.h" +#include "avfilter.h" +#include "formats.h" +#include "internal.h" +#include "video.h" + +typedef struct BilateralContext { +const AVClass *class; + +float sigmaS; +float sigmaR; +int planes; + +int nb_planes; +int depth; +int planewidth[4]; +int planeheight[4]; + +float range_table[65536]; + +float *img_out_f; +float *img_temp; +float *map_factor_a; +float *map_factor_b; +float *slice_factor_a; +float *slice_factor_b; +float *line_factor_a; +float *line_factor_b; +} BilateralContext; + +#define OFFSET(x) offsetof(BilateralContext, x) +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM + +static const AVOption bilateral_options[] = { +{ "sigmaS", "set spatial sigma",OFFSET(sigmaS), AV_OPT_TYPE_FLOAT, {.dbl=0.1}, 0.0, 10, FLAGS }, +{ "sigmaR", "set sigma range", OFFSET(sigmaR), AV_OPT_TYPE_FLOAT, {.dbl=0.1}, 0.0, 10, FLAGS }, +{ "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=1}, 0, 0xF, FLAGS }, +{ NULL } +}; + +AVFILTER_DEFINE_CLASS(bilateral); + +typedef struct ThreadData { +int height; +int width; +} ThreadData; + +static int query_formats(AVFilterContext *ctx) +{ +static const enum AVPixelFormat pix_fmts[] = { +
Re: [FFmpeg-devel] [PATCH] lavf/mpegtsenc: add stream type AVS2
At 2019-10-12 19:40:15, "myp...@gmail.com" wrote: >On Sat, Oct 12, 2019 at 10:00 AM hwren wrote: >> >> From: hwrenx >> >> Signed-off-by: hwrenx >> --- >> libavformat/mpegts.h| 1 + >> libavformat/mpegtsenc.c | 3 +++ >> 2 files changed, 4 insertions(+) >> >> diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h >> index ecc3d33..78abe72 100644 >> --- a/libavformat/mpegts.h >> +++ b/libavformat/mpegts.h >> @@ -119,6 +119,7 @@ >> #define STREAM_TYPE_VIDEO_CAVS 0x42 >> #define STREAM_TYPE_VIDEO_VC1 0xea >> #define STREAM_TYPE_VIDEO_DIRAC 0xd1 >> +#define STREAM_TYPE_VIDEO_AVS2 0xd2 >Can you supply the spec for this new stream type? Thx Sure, the definition of stream type 0xd2 refers to the Chinese national standard GB/T 17975.1. i.e. Information technology - Generic coding of moving pictures and associated audio information Part 1: Systems. > >> >> #define STREAM_TYPE_AUDIO_AC3 0x81 >> #define STREAM_TYPE_AUDIO_DTS 0x82 >> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c >> index 0678657..b80ab25 100644 >> --- a/libavformat/mpegtsenc.c >> +++ b/libavformat/mpegtsenc.c >> @@ -336,6 +336,9 @@ static int mpegts_write_pmt(AVFormatContext *s, >> MpegTSService *service) >> case AV_CODEC_ID_CAVS: >> stream_type = STREAM_TYPE_VIDEO_CAVS; >> break; >> +case AV_CODEC_ID_AVS2: >> +stream_type = STREAM_TYPE_VIDEO_AVS2; >> +break; >> case AV_CODEC_ID_DIRAC: >> stream_type = STREAM_TYPE_VIDEO_DIRAC; >> break; >> -- >> 2.7.4 Thanks Huiwen Ren >___ >ffmpeg-devel mailing list >ffmpeg-devel@ffmpeg.org >https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >To unsubscribe, visit link above, or email >ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2 1/5] avformat/chromaprint: Fix fp_format option
On 06-10-2019 11:19 AM, Andriy Gelman wrote: From: Andriy Gelman The fp_format option was incorrectly declared, meaning that it could not be set on the cli (via recommended settings raw/compressed/base64). This is fixed in the commit. --- libavformat/chromaprint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/chromaprint.c b/libavformat/chromaprint.c index f39c09ddb9..547e801cdd 100644 --- a/libavformat/chromaprint.c +++ b/libavformat/chromaprint.c @@ -164,7 +164,7 @@ fail: static const AVOption options[] = { { "silence_threshold", "threshold for detecting silence", OFFSET(silence_threshold), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 32767, FLAGS }, { "algorithm", "version of the fingerprint algorithm", OFFSET(algorithm), AV_OPT_TYPE_INT, { .i64 = CHROMAPRINT_ALGORITHM_DEFAULT }, CHROMAPRINT_ALGORITHM_TEST1, INT_MAX, FLAGS }, -{ "fp_format", "fingerprint format to write", OFFSET(fp_format), AV_OPT_TYPE_INT, { .i64 = FINGERPRINT_BASE64 }, FINGERPRINT_RAW, FINGERPRINT_BASE64, FLAGS }, +{ "fp_format", "fingerprint format to write", OFFSET(fp_format), AV_OPT_TYPE_INT, { .i64 = FINGERPRINT_BASE64 }, FINGERPRINT_RAW, FINGERPRINT_BASE64, FLAGS, "fp_format" }, { "raw", "binary raw fingerprint", 0, AV_OPT_TYPE_CONST, {.i64 = FINGERPRINT_RAW }, INT_MIN, INT_MAX, FLAGS, "fp_format"}, { "compressed", "binary compressed fingerprint", 0, AV_OPT_TYPE_CONST, {.i64 = FINGERPRINT_COMPRESSED }, INT_MIN, INT_MAX, FLAGS, "fp_format"}, { "base64", "Base64 compressed fingerprint", 0, AV_OPT_TYPE_CONST, {.i64 = FINGERPRINT_BASE64 }, INT_MIN, INT_MAX, FLAGS, "fp_format"}, Will test and apply. Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2 3/5] avformat/chromaprint: Improve logging message
On 06-10-2019 11:19 AM, Andriy Gelman wrote: From: Andriy Gelman Setting silence_threshold requires that -algorithm 3 option is also set. Add this to the logging message. --- libavformat/chromaprint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/chromaprint.c b/libavformat/chromaprint.c index 547e801cdd..a4c0b97d99 100644 --- a/libavformat/chromaprint.c +++ b/libavformat/chromaprint.c @@ -73,7 +73,7 @@ static int write_header(AVFormatContext *s) if (cpr->silence_threshold != -1) { #if CPR_VERSION_INT >= AV_VERSION_INT(0, 7, 0) if (!chromaprint_set_option(cpr->ctx, "silence_threshold", cpr->silence_threshold)) { -av_log(s, AV_LOG_ERROR, "Failed to set silence threshold.\n"); +av_log(s, AV_LOG_ERROR, "Failed to set silence threshold. Setting silence_threshold requires -algorithm 3 option.\n"); goto fail; } #else Will apply. Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4 2/2] avcodec/v210dec: add the frame and slice threading support
> > Michael, I have updated the patch to limit thread_count to [1,1, > avctx->height/4], > why height/4, it's borrowed from dxv.c, please give comments whether it's > proper. > For the lack of big speed improvement, make sure you are giving each thread a slice in order. Kieran ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/mips: Fixed four warnings in vc1dsp
>-Original Message- >From: ffmpeg-devel-boun...@ffmpeg.org [mailto:ffmpeg-devel-boun...@ffmpeg.org] >On Behalf Of gxw >Sent: Saturday, October 12, 2019 10:48 AM >To: ffmpeg-devel@ffmpeg.org >Subject: [FFmpeg-devel] [PATCH] avcodec/mips: Fixed four warnings in vc1dsp > >Change the stride argument to ptrdiff_t in the following functions: >ff_put_no_rnd_vc1_chroma_mc8_mmi, ff_put_no_rnd_vc1_chroma_mc4_mmi, >ff_avg_no_rnd_vc1_chroma_mc8_mmi, ff_avg_no_rnd_vc1_chroma_mc4_mmi. >--- > libavcodec/mips/vc1dsp_mips.h | 8 > libavcodec/mips/vc1dsp_mmi.c | 8 > 2 files changed, 8 insertions(+), 8 deletions(-) > >diff --git a/libavcodec/mips/vc1dsp_mips.h b/libavcodec/mips/vc1dsp_mips.h >index 5f72e60..5897dae 100644 >--- a/libavcodec/mips/vc1dsp_mips.h >+++ b/libavcodec/mips/vc1dsp_mips.h >@@ -180,16 +180,16 @@ void ff_vc1_h_loop_filter16_mmi(uint8_t *src, int >stride, int pq); > > void ff_put_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* align 8 */, > uint8_t *src /* align 1 */, >- int stride, int h, int x, int y); >+ ptrdiff_t stride, int h, int x, int y); > void ff_put_no_rnd_vc1_chroma_mc4_mmi(uint8_t *dst /* align 8 */, > uint8_t *src /* align 1 */, >- int stride, int h, int x, int y); >+ ptrdiff_t stride, int h, int x, int y); > void ff_avg_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* align 8 */, > uint8_t *src /* align 1 */, >- int stride, int h, int x, int y); >+ ptrdiff_t stride, int h, int x, int y); > void ff_avg_no_rnd_vc1_chroma_mc4_mmi(uint8_t *dst /* align 8 */, > uint8_t *src /* align 1 */, >- int stride, int h, int x, int y); >+ ptrdiff_t stride, int h, int x, int y); > > void ff_vc1_inv_trans_8x8_msa(int16_t block[64]); > void ff_vc1_inv_trans_8x4_msa(uint8_t *dest, ptrdiff_t linesize, int16_t > *block); >diff --git a/libavcodec/mips/vc1dsp_mmi.c b/libavcodec/mips/vc1dsp_mmi.c >index db314de..9837868 100644 >--- a/libavcodec/mips/vc1dsp_mmi.c >+++ b/libavcodec/mips/vc1dsp_mmi.c >@@ -2241,7 +2241,7 @@ DECLARE_FUNCTION(3, 3) > > void ff_put_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* align 8 */, > uint8_t *src /* align 1 */, >- int stride, int h, int x, int y) >+ ptrdiff_t stride, int h, int x, int y) > { > const int A = (8 - x) * (8 - y); > const int B = (x) * (8 - y); >@@ -2296,7 +2296,7 @@ void ff_put_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* >align 8 */, > > void ff_put_no_rnd_vc1_chroma_mc4_mmi(uint8_t *dst /* align 8 */, > uint8_t *src /* align 1 */, >- int stride, int h, int x, int y) >+ ptrdiff_t stride, int h, int x, int y) > { > const int A = (8 - x) * (8 - y); > const int B = (x) * (8 - y); >@@ -2349,7 +2349,7 @@ void ff_put_no_rnd_vc1_chroma_mc4_mmi(uint8_t *dst /* >align 8 */, > > void ff_avg_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* align 8 */, > uint8_t *src /* align 1 */, >- int stride, int h, int x, int y) >+ ptrdiff_t stride, int h, int x, int y) > { > const int A = (8 - x) * (8 - y); > const int B = (x) * (8 - y); >@@ -2407,7 +2407,7 @@ void ff_avg_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* >align 8 */, > > void ff_avg_no_rnd_vc1_chroma_mc4_mmi(uint8_t *dst /* align 8 */, > uint8_t *src /* align 1 */, >- int stride, int h, int x, int y) >+ ptrdiff_t stride, int h, int x, int y) > { > const int A = (8 - x) * (8 - y); > const int B = (x) * (8 - y); >-- >2.1.0 > LGTM. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".