[FFmpeg-cvslog] avfilter/vf_zscale: fix regression with src/dst_format initialization
ffmpeg | branch: master | Paul B Mahol | Mon Mar 28 12:39:05 2022 +0200| [e5189b13827746e57bc1eccc78a5381f646963b9] | committer: Paul B Mahol avfilter/vf_zscale: fix regression with src/dst_format initialization > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e5189b13827746e57bc1eccc78a5381f646963b9 --- libavfilter/vf_zscale.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c index 2061e38bcc..952efaf41b 100644 --- a/libavfilter/vf_zscale.c +++ b/libavfilter/vf_zscale.c @@ -113,6 +113,7 @@ typedef struct ZScaleContext { int in_h_chr_pos; int in_v_chr_pos; +int first_time; int force_original_aspect_ratio; void *tmp[MAX_THREADS]; //separate for each thread; @@ -321,12 +322,7 @@ static int config_props(AVFilterLink *outlink) outlink->w = w; outlink->h = h; -if (inlink->w == outlink->w && -inlink->h == outlink->h && -inlink->format == outlink->format) -; -else { -} +s->first_time = 1; if (inlink->sample_aspect_ratio.num){ outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h * inlink->w, outlink->w * inlink->h}, inlink->sample_aspect_ratio); @@ -770,6 +766,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) if ((link->format != outlink->format) || (link->w != outlink->w) || (link->h != outlink->h) || +s->first_time || (s->src_format.chroma_location != s->dst_format.chroma_location) || (s->src_format.color_family !=s->dst_format.color_family) || (s->src_format.color_primaries !=s->dst_format.color_primaries) || @@ -821,6 +818,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) s->primaries_in, s->trc_in, s->range_in, s->chromal_in); format_init(&s->dst_format, out, odesc, s->colorspace, s->primaries, s->trc, s->range, s->chromal); +s->first_time = 0; s->params.dither_type = s->dither; s->params.cpu_type = ZIMG_CPU_AUTO; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_mergeplanes: deprecate mapping option
ffmpeg | branch: master | Paul B Mahol | Tue Apr 5 12:00:48 2022 +0200| [854615adf2f9bfd2c839d580293255ac9542d4d1] | committer: Paul B Mahol avfilter/vf_mergeplanes: deprecate mapping option > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=854615adf2f9bfd2c839d580293255ac9542d4d1 --- libavfilter/vf_mergeplanes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c index 74b55b01c1..23b9f3d62f 100644 --- a/libavfilter/vf_mergeplanes.c +++ b/libavfilter/vf_mergeplanes.c @@ -56,7 +56,7 @@ typedef struct MergePlanesContext { #define OFFSET(x) offsetof(MergePlanesContext, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM static const AVOption mergeplanes_options[] = { -{ "mapping", "set input to output plane mapping", OFFSET(mapping), AV_OPT_TYPE_INT, {.i64=-1}, -1, 0x, FLAGS }, +{ "mapping", "set input to output plane mapping", OFFSET(mapping), AV_OPT_TYPE_INT, {.i64=-1}, -1, 0x, FLAGS|AV_OPT_FLAG_DEPRECATED }, { "format", "set output pixel format", OFFSET(out_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64=AV_PIX_FMT_YUVA444P}, 0, INT_MAX, .flags=FLAGS }, { "map0s", "set 1st input to output stream mapping", OFFSET(map[0].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, { "map0p", "set 1st input to output plane mapping", OFFSET(map[0].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_mergeplanes: add alternative for less user friendly option
ffmpeg | branch: master | Paul B Mahol | Tue Apr 5 11:43:21 2022 +0200| [385bc756bf960370e2823acf4425fe7c13868e4b] | committer: Paul B Mahol avfilter/vf_mergeplanes: add alternative for less user friendly option > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=385bc756bf960370e2823acf4425fe7c13868e4b --- doc/filters.texi | 12 libavfilter/vf_mergeplanes.c | 24 +--- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 636c80dbff..5ac7db6924 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -16072,6 +16072,18 @@ plane, 'Cc' describes the mapping for the output stream third plane and @item format Set output pixel format. Default is @code{yuva444p}. + +@item map0s +@item map1s +@item map2s +@item map3s +Set input to output stream mapping for output Nth plane. Default is @code{0}. + +@item map0p +@item map1p +@item map2p +@item map3p +Set input to output plane mapping for output Nth plane. Default is @code{0}. @end table @subsection Examples diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c index 3f72980f52..74b55b01c1 100644 --- a/libavfilter/vf_mergeplanes.c +++ b/libavfilter/vf_mergeplanes.c @@ -28,8 +28,8 @@ #include "framesync.h" typedef struct Mapping { -uint8_t input; -uint8_t plane; +int input; +int plane; } Mapping; typedef struct InputParam { @@ -56,8 +56,16 @@ typedef struct MergePlanesContext { #define OFFSET(x) offsetof(MergePlanesContext, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM static const AVOption mergeplanes_options[] = { -{ "mapping", "set input to output plane mapping", OFFSET(mapping), AV_OPT_TYPE_INT, {.i64=0}, 0, 0x, FLAGS }, +{ "mapping", "set input to output plane mapping", OFFSET(mapping), AV_OPT_TYPE_INT, {.i64=-1}, -1, 0x, FLAGS }, { "format", "set output pixel format", OFFSET(out_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64=AV_PIX_FMT_YUVA444P}, 0, INT_MAX, .flags=FLAGS }, +{ "map0s", "set 1st input to output stream mapping", OFFSET(map[0].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, +{ "map0p", "set 1st input to output plane mapping", OFFSET(map[0].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, +{ "map1s", "set 2nd input to output stream mapping", OFFSET(map[1].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, +{ "map1p", "set 2nd input to output plane mapping", OFFSET(map[1].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, +{ "map2s", "set 3rd input to output stream mapping", OFFSET(map[2].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, +{ "map2p", "set 3rd input to output plane mapping", OFFSET(map[2].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, +{ "map3s", "set 4th input to output stream mapping", OFFSET(map[3].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, +{ "map3p", "set 4th input to output plane mapping", OFFSET(map[3].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, { NULL } }; @@ -78,10 +86,12 @@ static av_cold int init(AVFilterContext *ctx) s->nb_planes = av_pix_fmt_count_planes(s->out_fmt); for (i = s->nb_planes - 1; i >= 0; i--) { -s->map[i].plane = m & 0xf; -m >>= 4; -s->map[i].input = m & 0xf; -m >>= 4; +if (m >= 0 && m <= 0x) { +s->map[i].plane = m & 0xf; +m >>= 4; +s->map[i].input = m & 0xf; +m >>= 4; +} if (s->map[i].plane > 3 || s->map[i].input > 3) { av_log(ctx, AV_LOG_ERROR, "Mapping with out of range input and/or plane number.\n"); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_mergeplanes: make map code more verbose
ffmpeg | branch: master | Paul B Mahol | Tue Apr 5 11:25:16 2022 +0200| [f92e4636fe3ebd74c6198272dc0b260b082110be] | committer: Paul B Mahol avfilter/vf_mergeplanes: make map code more verbose > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f92e4636fe3ebd74c6198272dc0b260b082110be --- libavfilter/vf_mergeplanes.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c index fc1d50a72e..3f72980f52 100644 --- a/libavfilter/vf_mergeplanes.c +++ b/libavfilter/vf_mergeplanes.c @@ -27,6 +27,11 @@ #include "internal.h" #include "framesync.h" +typedef struct Mapping { +uint8_t input; +uint8_t plane; +} Mapping; + typedef struct InputParam { int depth[4]; int nb_planes; @@ -42,7 +47,7 @@ typedef struct MergePlanesContext { int nb_planes; int planewidth[4]; int planeheight[4]; -int map[4][2]; +Mapping map[4]; const AVPixFmtDescriptor *outdesc; FFFrameSync fs; @@ -73,17 +78,17 @@ static av_cold int init(AVFilterContext *ctx) s->nb_planes = av_pix_fmt_count_planes(s->out_fmt); for (i = s->nb_planes - 1; i >= 0; i--) { -s->map[i][0] = m & 0xf; +s->map[i].plane = m & 0xf; m >>= 4; -s->map[i][1] = m & 0xf; +s->map[i].input = m & 0xf; m >>= 4; -if (s->map[i][0] > 3 || s->map[i][1] > 3) { +if (s->map[i].plane > 3 || s->map[i].input > 3) { av_log(ctx, AV_LOG_ERROR, "Mapping with out of range input and/or plane number.\n"); return AVERROR(EINVAL); } -s->nb_inputs = FFMAX(s->nb_inputs, s->map[i][1] + 1); +s->nb_inputs = FFMAX(s->nb_inputs, s->map[i].input + 1); } av_assert0(s->nb_inputs && s->nb_inputs <= 4); @@ -151,8 +156,8 @@ static int process_frame(FFFrameSync *fs) out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); for (i = 0; i < s->nb_planes; i++) { -const int input = s->map[i][1]; -const int plane = s->map[i][0]; +const int input = s->map[i].input; +const int plane = s->map[i].plane; av_image_copy_plane(out->data[i], out->linesize[i], in[input]->data[plane], in[input]->linesize[plane], @@ -231,8 +236,8 @@ static int config_output(AVFilterLink *outlink) } for (i = 0; i < s->nb_planes; i++) { -const int input = s->map[i][1]; -const int plane = s->map[i][0]; +const int input = s->map[i].input; +const int plane = s->map[i].plane; InputParam *inputp = &inputsp[input]; if (plane + 1 > inputp->nb_planes) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mov_chan: rename mov_get_channel_label() to better reflect its purpose
ffmpeg | branch: master | James Almer | Mon Mar 28 11:28:54 2022 -0300| [90ef712de56147d127fa06fef176b60c873de929] | committer: James Almer avformat/mov_chan: rename mov_get_channel_label() to better reflect its purpose This function turns a mov channel label into a lavf native bitmask. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90ef712de56147d127fa06fef176b60c873de929 --- libavformat/mov_chan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index f52239d347..4607540297 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -485,7 +485,7 @@ static uint64_t mov_get_channel_layout(uint32_t tag, uint32_t bitmap) return layout_map[i].layout; } -static uint32_t mov_get_channel_label(uint32_t label) +static uint32_t mov_get_channel_mask(uint32_t label) { if (label == 0) return 0; @@ -590,7 +590,7 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, avio_rl32(pb); // mCoordinates[2] size -= 20; if (layout_tag == 0) { -uint32_t mask_incr = mov_get_channel_label(label); +uint32_t mask_incr = mov_get_channel_mask(label); if (mask_incr == 0) { label_mask = 0; break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mov_chan: use a higher log level for a debug message
ffmpeg | branch: master | James Almer | Mon Mar 28 15:01:54 2022 -0300| [b4373bc4226426e4c2498e0c914520806764776e] | committer: James Almer avformat/mov_chan: use a higher log level for a debug message Trace is too noisy and this line is useful enough to get it printed at debug level. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b4373bc4226426e4c2498e0c914520806764776e --- libavformat/mov_chan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index 98773bb460..3c23142f35 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -574,7 +574,7 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, bitmap = avio_rb32(pb); num_descr = avio_rb32(pb); -av_log(s, AV_LOG_TRACE, "chan: layout=%"PRIu32" " +av_log(s, AV_LOG_DEBUG, "chan: layout=%"PRIu32" " "bitmap=%"PRIu32" num_descr=%"PRIu32"\n", layout_tag, bitmap, num_descr); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mov_chan: add a few missing channel label mappings
ffmpeg | branch: master | James Almer | Mon Mar 28 11:33:37 2022 -0300| [603f2245d4d0ee40d4c7e2192648127999fb0fbd] | committer: James Almer avformat/mov_chan: add a few missing channel label mappings Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=603f2245d4d0ee40d4c7e2192648127999fb0fbd --- libavformat/mov_chan.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index 4607540297..98773bb460 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -485,12 +485,18 @@ static uint64_t mov_get_channel_layout(uint32_t tag, uint32_t bitmap) return layout_map[i].layout; } -static uint32_t mov_get_channel_mask(uint32_t label) +static uint64_t mov_get_channel_mask(uint32_t label) { if (label == 0) return 0; if (label <= 18) return 1U << (label - 1); +if (label == 35) +return AV_CH_WIDE_LEFT; +if (label == 36) +return AV_CH_WIDE_RIGHT; +if (label == 37) +return AV_CH_LOW_FREQUENCY_2; if (label == 38) return AV_CH_STEREO_LEFT; if (label == 39) @@ -557,8 +563,8 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id, int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, int64_t size) { -uint32_t layout_tag, bitmap, num_descr, label_mask; -uint64_t mask = 0; +uint32_t layout_tag, bitmap, num_descr; +uint64_t label_mask, mask = 0; int i; if (size < 12) @@ -590,7 +596,7 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, avio_rl32(pb); // mCoordinates[2] size -= 20; if (layout_tag == 0) { -uint32_t mask_incr = mov_get_channel_mask(label); +uint64_t mask_incr = mov_get_channel_mask(label); if (mask_incr == 0) { label_mask = 0; break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/movenc: write channel descriptions when a known layout or a bitmap can't be used
ffmpeg | branch: master | James Almer | Mon Mar 28 11:24:27 2022 -0300| [c2c5f3484399281e7eb74f5fdcc1f2eab8b9f62d] | committer: James Almer avformat/movenc: write channel descriptions when a known layout or a bitmap can't be used Fixes part of ticket #2865 Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2c5f3484399281e7eb74f5fdcc1f2eab8b9f62d --- libavformat/mov_chan.c | 75 ++ libavformat/mov_chan.h | 8 -- libavformat/movenc.c | 37 ++--- 3 files changed, 90 insertions(+), 30 deletions(-) diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index 3c23142f35..4cb373d1b9 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -504,9 +504,29 @@ static uint64_t mov_get_channel_mask(uint32_t label) return 0; } -uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id, - const AVChannelLayout *ch_layout, - uint32_t *bitmap) +static uint32_t mov_get_channel_label(enum AVChannel channel) +{ +if (channel < 0) +return 0; +if (channel <= AV_CHAN_TOP_BACK_RIGHT) +return channel + 1; +if (channel == AV_CHAN_WIDE_LEFT) +return 35; +if (channel == AV_CHAN_WIDE_RIGHT) +return 36; +if (channel == AV_CHAN_LOW_FREQUENCY_2) +return 37; +if (channel == AV_CHAN_STEREO_LEFT) +return 38; +if (channel == AV_CHAN_STEREO_RIGHT) +return 39; +return 0; +} + +int ff_mov_get_channel_layout_tag(const AVCodecParameters *par, + uint32_t *layout, + uint32_t *bitmap, + uint32_t **pchannel_desc) { int i, j; uint32_t tag = 0; @@ -514,7 +534,7 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id, /* find the layout list for the specified codec */ for (i = 0; mov_codec_ch_layouts[i].codec_id != AV_CODEC_ID_NONE; i++) { -if (mov_codec_ch_layouts[i].codec_id == codec_id) +if (mov_codec_ch_layouts[i].codec_id == par->codec_id) break; } if (mov_codec_ch_layouts[i].codec_id != AV_CODEC_ID_NONE) @@ -525,7 +545,7 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id, const struct MovChannelLayoutMap *layout_map; /* get the layout map based on the channel count */ -channels = ch_layout->nb_channels; +channels = par->ch_layout.nb_channels; if (channels > 9) channels = 0; layout_map = mov_ch_layout_map[channels]; @@ -536,8 +556,8 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id, continue; for (j = 0; layout_map[j].tag != 0; j++) { if (layout_map[j].tag== layouts[i] && -(ch_layout->order == AV_CHANNEL_ORDER_NATIVE && - layout_map[j].layout == ch_layout->u.mask)) +(par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE && + layout_map[j].layout == par->ch_layout.u.mask)) break; } if (layout_map[j].tag) @@ -546,18 +566,39 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id, tag = layouts[i]; } -/* if no tag was found, use channel bitmap as a backup if possible */ -if (tag == 0 && av_channel_layout_check(ch_layout) && -ch_layout->order == AV_CHANNEL_ORDER_NATIVE && -ch_layout->u.mask < 0x4) { -tag = MOV_CH_LAYOUT_USE_BITMAP; -*bitmap = (uint32_t)ch_layout->u.mask; -} else -*bitmap = 0; +*layout = tag; +*bitmap = 0; +*pchannel_desc = NULL; + +/* if no tag was found, use channel bitmap or description as a backup if possible */ +if (tag == 0) { +uint32_t *channel_desc; +if (par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE && +par->ch_layout.u.mask < 0x4) { +*layout = MOV_CH_LAYOUT_USE_BITMAP; +*bitmap = (uint32_t)par->ch_layout.u.mask; +return 0; +} else if (par->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) +return AVERROR(ENOSYS); + +channel_desc = av_malloc_array(par->ch_layout.nb_channels, sizeof(*channel_desc)); +if (!channel_desc) +return AVERROR(ENOMEM); + +for (i = 0; i < par->ch_layout.nb_channels; i++) { +channel_desc[i] = + mov_get_channel_label(av_channel_layout_channel_from_index(&par->ch_layout, i)); + +if (channel_desc[i] == 0) { +av_free(channel_desc); +return AVERROR(ENOSYS); +} +} -/* TODO: set channel descriptions as a secondary backup */ +*pchannel_desc = channel_desc; +} -return tag; +return 0; } int ff_mov_read_chan(AVFormatContext *s
[FFmpeg-cvslog] avformat/mov_chan: move the definition of MovChannelLayoutTag to the header
ffmpeg | branch: master | James Almer | Mon Mar 28 18:36:42 2022 -0300| [feb3b44c1c4681eac096316fde7309192fcecb18] | committer: James Almer avformat/mov_chan: move the definition of MovChannelLayoutTag to the header Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=feb3b44c1c4681eac096316fde7309192fcecb18 --- libavformat/mov_chan.c | 104 - libavformat/mov_chan.h | 104 + 2 files changed, 104 insertions(+), 104 deletions(-) diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index 4cb373d1b9..5b757c6a8a 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -29,110 +29,6 @@ #include "libavcodec/codec_id.h" #include "mov_chan.h" -/** - * Channel Layout Tag - * This tells which channels are present in the audio stream and the order in - * which they appear. - * - * @note We're using the channel layout tag to indicate channel order - * when the value is greater than 0x1. The Apple documentation has - * some contradictions as to how this is actually supposed to be handled. - * - * Core Audio File Format Spec: - * "The high 16 bits indicates a specific ordering of the channels." - * Core Audio Data Types Reference: - * "These identifiers specify the channels included in a layout but - *do not specify a particular ordering of those channels." - */ -enum MovChannelLayoutTag { -#define MOV_CH_LAYOUT_UNKNOWN 0x -MOV_CH_LAYOUT_USE_DESCRIPTIONS = ( 0 << 16) | 0, -MOV_CH_LAYOUT_USE_BITMAP= ( 1 << 16) | 0, -MOV_CH_LAYOUT_DISCRETEINORDER = (147 << 16) | 0, -MOV_CH_LAYOUT_MONO = (100 << 16) | 1, -MOV_CH_LAYOUT_STEREO= (101 << 16) | 2, -MOV_CH_LAYOUT_STEREOHEADPHONES = (102 << 16) | 2, -MOV_CH_LAYOUT_MATRIXSTEREO = (103 << 16) | 2, -MOV_CH_LAYOUT_MIDSIDE = (104 << 16) | 2, -MOV_CH_LAYOUT_XY= (105 << 16) | 2, -MOV_CH_LAYOUT_BINAURAL = (106 << 16) | 2, -MOV_CH_LAYOUT_AMBISONIC_B_FORMAT= (107 << 16) | 4, -MOV_CH_LAYOUT_QUADRAPHONIC = (108 << 16) | 4, -MOV_CH_LAYOUT_PENTAGONAL= (109 << 16) | 5, -MOV_CH_LAYOUT_HEXAGONAL = (110 << 16) | 6, -MOV_CH_LAYOUT_OCTAGONAL = (111 << 16) | 8, -MOV_CH_LAYOUT_CUBE = (112 << 16) | 8, -MOV_CH_LAYOUT_MPEG_3_0_A= (113 << 16) | 3, -MOV_CH_LAYOUT_MPEG_3_0_B= (114 << 16) | 3, -MOV_CH_LAYOUT_MPEG_4_0_A= (115 << 16) | 4, -MOV_CH_LAYOUT_MPEG_4_0_B= (116 << 16) | 4, -MOV_CH_LAYOUT_MPEG_5_0_A= (117 << 16) | 5, -MOV_CH_LAYOUT_MPEG_5_0_B= (118 << 16) | 5, -MOV_CH_LAYOUT_MPEG_5_0_C= (119 << 16) | 5, -MOV_CH_LAYOUT_MPEG_5_0_D= (120 << 16) | 5, -MOV_CH_LAYOUT_MPEG_5_1_A= (121 << 16) | 6, -MOV_CH_LAYOUT_MPEG_5_1_B= (122 << 16) | 6, -MOV_CH_LAYOUT_MPEG_5_1_C= (123 << 16) | 6, -MOV_CH_LAYOUT_MPEG_5_1_D= (124 << 16) | 6, -MOV_CH_LAYOUT_MPEG_6_1_A= (125 << 16) | 7, -MOV_CH_LAYOUT_MPEG_7_1_A= (126 << 16) | 8, -MOV_CH_LAYOUT_MPEG_7_1_B= (127 << 16) | 8, -MOV_CH_LAYOUT_MPEG_7_1_C= (128 << 16) | 8, -MOV_CH_LAYOUT_EMAGIC_DEFAULT_7_1= (129 << 16) | 8, -MOV_CH_LAYOUT_SMPTE_DTV = (130 << 16) | 8, -MOV_CH_LAYOUT_ITU_2_1 = (131 << 16) | 3, -MOV_CH_LAYOUT_ITU_2_2 = (132 << 16) | 4, -MOV_CH_LAYOUT_DVD_4 = (133 << 16) | 3, -MOV_CH_LAYOUT_DVD_5 = (134 << 16) | 4, -MOV_CH_LAYOUT_DVD_6 = (135 << 16) | 5, -MOV_CH_LAYOUT_DVD_10= (136 << 16) | 4, -MOV_CH_LAYOUT_DVD_11= (137 << 16) | 5, -MOV_CH_LAYOUT_DVD_18= (138 << 16) | 5, -MOV_CH_LAYOUT_AUDIOUNIT_6_0 = (139 << 16) | 6, -MOV_CH_LAYOUT_AUDIOUNIT_7_0 = (140 << 16) | 7, -MOV_CH_LAYOUT_AUDIOUNIT_7_0_FRONT = (148 << 16) | 7, -MOV_CH_LAYOUT_AAC_6_0 = (141 << 16) | 6, -MOV_CH_LAYOUT_AAC_6_1 = (142 << 16) | 7, -MOV_CH_LAYOUT_AAC_7_0 = (143 << 16) | 7, -MOV_CH_LAYOUT_AAC_OCTAGONAL = (144 << 16) | 8, -MOV_CH_LAYOUT_TMH_10_2_STD = (145 << 16) | 16, -MOV_CH_LAYOUT_TMH_10_2_FULL = (146 << 16) | 21, -MOV_CH_LAYOUT_AC3_1_0_1 = (149 << 16) | 2, -MOV_CH_LAYOUT_AC3_3_0 = (150 << 16) | 3, -MOV_CH_LAYOUT_AC3_3_1 = (151 << 16) | 4, -MOV_CH_LAYOUT_AC3_3_0_1 = (152 << 16) | 4, -MOV_CH_LAYOUT_AC3_2_1_1 = (153 << 16) | 4, -MOV_CH_LAYOUT_AC3_3_1_1 = (154 << 16) | 5, -
[FFmpeg-cvslog] avformat/movenc: don't use mono layout when a front center label is expected
ffmpeg | branch: master | James Almer | Mon Mar 28 14:58:48 2022 -0300| [7ccc9108032aeaa21b8ad91b201ed19c88b8d239] | committer: James Almer avformat/movenc: don't use mono layout when a front center label is expected On output streams where a multichannel stream needs to be stored as one track per channel, each track will have a channel layout describing the position of the channel they contain. For the track with front center, the mov muxer was using the mov layout "mono" instead of the label for the front center position. Since our channel layout API considers front center == mono, we need to do some heuristics. To achieve this, we make sure all audio tracks contain streams with a single channel, and only one of them is front center. In that case, we write the front center label instead of signaling mono layout. Fixes the last part of ticket #2865 Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7ccc9108032aeaa21b8ad91b201ed19c88b8d239 --- libavformat/movenc.c | 25 + libavformat/movenc.h | 1 + 2 files changed, 26 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 263649f1da..b9956e699c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -887,6 +887,17 @@ static int mov_write_chan_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra return ret; } +if (layout_tag == MOV_CH_LAYOUT_MONO && track->mono_as_fc > 0) { +av_assert0(!channel_desc); +channel_desc = av_malloc(sizeof(*channel_desc)); +if (!channel_desc) +return AVERROR(ENOMEM); + +layout_tag = 0; +bitmap = 0; +*channel_desc = 3; // channel label "Center" +} + num_desc = layout_tag ? 0 : track->par->ch_layout.nb_channels; avio_wb32(pb, 0); // Size @@ -6970,6 +6981,20 @@ static int mov_write_header(AVFormatContext *s) if (j == i) continue; +if (stj->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && +(trackj->par->ch_layout.nb_channels != 1 || + !av_channel_layout_compare(&trackj->par->ch_layout, + &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO)) +) +track->mono_as_fc = -1; + +if (stj->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && +av_channel_layout_compare(&trackj->par->ch_layout, + &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO) && +trackj->par->ch_layout.nb_channels == 1 && track->mono_as_fc >= 0 +) +track->mono_as_fc++; + if (stj->codecpar->codec_type != AVMEDIA_TYPE_AUDIO || av_channel_layout_compare(&trackj->par->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO) || diff --git a/libavformat/movenc.h b/libavformat/movenc.h index 2ac84ed070..67d6d4fb66 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -107,6 +107,7 @@ typedef struct MOVTrack { int tag; ///< stsd fourcc AVStream*st; AVCodecParameters *par; +int mono_as_fc; int multichannel_as_mono; int vos_len; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fate: add a test for writing channel descriptions in mov
ffmpeg | branch: master | James Almer | Mon Mar 28 19:54:13 2022 -0300| [0e03807f698e3ee5584d89a8c77e7c9cf502b2e1] | committer: James Almer fate: add a test for writing channel descriptions in mov Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0e03807f698e3ee5584d89a8c77e7c9cf502b2e1 --- tests/fate/mov.mak | 11 - tests/ref/fate/mov-channel-description | 42 ++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index b54c009f05..5d9f183203 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -153,4 +153,13 @@ fate-mov-mp4-disposition-mpegts-remux: CMD = transcode mpegts $(TARGET_SAMPLES)/ FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_MOV_FFMPEG_FFPROBE-yes) -fate-mov: $(FATE_MOV) $(FATE_MOV_FFPROBE) $(FATE_MOV_FASTSTART) $(FATE_MOV_FFMPEG_FFPROBE-yes) +FATE_MOV_FFMPEG-$(call ALLYES, FILE_PROTOCOL PIPE_PROTOCOL \ + WAV_DEMUXER PAN_FILTER PCM_S16LE_ENCODER \ + MOV_MUXER FRAMECRC_MUXER ) \ + += fate-mov-channel-description +fate-mov-channel-description: tests/data/asynth-44100-1.wav +fate-mov-channel-description: CMD = transcode wav $(TARGET_PATH)/tests/data/asynth-44100-1.wav mov "-filter_complex [0:a:0]pan=FL|c0=c0[outFL] -map [outFL] -filter_complex [0:a:0]pan=FR|c0=c1[outFR] -map [outFR] -filter_complex [0:a:0]pan=FC|c0=c2[outFC] -map [outFC] -filter_complex [0:a:0]pan=LFE|c0=c3[outLFE] -map [outLFE] -filter_complex [0:a:0]pan=BL|c0=c4[outBL] -map [outBL] -filter_complex [0:a:0]pan=BR|c0=c5[outBR] -map [outBR] -filter_complex [0:a:0]pan=DL|c0=c6[outDL] -map [outDL] -filter_complex [0:a:0]pan=DR|c0=c7[outDR] -map [outDR] -c:a pcm_s16le" "-map 0 -c copy -frames:a 0" + +FATE_FFMPEG += $(FATE_MOV_FFMPEG-yes) + +fate-mov: $(FATE_MOV) $(FATE_MOV_FFMPEG-yes) $(FATE_MOV_FFPROBE) $(FATE_MOV_FASTSTART) $(FATE_MOV_FFMPEG_FFPROBE-yes) diff --git a/tests/ref/fate/mov-channel-description b/tests/ref/fate/mov-channel-description new file mode 100644 index 00..21b2e11406 --- /dev/null +++ b/tests/ref/fate/mov-channel-description @@ -0,0 +1,42 @@ +497848e1bc5c9dcd416124b6f739d733 *tests/data/fate/mov-channel-description.mov +4242044 tests/data/fate/mov-channel-description.mov +#tb 0: 1/44100 +#media_type 0: audio +#codec_id 0: pcm_s16le +#sample_rate 0: 44100 +#channel_layout_name 0: 1 channels (FL) +#tb 1: 1/44100 +#media_type 1: audio +#codec_id 1: pcm_s16le +#sample_rate 1: 44100 +#channel_layout_name 1: 1 channels (FR) +#tb 2: 1/44100 +#media_type 2: audio +#codec_id 2: pcm_s16le +#sample_rate 2: 44100 +#channel_layout_name 2: mono +#tb 3: 1/44100 +#media_type 3: audio +#codec_id 3: pcm_s16le +#sample_rate 3: 44100 +#channel_layout_name 3: 1 channels (LFE) +#tb 4: 1/44100 +#media_type 4: audio +#codec_id 4: pcm_s16le +#sample_rate 4: 44100 +#channel_layout_name 4: 1 channels (BL) +#tb 5: 1/44100 +#media_type 5: audio +#codec_id 5: pcm_s16le +#sample_rate 5: 44100 +#channel_layout_name 5: 1 channels (BR) +#tb 6: 1/44100 +#media_type 6: audio +#codec_id 6: pcm_s16le +#sample_rate 6: 44100 +#channel_layout_name 6: 1 channels (DL) +#tb 7: 1/44100 +#media_type 7: audio +#codec_id 7: pcm_s16le +#sample_rate 7: 44100 +#channel_layout_name 7: 1 channels (DR) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/libvpxenc: return quantizer parameter for an encoded frame
ffmpeg | branch: master | Danil Chapovalov | Tue Apr 5 16:20:46 2022 +0200| [53fd2d2203451434abd4ce22a758b1137edbe3fe] | committer: James Almer avcodec/libvpxenc: return quantizer parameter for an encoded frame > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=53fd2d2203451434abd4ce22a758b1137edbe3fe --- libavcodec/libvpxenc.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index dff1d06b0e..302f3bc55b 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -1247,9 +1247,11 @@ static inline void cx_pktcpy(struct FrameListData *dst, static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, AVPacket *pkt) { +VPxContext *ctx = avctx->priv_data; int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0); uint8_t *side_data; int pict_type; +int quality; if (ret < 0) return ret; @@ -1264,7 +1266,10 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, pict_type = AV_PICTURE_TYPE_P; } -ff_side_data_set_encoder_stats(pkt, 0, cx_frame->sse + 1, +ret = vpx_codec_control(&ctx->encoder, VP8E_GET_LAST_QUANTIZER_64, &quality); +if (ret != VPX_CODEC_OK) +quality = 0; +ff_side_data_set_encoder_stats(pkt, quality * FF_QP2LAMBDA, cx_frame->sse + 1, cx_frame->have_sse ? 3 : 0, pict_type); if (cx_frame->have_sse) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/libvpxenc: avoid unnecessary variable shadowing
ffmpeg | branch: master | James Almer | Tue Apr 5 12:19:04 2022 -0300| [cc6c5ff2017c09dbf37070fa2e7fa79403c792ad] | committer: James Almer avcodec/libvpxenc: avoid unnecessary variable shadowing Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc6c5ff2017c09dbf37070fa2e7fa79403c792ad --- libavcodec/libvpxenc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 302f3bc55b..f711c3fb19 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -1290,7 +1290,6 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, memcpy(side_data + 8, cx_frame->buf_alpha, cx_frame->sz_alpha); } if (cx_frame->frame_number != -1) { -VPxContext *ctx = avctx->priv_data; if (ctx->hdr10_plus_fifo) { int err = copy_hdr10_plus_to_pkt(ctx->hdr10_plus_fifo, pkt); if (err < 0) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vsrc_gradients: add circular type
ffmpeg | branch: master | Paul B Mahol | Tue Apr 5 17:17:46 2022 +0200| [8e1cedbb61aee58daec35344461a810120401d55] | committer: Paul B Mahol avfilter/vsrc_gradients: add circular type > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8e1cedbb61aee58daec35344461a810120401d55 --- doc/filters.texi | 2 +- libavfilter/vsrc_gradients.c | 92 ++-- 2 files changed, 65 insertions(+), 29 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 5ac7db6924..7cf2ae8b0f 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -25874,7 +25874,7 @@ supposed to be generated forever. Set speed of gradients rotation. @item type, t -Set type of gradients, can be @code{linear} or @code{radial}. +Set type of gradients, can be @code{linear} or @code{radial} or @code{circular}. @end table diff --git a/libavfilter/vsrc_gradients.c b/libavfilter/vsrc_gradients.c index ac29fec9ed..61206bb2b3 100644 --- a/libavfilter/vsrc_gradients.c +++ b/libavfilter/vsrc_gradients.c @@ -79,10 +79,11 @@ static const AVOption gradients_options[] = { {"duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1},-1, INT64_MAX, FLAGS }, {"d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1},-1, INT64_MAX, FLAGS }, {"speed", "set gradients rotation speed", OFFSET(speed), AV_OPT_TYPE_FLOAT,{.dbl=0.01}, 0.1, 1, FLAGS }, -{"type", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "type" }, -{"t", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "type" }, +{"type", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "type" }, +{"t", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "type" }, {"linear","set gradient type",0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "type" }, {"radial","set gradient type",0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "type" }, +{"circular", "set gradient type",0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "type" }, {NULL}, }; @@ -115,10 +116,10 @@ static uint64_t lerp_color16(uint8_t c0[4], uint8_t c1[4], float x) (llrintf((c0[3] * y + c1[3] * x) * 256)) << 48; } -static uint32_t lerp_colors(uint8_t arr[3][4], int nb_colors, float step) +static uint32_t lerp_colors(uint8_t arr[3][4], int nb_colors, int nb_wrap_colors, float step) { float scl; -int i; +int i, j; if (nb_colors == 1 || step <= 0.0) { return arr[0][0] | (arr[0][1] << 8) | (arr[0][2] << 16) | (arr[0][3] << 24); @@ -127,16 +128,21 @@ static uint32_t lerp_colors(uint8_t arr[3][4], int nb_colors, float step) return arr[i][0] | (arr[i][1] << 8) | (arr[i][2] << 16) | (arr[i][3] << 24); } -scl = step * (nb_colors - 1); +scl = step * (nb_wrap_colors - 1); i = floorf(scl); +j = i + 1; +if (i >= nb_colors - 1) { +i = nb_colors - 1; +j = 0; +} -return lerp_color(arr[i], arr[i + 1], scl - i); +return lerp_color(arr[i], arr[j], scl - i); } -static uint64_t lerp_colors16(uint8_t arr[3][4], int nb_colors, float step) +static uint64_t lerp_colors16(uint8_t arr[3][4], int nb_colors, int nb_wrap_colors, float step) { float scl; -int i; +int i, j; if (nb_colors == 1 || step <= 0.0) { return ((uint64_t)arr[0][0] << 8) | ((uint64_t)arr[0][1] << 24) | ((uint64_t)arr[0][2] << 40) | ((uint64_t)arr[0][3] << 56); @@ -145,17 +151,23 @@ static uint64_t lerp_colors16(uint8_t arr[3][4], int nb_colors, float step) return ((uint64_t)arr[i][0] << 8) | ((uint64_t)arr[i][1] << 24) | ((uint64_t)arr[i][2] << 40) | ((uint64_t)arr[i][3] << 56); } -scl = step * (nb_colors - 1); +scl = step * (nb_wrap_colors - 1); i = floorf(scl); +j = i + 1; +if (i >= nb_colors - 1) { +i = nb_colors - 1; +j = 0; +} -return lerp_color16(arr[i], arr[i + 1], scl - i); +return lerp_color16(arr[i], arr[j], scl - i); } -static void lerp_colors32(float arr[3][4], int nb_colors, float step, +static void lerp_colors32(float arr[3][4], int nb_colors, + int nb_wrap_colors, float step, float *r, float *g, float *b, float *a) { float scl, x; -int i; +int i, j; if (nb_colors == 1 || step <= 0.0) { *r = arr[0][0]; @@ -172,31 +184,55 @@ static void lerp_colors32(float arr[3][4], int nb_colors, float step, return; } -scl = step * (nb_colors - 1); +scl = step * (nb_wrap_colors - 1); i = floorf(scl); x = scl - i; +j = i + 1; +if (i >= nb_colors - 1)
[FFmpeg-cvslog] avfilter/vsrc_gradients: add spiral type
ffmpeg | branch: master | Paul B Mahol | Tue Apr 5 17:34:33 2022 +0200| [21ca2210684b424ec34ae6a13ceec0e367654528] | committer: Paul B Mahol avfilter/vsrc_gradients: add spiral type > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=21ca2210684b424ec34ae6a13ceec0e367654528 --- doc/filters.texi | 2 +- libavfilter/vsrc_gradients.c | 15 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 7cf2ae8b0f..3fbaebb09c 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -25874,7 +25874,7 @@ supposed to be generated forever. Set speed of gradients rotation. @item type, t -Set type of gradients, can be @code{linear} or @code{radial} or @code{circular}. +Set type of gradients, can be @code{linear} or @code{radial} or @code{circular} or @code{spiral}. @end table diff --git a/libavfilter/vsrc_gradients.c b/libavfilter/vsrc_gradients.c index 61206bb2b3..c005613d42 100644 --- a/libavfilter/vsrc_gradients.c +++ b/libavfilter/vsrc_gradients.c @@ -79,11 +79,12 @@ static const AVOption gradients_options[] = { {"duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1},-1, INT64_MAX, FLAGS }, {"d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1},-1, INT64_MAX, FLAGS }, {"speed", "set gradients rotation speed", OFFSET(speed), AV_OPT_TYPE_FLOAT,{.dbl=0.01}, 0.1, 1, FLAGS }, -{"type", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "type" }, -{"t", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "type" }, +{"type", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS, "type" }, +{"t", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS, "type" }, {"linear","set gradient type",0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "type" }, {"radial","set gradient type",0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "type" }, {"circular", "set gradient type",0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "type" }, +{"spiral","set gradient type",0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, "type" }, {NULL}, }; @@ -218,6 +219,7 @@ static float project(float origin_x, float origin_y, od_s_q = sqrtf(od_x * od_x + od_y * od_y); break; case 2: +case 3: od_s_q = M_PI * 2.f; break; } @@ -232,6 +234,9 @@ static float project(float origin_x, float origin_y, case 2: op_x_od = atan2f(op_x, op_y) + M_PI; break; +case 3: +op_x_od = fmodf(atan2f(op_x, op_y) + M_PI + point_x / fmaxf(origin_x, dest_x), 2.f * M_PI); +break; } // Normalize and clamp range. @@ -252,7 +257,7 @@ static int draw_gradients_slice(AVFilterContext *ctx, void *arg, int job, int nb for (int y = start; y < end; y++) { for (int x = 0; x < width; x++) { float factor = project(s->fx0, s->fy0, s->fx1, s->fy1, x, y, s->type); -dst[x] = lerp_colors(s->color_rgba, s->nb_colors, s->nb_colors + (s->type == 2), factor); +dst[x] = lerp_colors(s->color_rgba, s->nb_colors, s->nb_colors + (s->type >= 2), factor); } dst += linesize; @@ -275,7 +280,7 @@ static int draw_gradients_slice16(AVFilterContext *ctx, void *arg, int job, int for (int y = start; y < end; y++) { for (int x = 0; x < width; x++) { float factor = project(s->fx0, s->fy0, s->fx1, s->fy1, x, y, s->type); -dst[x] = lerp_colors16(s->color_rgba, s->nb_colors, s->nb_colors + s->type == 2, factor); +dst[x] = lerp_colors16(s->color_rgba, s->nb_colors, s->nb_colors + s->type >= 2, factor); } dst += linesize; @@ -304,7 +309,7 @@ static int draw_gradients_slice32_planar(AVFilterContext *ctx, void *arg, int jo for (int y = start; y < end; y++) { for (int x = 0; x < width; x++) { float factor = project(s->fx0, s->fy0, s->fx1, s->fy1, x, y, s->type); -lerp_colors32(s->color_rgbaf, s->nb_colors, s->nb_colors + s->type == 2 ,factor, +lerp_colors32(s->color_rgbaf, s->nb_colors, s->nb_colors + s->type >= 2 ,factor, &dst_r[x], &dst_g[x], &dst_b[x], &dst_a[x]); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/codec_internal: Add FFCodec.decode_sub
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 30 19:52:41 2022 +0200| [fb59a42ef977dd91085a602f10c9c82f88d072e5] | committer: Andreas Rheinhardt avcodec/codec_internal: Add FFCodec.decode_sub This increases type-safety by avoiding conversions from/through void*. It also avoids the boilerplate "AVSubtitle *sub = data;" line for subtitle decoders. Its only downside is that it increases sizeof(FFCodec), yet this can be more than offset lateron. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fb59a42ef977dd91085a602f10c9c82f88d072e5 --- libavcodec/assdec.c | 10 -- libavcodec/ccaption_dec.c| 6 +++--- libavcodec/codec_internal.h | 11 --- libavcodec/decode.c | 2 +- libavcodec/dvbsubdec.c | 8 +++- libavcodec/dvdsubdec.c | 8 +++- libavcodec/jacosubdec.c | 7 +++ libavcodec/libaribb24.c | 6 +++--- libavcodec/libzvbi-teletextdec.c | 6 +++--- libavcodec/microdvddec.c | 7 +++ libavcodec/movtextdec.c | 7 +++ libavcodec/mpl2dec.c | 5 ++--- libavcodec/pgssubdec.c | 13 ++--- libavcodec/realtextdec.c | 7 +++ libavcodec/samidec.c | 7 +++ libavcodec/srtdec.c | 9 - libavcodec/subviewerdec.c| 7 +++ libavcodec/tests/avcodec.c | 7 --- libavcodec/textdec.c | 13 ++--- libavcodec/utils.c | 2 +- libavcodec/webvttdec.c | 7 +++ libavcodec/xsubdec.c | 8 22 files changed, 76 insertions(+), 87 deletions(-) diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c index 86d3e3e5a8..bf1260a947 100644 --- a/libavcodec/assdec.c +++ b/libavcodec/assdec.c @@ -40,11 +40,9 @@ static av_cold int ass_decode_init(AVCodecContext *avctx) return 0; } -static int ass_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, -AVPacket *avpkt) +static int ass_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, +int *got_sub_ptr, AVPacket *avpkt) { -AVSubtitle *sub = data; - if (avpkt->size <= 0) return avpkt->size; @@ -70,7 +68,7 @@ const FFCodec ff_ssa_decoder = { .p.type = AVMEDIA_TYPE_SUBTITLE, .p.id = AV_CODEC_ID_ASS, .init = ass_decode_init, -.decode = ass_decode_frame, +.decode_sub = ass_decode_frame, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; #endif @@ -82,7 +80,7 @@ const FFCodec ff_ass_decoder = { .p.type = AVMEDIA_TYPE_SUBTITLE, .p.id = AV_CODEC_ID_ASS, .init = ass_decode_init, -.decode = ass_decode_frame, +.decode_sub = ass_decode_frame, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; #endif diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c index 371c8d18b7..32ee3a715d 100644 --- a/libavcodec/ccaption_dec.c +++ b/libavcodec/ccaption_dec.c @@ -838,10 +838,10 @@ static int process_cc608(CCaptionSubContext *ctx, uint8_t hi, uint8_t lo) return ret; } -static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt) +static int decode(AVCodecContext *avctx, AVSubtitle *sub, + int *got_sub, AVPacket *avpkt) { CCaptionSubContext *ctx = avctx->priv_data; -AVSubtitle *sub = data; int64_t in_time = sub->pts; int64_t start_time; int64_t end_time; @@ -955,6 +955,6 @@ const FFCodec ff_ccaption_decoder = { .init = init_decoder, .close = close_decoder, .flush = flush_decoder, -.decode = decode, +.decode_sub = decode, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h index 596cdbebd2..5c57c438f9 100644 --- a/libavcodec/codec_internal.h +++ b/libavcodec/codec_internal.h @@ -148,19 +148,24 @@ typedef struct FFCodec { int (*encode2)(struct AVCodecContext *avctx, struct AVPacket *avpkt, const struct AVFrame *frame, int *got_packet_ptr); /** - * Decode picture or subtitle data. + * Decode picture data. * * @param avctx codec context * @param outdatacodec type dependent output struct * @param[out] got_frame_ptr decoder sets to 0 or 1 to indicate that a - *non-empty frame or subtitle was returned in - *outdata. + *non-empty frame was returned in outdata. * @param[in] avpkt AVPacket containing the data to be decoded * @return amount of bytes read from the packet on success, negative error * code on failure */ int (*decode)(struct AVCodecContext *avctx, void *outdata, int *got_frame_
[FFmpeg-cvslog] avcodec/options: Fix AVClassCategory of decoders with .receive_frame
ffmpeg | branch: master | Andreas Rheinhardt | Thu Mar 31 00:19:37 2022 +0200| [1c3c29d07d7e0b7f5bec13cb0214f90e26604aee] | committer: Andreas Rheinhardt avcodec/options: Fix AVClassCategory of decoders with .receive_frame Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1c3c29d07d7e0b7f5bec13cb0214f90e26604aee --- libavcodec/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/options.c b/libavcodec/options.c index 91ab994994..2e05d29e1e 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -68,7 +68,7 @@ static const AVClass *codec_child_class_iterate(void **iter) static AVClassCategory get_category(void *ptr) { AVCodecContext* avctx = ptr; -if (avctx->codec && ffcodec(avctx->codec)->decode) +if (avctx->codec && av_codec_is_decoder(avctx->codec)) return AV_CLASS_CATEGORY_DECODER; else return AV_CLASS_CATEGORY_ENCODER; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/codec_internal: Constify AVPacket in decode_sub cb
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 30 23:42:44 2022 +0200| [6ed0d95fa207f587b3542f3e8349932118ad8d5d] | committer: Andreas Rheinhardt avcodec/codec_internal: Constify AVPacket in decode_sub cb No subtitle decoder ever modifies the AVPacket given to it. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ed0d95fa207f587b3542f3e8349932118ad8d5d --- libavcodec/assdec.c | 2 +- libavcodec/ccaption_dec.c| 2 +- libavcodec/codec_internal.h | 2 +- libavcodec/dvbsubdec.c | 2 +- libavcodec/dvdsubdec.c | 2 +- libavcodec/jacosubdec.c | 2 +- libavcodec/libaribb24.c | 2 +- libavcodec/libzvbi-teletextdec.c | 2 +- libavcodec/microdvddec.c | 2 +- libavcodec/movtextdec.c | 2 +- libavcodec/mpl2dec.c | 2 +- libavcodec/pgssubdec.c | 2 +- libavcodec/realtextdec.c | 2 +- libavcodec/samidec.c | 2 +- libavcodec/srtdec.c | 2 +- libavcodec/subviewerdec.c| 2 +- libavcodec/textdec.c | 2 +- libavcodec/webvttdec.c | 2 +- libavcodec/xsubdec.c | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c index b94629ea1d..f43b500aa7 100644 --- a/libavcodec/assdec.c +++ b/libavcodec/assdec.c @@ -41,7 +41,7 @@ static av_cold int ass_decode_init(AVCodecContext *avctx) } static int ass_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, -int *got_sub_ptr, AVPacket *avpkt) +int *got_sub_ptr, const AVPacket *avpkt) { if (avpkt->size <= 0) return avpkt->size; diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c index e33fb36824..34f0513b1a 100644 --- a/libavcodec/ccaption_dec.c +++ b/libavcodec/ccaption_dec.c @@ -839,7 +839,7 @@ static int process_cc608(CCaptionSubContext *ctx, uint8_t hi, uint8_t lo) } static int decode(AVCodecContext *avctx, AVSubtitle *sub, - int *got_sub, AVPacket *avpkt) + int *got_sub, const AVPacket *avpkt) { CCaptionSubContext *ctx = avctx->priv_data; int64_t in_time = sub->pts; diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h index a14f6592fe..5df286ce52 100644 --- a/libavcodec/codec_internal.h +++ b/libavcodec/codec_internal.h @@ -184,7 +184,7 @@ typedef struct FFCodec { * Apart from that this is like the decode callback. */ int (*decode_sub)(struct AVCodecContext *avctx, struct AVSubtitle *sub, - int *got_frame_ptr, struct AVPacket *avpkt); + int *got_frame_ptr, const struct AVPacket *avpkt); /** * Decode API with decoupled packet/frame dataflow. * cb is in this state if cb_type is FF_CODEC_CB_TYPE_RECEIVE_FRAME. diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index 58e18cfece..6e510d12c7 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1608,7 +1608,7 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, } static int dvbsub_decode(AVCodecContext *avctx, AVSubtitle *sub, - int *got_sub_ptr, AVPacket *avpkt) + int *got_sub_ptr, const AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index 2951e74736..2aa6983490 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -549,7 +549,7 @@ static int append_to_cached_buf(AVCodecContext *avctx, } static int dvdsub_decode(AVCodecContext *avctx, AVSubtitle *sub, - int *data_size, AVPacket *avpkt) + int *data_size, const AVPacket *avpkt) { DVDSubContext *ctx = avctx->priv_data; const uint8_t *buf = avpkt->data; diff --git a/libavcodec/jacosubdec.c b/libavcodec/jacosubdec.c index 245ae1..e3bf9f4226 100644 --- a/libavcodec/jacosubdec.c +++ b/libavcodec/jacosubdec.c @@ -163,7 +163,7 @@ static void jacosub_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *src } static int jacosub_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, -int *got_sub_ptr, AVPacket *avpkt) +int *got_sub_ptr, const AVPacket *avpkt) { int ret; const char *ptr = avpkt->data; diff --git a/libavcodec/libaribb24.c b/libavcodec/libaribb24.c index e1a26e5659..9658e1d5ac 100644 --- a/libavcodec/libaribb24.c +++ b/libavcodec/libaribb24.c @@ -284,7 +284,7 @@ next_region: } static int libaribb24_decode(AVCodecContext *avctx, AVSubtitle *sub, - int *got_sub_ptr, AVPacket *pkt) + int *got_sub_ptr, const AVPacket *pkt) { Libaribb24Context *b24 = avctx->priv_data; size_t parsed_data_size = 0; di
[FFmpeg-cvslog] avcodec/vp9_raw_reorder_bsf: Fix leak of cached packet
ffmpeg | branch: master | Andreas Rheinhardt | Thu Mar 31 12:38:24 2022 +0200| [ebec6079414262fdc6e161b73f4ac38cd6e4a276] | committer: Andreas Rheinhardt avcodec/vp9_raw_reorder_bsf: Fix leak of cached packet In case the BSF has not been drained before flushing/closing, the context's next_frame might be set; yet it is not freed in flush or close. The former only zeroes it (which automatically causes a leak in case it was set). So do this when closing and flushing. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ebec6079414262fdc6e161b73f4ac38cd6e4a276 --- libavcodec/vp9_raw_reorder_bsf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/vp9_raw_reorder_bsf.c b/libavcodec/vp9_raw_reorder_bsf.c index e7d301cb85..368dcb26c2 100644 --- a/libavcodec/vp9_raw_reorder_bsf.c +++ b/libavcodec/vp9_raw_reorder_bsf.c @@ -396,7 +396,7 @@ static void vp9_raw_reorder_flush(AVBSFContext *bsf) for (int s = 0; s < FRAME_SLOTS; s++) vp9_raw_reorder_clear_slot(ctx, s); -ctx->next_frame = NULL; +vp9_raw_reorder_frame_free(&ctx->next_frame); ctx->sequence = 0; } @@ -407,6 +407,7 @@ static void vp9_raw_reorder_close(AVBSFContext *bsf) for (s = 0; s < FRAME_SLOTS; s++) vp9_raw_reorder_clear_slot(ctx, s); +vp9_raw_reorder_frame_free(&ctx->next_frame); } static const enum AVCodecID vp9_raw_reorder_codec_ids[] = { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mpegenc: Fix ever growing FIFO and infinite loop on error
ffmpeg | branch: master | Andreas Rheinhardt | Fri Apr 1 10:05:16 2022 +0200| [a68a6322b78c27a58ab32174814efadf79701226] | committer: Andreas Rheinhardt avformat/mpegenc: Fix ever growing FIFO and infinite loop on error Since the switch to the new FIFO API in commit ea511196a6c85eb433e10cdbecb0b2c722faf20d, the FIFO is always grown by the amount of data intended to be written into it even in case the FIFO has enough free space. Fix this by only growing the FIFO if needed and then only by the amount that is actually needed. The allocation errors that resulted from this uncovered another bug: The context is left in an inconsistent state in case the FIFO can't be grown, because the FIFO does not contain as much data as the sizes contained in the PacketDesc list claim. This led to an infinite loop in output_packet() (called from mpeg_mux_end()). Fix this by growing the FIFO before adding a new PacketDesc element, thereby preventing the context from becoming inconsistent. Reported-by: Nicolas Gaullier Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a68a6322b78c27a58ab32174814efadf79701226 --- libavformat/mpegenc.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index cc47a43288..62692bfcd1 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -1152,6 +1152,7 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) int64_t pts, dts; PacketDesc *pkt_desc; int preload, ret; +size_t can_write; const int is_iframe = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && (pkt->flags & AV_PKT_FLAG_KEY); @@ -1192,6 +1193,14 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) size -= 3; } +/* Enlarge the FIFO before adding a new PacketDesc + * in order to avoid inconsistencies on failure. */ +can_write = av_fifo_can_write(stream->fifo); +if (can_write < size) { +ret = av_fifo_grow2(stream->fifo, size - can_write); +if (ret < 0) +return ret; +} pkt_desc = av_mallocz(sizeof(PacketDesc)); if (!pkt_desc) return AVERROR(ENOMEM); @@ -1207,10 +1216,6 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) pkt_desc->unwritten_size = pkt_desc->size = size; -ret = av_fifo_grow2(stream->fifo, size); -if (ret < 0) -return ret; - if (s->is_dvd) { // min VOBU length 0.4 seconds (mpucoder) if (is_iframe && ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vp9_raw_reorder_bsf: Merge close and flush
ffmpeg | branch: master | Andreas Rheinhardt | Thu Mar 31 22:02:48 2022 +0200| [24fd3ff5a2e93fd9761c8a050f98e20d74b6dc6c] | committer: Andreas Rheinhardt avcodec/vp9_raw_reorder_bsf: Merge close and flush Also mark the function as av_cold while at it. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24fd3ff5a2e93fd9761c8a050f98e20d74b6dc6c --- libavcodec/vp9_raw_reorder_bsf.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/libavcodec/vp9_raw_reorder_bsf.c b/libavcodec/vp9_raw_reorder_bsf.c index 368dcb26c2..d36093316c 100644 --- a/libavcodec/vp9_raw_reorder_bsf.c +++ b/libavcodec/vp9_raw_reorder_bsf.c @@ -390,7 +390,7 @@ fail: return err; } -static void vp9_raw_reorder_flush(AVBSFContext *bsf) +static av_cold void vp9_raw_reorder_flush_close(AVBSFContext *bsf) { VP9RawReorderContext *ctx = bsf->priv_data; @@ -400,16 +400,6 @@ static void vp9_raw_reorder_flush(AVBSFContext *bsf) ctx->sequence = 0; } -static void vp9_raw_reorder_close(AVBSFContext *bsf) -{ -VP9RawReorderContext *ctx = bsf->priv_data; -int s; - -for (s = 0; s < FRAME_SLOTS; s++) -vp9_raw_reorder_clear_slot(ctx, s); -vp9_raw_reorder_frame_free(&ctx->next_frame); -} - static const enum AVCodecID vp9_raw_reorder_codec_ids[] = { AV_CODEC_ID_VP9, AV_CODEC_ID_NONE, }; @@ -418,7 +408,7 @@ const FFBitStreamFilter ff_vp9_raw_reorder_bsf = { .p.name = "vp9_raw_reorder", .p.codec_ids= vp9_raw_reorder_codec_ids, .priv_data_size = sizeof(VP9RawReorderContext), -.close = &vp9_raw_reorder_close, -.flush = &vp9_raw_reorder_flush, .filter = &vp9_raw_reorder_filter, +.flush = &vp9_raw_reorder_flush_close, +.close = &vp9_raw_reorder_flush_close, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] tests: use a filtergraph script for fate-mov-channel-description
ffmpeg | branch: master | James Almer | Tue Apr 5 20:57:33 2022 -0300| [c9ecbc08a17d8e7ed52a2abaaa97caa197e2e7bc] | committer: James Almer tests: use a filtergraph script for fate-mov-channel-description Should fix running the test on certain shells Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c9ecbc08a17d8e7ed52a2abaaa97caa197e2e7bc --- tests/fate/mov.mak | 4 ++-- tests/filtergraphs/mov-channel-description | 8 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index 5d9f183203..675c34a07d 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -157,8 +157,8 @@ FATE_MOV_FFMPEG-$(call ALLYES, FILE_PROTOCOL PIPE_PROTOCOL \ WAV_DEMUXER PAN_FILTER PCM_S16LE_ENCODER \ MOV_MUXER FRAMECRC_MUXER ) \ += fate-mov-channel-description -fate-mov-channel-description: tests/data/asynth-44100-1.wav -fate-mov-channel-description: CMD = transcode wav $(TARGET_PATH)/tests/data/asynth-44100-1.wav mov "-filter_complex [0:a:0]pan=FL|c0=c0[outFL] -map [outFL] -filter_complex [0:a:0]pan=FR|c0=c1[outFR] -map [outFR] -filter_complex [0:a:0]pan=FC|c0=c2[outFC] -map [outFC] -filter_complex [0:a:0]pan=LFE|c0=c3[outLFE] -map [outLFE] -filter_complex [0:a:0]pan=BL|c0=c4[outBL] -map [outBL] -filter_complex [0:a:0]pan=BR|c0=c5[outBR] -map [outBR] -filter_complex [0:a:0]pan=DL|c0=c6[outDL] -map [outDL] -filter_complex [0:a:0]pan=DR|c0=c7[outDR] -map [outDR] -c:a pcm_s16le" "-map 0 -c copy -frames:a 0" +fate-mov-channel-description: tests/data/asynth-44100-1.wav tests/data/filtergraphs/mov-channel-description +fate-mov-channel-description: CMD = transcode wav $(TARGET_PATH)/tests/data/asynth-44100-1.wav mov "-filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/mov-channel-description -map [outFL] -map [outFR] -map [outFC] -map [outLFE] -map [outBL] -map [outBR] -map [outDL] -map [outDR] -c:a pcm_s16le" "-map 0 -c copy -frames:a 0" FATE_FFMPEG += $(FATE_MOV_FFMPEG-yes) diff --git a/tests/filtergraphs/mov-channel-description b/tests/filtergraphs/mov-channel-description new file mode 100644 index 00..df89347a51 --- /dev/null +++ b/tests/filtergraphs/mov-channel-description @@ -0,0 +1,8 @@ +[0:a:0]pan=FL|c0=c0[outFL]; +[0:a:0]pan=FR|c0=c1[outFR]; +[0:a:0]pan=FC|c0=c2[outFC]; +[0:a:0]pan=LFE|c0=c3[outLFE]; +[0:a:0]pan=BL|c0=c4[outBL]; +[0:a:0]pan=BR|c0=c5[outBR]; +[0:a:0]pan=DL|c0=c6[outDL]; +[0:a:0]pan=DR|c0=c7[outDR] ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/libvpxenc: enable dynamic max quantizer reconfiguration
ffmpeg | branch: master | Danil Chapovalov | Wed Mar 30 20:24:32 2022 +0200| [706f12992dbe22617ba0406cfff09201bc905b4e] | committer: James Zern avcodec/libvpxenc: enable dynamic max quantizer reconfiguration Signed-off-by: James Zern > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=706f12992dbe22617ba0406cfff09201bc905b4e --- doc/encoders.texi | 3 +++ libavcodec/libvpxenc.c | 10 ++ libavcodec/version.h | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 4b8cc69c0d..a304f865a6 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1996,8 +1996,11 @@ kilobits/s. @item keyint_min (@emph{kf-min-dist}) @item qmin (@emph{min-q}) +Minimum (Best Quality) Quantizer. @item qmax (@emph{max-q}) +Maximum (Worst Quality) Quantizer. +Can be changed per-frame. @item bufsize (@emph{buf-sz}, @emph{buf-optimal-sz}) Set ratecontrol buffer size (in bits). Note @command{vpxenc}'s options are diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 7438ad87a3..e35b47b87e 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -1629,6 +1629,16 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt, vpx_svc_layer_id_t layer_id; int layer_id_valid = 0; +if (avctx->qmax >= 0 && enccfg->rc_max_quantizer != avctx->qmax) { +struct vpx_codec_enc_cfg cfg = *enccfg; +cfg.rc_max_quantizer = avctx->qmax; +res = vpx_codec_enc_config_set(&ctx->encoder, &cfg); +if (res != VPX_CODEC_OK) { +log_encoder_error(avctx, "Error reconfiguring encoder"); +return AVERROR_INVALIDDATA; +} +} + if (frame) { const AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_REGIONS_OF_INTEREST); rawimg = &ctx->rawimg; diff --git a/libavcodec/version.h b/libavcodec/version.h index a744e7469f..aa3a484c51 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -30,7 +30,7 @@ #include "version_major.h" #define LIBAVCODEC_VERSION_MINOR 25 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".