[FFmpeg-cvslog] doc/ffmpeg.texi: replace use of uncommon unicode characters
ffmpeg | branch: master | James Almer | Wed Dec 25 20:53:38 2024 -0300| [6ffbc22b53937fee6e35093d9ce981cd43bf3d88] | committer: James Almer doc/ffmpeg.texi: replace use of uncommon unicode characters Addresses ticket #11372 Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ffbc22b53937fee6e35093d9ce981cd43bf3d88 --- doc/ffmpeg.texi | 64 - 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index a63e55bd66..9be0f79b33 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -116,11 +116,11 @@ A schematic representation of a demuxer looks like this: @verbatim ┌──┬───┐ │ demuxer │ │ packets for stream 0 -╞══╡ elementary stream 0 ├──⮞ +╞══╡ elementary stream 0 ├──► │ │ │ │ global ├───┤ │properties│ │ packets for stream 1 -│ and│ elementary stream 1 ├──⮞ +│ and│ elementary stream 1 ├──► │ metadata │ │ │ ├───┤ │ │ │ @@ -128,10 +128,10 @@ A schematic representation of a demuxer looks like this: │ │ │ │ ├───┤ │ │ │ packets for stream N -│ │ elementary stream N ├──⮞ +│ │ elementary stream N ├──► │ │ │ └──┴───┘ - ⯅ + ▲ │ │ read from file, network stream, │ grabbing device, etc. @@ -149,7 +149,7 @@ A schematic representation of a decoder looks like this: @verbatim ┌─┐ packets │ │ raw frames -─⮞│ decoder ├⮞ +─►│ decoder ├► │ │ └─┘ @end verbatim @@ -174,7 +174,7 @@ this: │ simple filtergraph│ frames from ╞╡ frames for a decoder │ ┌───┐ ┌───┐ │ an encoder -⮞├─⮞│ yadif ├─⮞│ scale ├─⮞│⮞ +►├─►│ yadif ├─►│ scale ├─►│► │ └───┘ └───┘ │ └┘ @end verbatim @@ -192,13 +192,13 @@ The following example diagram represents a complex filtergraph with 3 inputs and │ complex filtergraph │ ╞═╡ frames ├───┐ ┌─┐ ┌─┐ ┌┤ frames -─⮞│input 0├─⮞│ overlay ├─⮞│ overlay ├─⮞│output 0├⮞ +─►│input 0├─►│ overlay ├─►│ overlay ├─►│output 0├► ├───┘ │ │ │ │ └┤ - frames ├───┐╭⮞│ │╭⮞│ │ │ -─⮞│input 1├╯ └─┘│ └─┘ │ + frames ├───┐╭►│ │╭►│ │ │ +─►│input 1├╯ └─┘│ └─┘ │ ├───┘ │ │ frames ├───┐ ┌─┐ ┌─┬─╯ ┌┤ frames -─⮞│input 2├⮞│scale├⮞│split├───⮞│output 1├⮞ +─►│input 2├►│scale├►│split├───►│output 1├► ├───┘ └─┘ └─┘└┤ └─┘ @end verbatim @@ -222,7 +222,7 @@ A schematic representation of an encoder looks like this: @verbatim ┌─┐ raw frames │ │ packets -⮞│ encoder ├─⮞ +►│ encoder ├─► │ │ └─┘ @end verbatim @@ -238,11 +238,11 @@ A schematic representation of a muxer looks like this: @verbatim ┌──┬───┐ packets for stream 0 │ │ muxer │ -──⮞│ elementary stream 0 ╞═══╡ +──►│ elementary stream 0 ╞═══╡ │ │ │ ├──┤ global │ packets for stream 1 │ │properties │ -──⮞│ elementary stream 1 │ and │ +──►│ elementary stream 1 │ and │ │ │ metadata │ ├──┤ │ │ │ │ @@ -250,7 +250,7 @@ A schematic representation of a muxer looks like this: │ │ │ ├──┤ │ packets for stream N │ │
[FFmpeg-cvslog] avcodec/libx265: ignore user set alpha x265-param
ffmpeg | branch: master | James Almer | Thu Dec 26 13:41:04 2024 -0300| [7e778586e7efceacae33b12b9b3673838060f8f2] | committer: James Almer avcodec/libx265: ignore user set alpha x265-param It makes no difference when the input has an alpha plane, and may end up in crashes or undefined behavior if it doesn't. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e778586e7efceacae33b12b9b3673838060f8f2 --- libavcodec/cbs_h2645.c | 6 +++--- libavcodec/libx265.c | 16 +++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index 369e3ac876..647b1c785e 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -499,9 +499,9 @@ static int cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx, size_t size = nal->size; enum AVCodecID codec_id = ctx->codec->codec_id; -if (codec_id == AV_CODEC_ID_HEVC && nal->nuh_layer_id > 0 && -(nal->type < HEVC_NAL_VPS || nal->type > HEVC_NAL_PPS)) -continue; +//if (codec_id == AV_CODEC_ID_HEVC && nal->nuh_layer_id > 0 && + // (nal->type < HEVC_NAL_VPS || nal->type > HEVC_NAL_PPS)) +//continue; // Remove trailing zeroes. while (size > 0 && nal->data[size - 1] == 0) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index aa9b9e4c46..db0f0972df 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -505,8 +505,22 @@ FF_ENABLE_DEPRECATION_WARNINGS { const AVDictionaryEntry *en = NULL; while ((en = av_dict_iterate(ctx->x265_opts, en))) { -int parse_ret = ctx->api->param_parse(ctx->params, en->key, en->value); +int parse_ret; +// ignore forced alpha option. The pixel format is all we need. +if (!strncmp(en->key, "alpha", 5)) { +if (desc->nb_components == 4) { +av_log(avctx, AV_LOG_WARNING, + "Ignoring redundant \"alpha\" option.\n"); +continue; +} +av_log(avctx, AV_LOG_ERROR, + "Alpha encoding was requested through an unsupported " + "option when no alpha plane is present\n"); +return AVERROR(EINVAL); +} + +parse_ret = ctx->api->param_parse(ctx->params, en->key, en->value); switch (parse_ret) { case X265_PARAM_BAD_NAME: av_log(avctx, AV_LOG_WARNING, ___ 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] fftools/ffmpeg_opt: Fix precedence issue in abs_start_seek calculation
ffmpeg | branch: master | Pradeep Kumar Goudagunta | Wed Dec 25 17:39:27 2024 -0600| [aa20294b317558957cf124bb8e4da0521ab3c423] | committer: Gyan Doshi fftools/ffmpeg_opt: Fix precedence issue in abs_start_seek calculation This patch corrects a C operator precedence issue in fftools/ffmpeg_opt.c where the abs_start_seek calculation did not yield the expected result due to incorrect placement of parentheses. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aa20294b317558957cf124bb8e4da0521ab3c423 --- fftools/ffmpeg_opt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 9bf0c4f0c4..5777c71236 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -354,7 +354,7 @@ static void correct_input_start_times(void) if (copy_ts && start_at_zero) ifile->ts_offset = -new_start_time; else if (!copy_ts) { -abs_start_seek = is->start_time + (ifile->start_time != AV_NOPTS_VALUE) ? ifile->start_time : 0; +abs_start_seek = is->start_time + ((ifile->start_time != AV_NOPTS_VALUE) ? ifile->start_time : 0); ifile->ts_offset = abs_start_seek > new_start_time ? -abs_start_seek : -new_start_time; } else if (copy_ts) ifile->ts_offset = 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] ffmpeg_sched: return better error code
ffmpeg | branch: master | Gyan Doshi | Sat Dec 21 10:10:57 2024 +0530| [fe04b93afae27351d421bf0b1bf1a6b702adc3c6] | committer: Gyan Doshi ffmpeg_sched: return better error code The existing code of 'No space left on device' leaves end users confused since the issue isn't of disk space. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fe04b93afae27351d421bf0b1bf1a6b702adc3c6 --- fftools/ffmpeg_sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c index 420d3f9ce9..e6d22063d7 100644 --- a/fftools/ffmpeg_sched.c +++ b/fftools/ffmpeg_sched.c @@ -1836,7 +1836,7 @@ static int mux_queue_packet(SchMux *mux, SchMuxStream *ms, AVPacket *pkt) if (new_size <= packets) { av_log(mux, AV_LOG_ERROR, "Too many packets buffered for output stream.\n"); -return AVERROR(ENOSPC); +return AVERROR_BUFFER_TOO_SMALL; } ret = av_fifo_grow2(q->fifo, new_size - packets); if (ret < 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] swscale/utils: add return code to fill_xyztables()
ffmpeg | branch: master | Niklas Haas | Mon Dec 23 13:13:00 2024 +0100| [60bfafcd8a943f4ec03a7e80460f8e22abbb4781] | committer: Niklas Haas swscale/utils: add return code to fill_xyztables() Needed for lazy allocation of XYZ tables. Signed-off-by: Niklas Haas > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=60bfafcd8a943f4ec03a7e80460f8e22abbb4781 --- libswscale/utils.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/libswscale/utils.c b/libswscale/utils.c index 5235cbed8d..82bb93e184 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -936,7 +936,7 @@ static void fill_rgb2yuv_table(SwsInternal *c, const int table[4], int dstRange) AV_WL16(p + 16*4 + 2*i, map[i] >= 0 ? c->input_rgb2yuv_table[map[i]] : 0); } -static void fill_xyztables(SwsInternal *c) +static int fill_xyztables(SwsInternal *c) { int i; double xyzgamma = XYZ_GAMMA; @@ -962,7 +962,7 @@ static void fill_xyztables(SwsInternal *c) c->rgbgammainv = rgbgammainv_tab; if (xyzgamma_tab[4095]) -return; +return 0; /* set input gamma vectors */ for (i = 0; i < 4096; i++) { @@ -975,6 +975,7 @@ static void fill_xyztables(SwsInternal *c) rgbgamma_tab[i] = lrint(pow(i / 65535.0, rgbgamma) * 4095.0); xyzgammainv_tab[i] = lrint(pow(i / 65535.0, xyzgammainv) * 4095.0); } +return 0; } static int handle_jpeg(enum AVPixelFormat *format) @@ -1035,7 +1036,7 @@ static int handle_xyz(enum AVPixelFormat *format) } } -static void handle_formats(SwsContext *sws) +static int handle_formats(SwsContext *sws) { SwsInternal *c = sws_internal(sws); c->src0Alpha |= handle_0alpha(&sws->src_format); @@ -1043,7 +1044,9 @@ static void handle_formats(SwsContext *sws) c->srcXYZ|= handle_xyz(&sws->src_format); c->dstXYZ|= handle_xyz(&sws->dst_format); if (c->srcXYZ || c->dstXYZ) -fill_xyztables(c); +return fill_xyztables(c); +else +return 0; } static int range_override_needed(enum AVPixelFormat format) @@ -1058,7 +1061,7 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], SwsInternal *c = sws_internal(sws); const AVPixFmtDescriptor *desc_dst; const AVPixFmtDescriptor *desc_src; -int need_reinit = 0; +int ret, need_reinit = 0; if (c->nb_slice_ctx) { int parent_ret = 0; @@ -1073,7 +1076,9 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], return parent_ret; } -handle_formats(sws); +ret = handle_formats(sws); +if (ret < 0) +return ret; desc_dst = av_pix_fmt_desc_get(sws->dst_format); desc_src = av_pix_fmt_desc_get(sws->src_format); @@ -1353,7 +1358,9 @@ av_cold int ff_sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], sws->dst_range, 0, 1 << 16, 1 << 16); -handle_formats(sws); +ret = handle_formats(sws); +if (ret < 0) +return ret; srcFormat = sws->src_format; dstFormat = sws->dst_format; desc_src = av_pix_fmt_desc_get(srcFormat); ___ 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] swscale: use 16-bit intermediate precision for RGB/XYZ conversion
ffmpeg | branch: master | Niklas Haas | Mon Dec 16 14:49:39 2024 +0100| [af6d52eec66961f6a502b0f2f390c12226d087cd] | committer: Niklas Haas swscale: use 16-bit intermediate precision for RGB/XYZ conversion The current logic uses 12-bit linear light math, which is woefully insufficient and leads to nasty postarization artifacts. This patch simply switches the internal logic to 16-bit precision. This raises the memory requirement of these tables from 32 kB to 272 kB. All relevant FATE tests updated for improved accuracy. Fixes: #4829 Signed-off-by: Niklas Haas Sponsored-by: Sovereign Tech Fund > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af6d52eec66961f6a502b0f2f390c12226d087cd --- libswscale/swscale.c | 16 libswscale/swscale_internal.h| 8 libswscale/utils.c | 19 --- tests/ref/fate/filter-pixdesc-xyz12be| 2 +- tests/ref/fate/filter-pixdesc-xyz12le| 2 +- tests/ref/fate/filter-pixfmts-copy | 4 ++-- tests/ref/fate/filter-pixfmts-crop | 4 ++-- tests/ref/fate/filter-pixfmts-field | 4 ++-- tests/ref/fate/filter-pixfmts-fieldorder | 4 ++-- tests/ref/fate/filter-pixfmts-hflip | 4 ++-- tests/ref/fate/filter-pixfmts-il | 4 ++-- tests/ref/fate/filter-pixfmts-null | 4 ++-- tests/ref/fate/filter-pixfmts-scale | 4 ++-- tests/ref/fate/filter-pixfmts-transpose | 4 ++-- tests/ref/fate/filter-pixfmts-vflip | 4 ++-- tests/ref/pixfmt/gbrp-xyz12le| 2 +- tests/ref/pixfmt/gbrp10-xyz12le | 2 +- tests/ref/pixfmt/gbrp12-xyz12le | 2 +- tests/ref/pixfmt/rgb24-xyz12le | 2 +- tests/ref/pixfmt/rgb48-xyz12le | 2 +- tests/ref/pixfmt/xyz12le | 2 +- tests/ref/pixfmt/yuv444p-xyz12le | 2 +- tests/ref/pixfmt/yuv444p10-xyz12le | 2 +- tests/ref/pixfmt/yuv444p12-xyz12le | 2 +- 24 files changed, 55 insertions(+), 50 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 831657f75c..61a40373f3 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -773,10 +773,10 @@ void ff_xyz12Torgb48(const SwsInternal *c, uint8_t *dst, int dst_stride, c->xyz2rgb_matrix[2][1] * y + c->xyz2rgb_matrix[2][2] * z >> 12; -// limit values to 12-bit depth -r = av_clip_uintp2(r, 12); -g = av_clip_uintp2(g, 12); -b = av_clip_uintp2(b, 12); +// limit values to 16-bit depth +r = av_clip_uint16(r); +g = av_clip_uint16(g); +b = av_clip_uint16(b); // convert from sRGBlinear to RGB and scale from 12bit to 16bit if (desc->flags & AV_PIX_FMT_FLAG_BE) { @@ -832,10 +832,10 @@ void ff_rgb48Toxyz12(const SwsInternal *c, uint8_t *dst, int dst_stride, c->rgb2xyz_matrix[2][1] * g + c->rgb2xyz_matrix[2][2] * b >> 12; -// limit values to 12-bit depth -x = av_clip_uintp2(x, 12); -y = av_clip_uintp2(y, 12); -z = av_clip_uintp2(z, 12); +// limit values to 16-bit depth +x = av_clip_uint16(x); +y = av_clip_uint16(y); +z = av_clip_uint16(z); // convert from XYZlinear to X'Y'Z' and scale from 12bit to 16bit if (desc->flags & AV_PIX_FMT_FLAG_BE) { diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 98b8535c9b..68e6754d9d 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -547,10 +547,10 @@ struct SwsInternal { /* pre defined color-spaces gamma */ #define XYZ_GAMMA (2.6f) #define RGB_GAMMA (2.2f) -int16_t *xyzgamma; -int16_t *rgbgamma; -int16_t *xyzgammainv; -int16_t *rgbgammainv; +uint16_t *xyzgamma; +uint16_t *rgbgamma; +uint16_t *xyzgammainv; +uint16_t *rgbgammainv; int16_t xyz2rgb_matrix[3][4]; int16_t rgb2xyz_matrix[3][4]; diff --git a/libswscale/utils.c b/libswscale/utils.c index 80752b7fb0..5235cbed8d 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -951,7 +951,8 @@ static void fill_xyztables(SwsInternal *c) {1689, 1464, 739}, { 871, 2929, 296}, { 79, 488, 3891} }; -static int16_t xyzgamma_tab[4096], rgbgamma_tab[4096], xyzgammainv_tab[4096], rgbgammainv_tab[4096]; +static uint16_t xyzgamma_tab[4096], rgbgammainv_tab[4096]; +static uint16_t rgbgamma_tab[65536], xyzgammainv_tab[65536]; memcpy(c->xyz2rgb_matrix, xyz2rgb_matrix, sizeof(c->xyz2rgb_matrix)); memcpy(c->rgb2xyz_matrix, rgb2xyz_matrix, sizeof(c->rgb2xyz_matrix)); @@ -960,15 +961,19 @@ static void fill_xyztables(SwsInternal *c) c->xyzgammainv = xyzgammainv_tab; c->rgbgammainv = rgbgammainv_tab; -if (rgbgamma_tab[4095]) +if (xyzgamma_tab[4095]) return; -/* set gamma vectors */ +
[FFmpeg-cvslog] swscale/utils: lazily allocate XYZ tables on CONFIG_SMALL
ffmpeg | branch: master | Niklas Haas | Mon Dec 23 13:21:21 2024 +0100| [59258fb90ee0cff10c3668374dbbb13edbdac86c] | committer: Niklas Haas swscale/utils: lazily allocate XYZ tables on CONFIG_SMALL This has the downside of requiring these tables to be recomputed on every init, but saves ~270 kB of static data. Signed-off-by: Niklas Haas > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59258fb90ee0cff10c3668374dbbb13edbdac86c --- libswscale/utils.c | 26 +- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/libswscale/utils.c b/libswscale/utils.c index 82bb93e184..10b1f0701a 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -951,29 +951,42 @@ static int fill_xyztables(SwsInternal *c) {1689, 1464, 739}, { 871, 2929, 296}, { 79, 488, 3891} }; +#if !CONFIG_SMALL static uint16_t xyzgamma_tab[4096], rgbgammainv_tab[4096]; static uint16_t rgbgamma_tab[65536], xyzgammainv_tab[65536]; +#endif +if (c->xyzgamma) +return 0; memcpy(c->xyz2rgb_matrix, xyz2rgb_matrix, sizeof(c->xyz2rgb_matrix)); memcpy(c->rgb2xyz_matrix, rgb2xyz_matrix, sizeof(c->rgb2xyz_matrix)); + +#if CONFIG_SMALL +c->xyzgamma = av_malloc(sizeof(uint16_t) * 2 * (4096 + 65536)); +if (!c->xyzgamma) +return AVERROR(ENOMEM); +c->rgbgammainv = c->xyzgamma + 4096; +c->rgbgamma = c->rgbgammainv + 4096; +c->xyzgammainv = c->rgbgamma + 65536; +#else c->xyzgamma = xyzgamma_tab; c->rgbgamma = rgbgamma_tab; c->xyzgammainv = xyzgammainv_tab; c->rgbgammainv = rgbgammainv_tab; - if (xyzgamma_tab[4095]) return 0; +#endif /* set input gamma vectors */ for (i = 0; i < 4096; i++) { -xyzgamma_tab[i] = lrint(pow(i / 4095.0, xyzgamma) * 65535.0); -rgbgammainv_tab[i] = lrint(pow(i / 4095.0, rgbgammainv) * 65535.0); +c->xyzgamma[i]= lrint(pow(i / 4095.0, xyzgamma) * 65535.0); +c->rgbgammainv[i] = lrint(pow(i / 4095.0, rgbgammainv) * 65535.0); } /* set output gamma vectors */ for (i = 0; i < 65536; i++) { -rgbgamma_tab[i] = lrint(pow(i / 65535.0, rgbgamma) * 4095.0); -xyzgammainv_tab[i] = lrint(pow(i / 65535.0, xyzgammainv) * 4095.0); +c->rgbgamma[i]= lrint(pow(i / 65535.0, rgbgamma) * 4095.0); +c->xyzgammainv[i] = lrint(pow(i / 65535.0, xyzgammainv) * 4095.0); } return 0; } @@ -2529,6 +2542,9 @@ void sws_freeContext(SwsContext *sws) av_freep(&c->gamma); av_freep(&c->inv_gamma); +#if CONFIG_SMALL +av_freep(&c->xyzgamma); +#endif av_freep(&c->rgb0_scratch); av_freep(&c->xyz_scratch); ___ 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] swscale/unscaled: add pal8 -> gbr(a)p special converter
ffmpeg | branch: master | Niklas Haas | Wed Dec 18 15:07:33 2024 +0100| [8cf2d97280400b2c94ceeb3ed8f3aa1c687aaf40] | committer: Niklas Haas swscale/unscaled: add pal8 -> gbr(a)p special converter Fixes: #9520 Signed-off-by: Niklas Haas Sponsored-by: Sovereign Tech Fund > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8cf2d97280400b2c94ceeb3ed8f3aa1c687aaf40 --- libswscale/swscale.c | 8 + libswscale/swscale_unscaled.c | 81 +-- 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 4e06870fa4..831657f75c 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -919,6 +919,14 @@ void ff_update_palette(SwsInternal *c, const uint32_t *pal) #endif c->pal_rgb[i]= a + (b<<8) + (g<<16) + ((unsigned)r<<24); break; +case AV_PIX_FMT_GBRP: +case AV_PIX_FMT_GBRAP: +#if HAVE_BIGENDIAN +c->pal_rgb[i]= a + (r<<8) + (b<<16) + ((unsigned)g<<24); +#else +c->pal_rgb[i]= g + (b<<8) + (r<<16) + ((unsigned)a<<24); +#endif +break; case AV_PIX_FMT_RGB32: #if !HAVE_BIGENDIAN case AV_PIX_FMT_BGR24: diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 907c1600c5..dae3f45df9 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -509,6 +509,34 @@ static void gray8aToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, } } +static void gray8aToPlanar8(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, +uint8_t *dst2, uint8_t *dstA, int num_pixels, +const uint8_t *palette) +{ +for (int i = 0; i < num_pixels; i++) { +const uint8_t *rgb = &palette[src[i << 1] * 4]; +dst0[i] = rgb[0]; +dst1[i] = rgb[1]; +dst2[i] = rgb[2]; +if (dstA) +dstA[i] = src[(i << 1) + 1]; +} +} + +static void pal8ToPlanar8(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, + uint8_t *dst2, uint8_t *dstA, int num_pixels, + const uint8_t *palette) +{ +for (int i = 0; i < num_pixels; i++) { +const uint8_t *rgba = &palette[src[i] * 4]; +dst0[i] = rgba[0]; +dst1[i] = rgba[1]; +dst2[i] = rgba[2]; +if (dstA) +dstA[i] = rgba[3]; +} +} + static int bswap_16bpc(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) @@ -610,6 +638,45 @@ static int palToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int return srcSliceH; } +static int palToGbrpWrapper(SwsInternal *c, const uint8_t *const src[], +const int srcStride[], int srcSliceY, int srcSliceH, +uint8_t *const dst[], const int dstStride[]) +{ +const enum AVPixelFormat srcFormat = c->opts.src_format; +const enum AVPixelFormat dstFormat = c->opts.dst_format; +void (*conv)(const uint8_t *src, uint8_t *dstG, uint8_t *dstB, uint8_t *dstR, + uint8_t *dstA, int num_pixels, const uint8_t *palette) = NULL; + +const int num_planes = isALPHA(dstFormat) ? 4 : 3; +const uint8_t *srcPtr = src[0]; +uint8_t *dstPtr[4] = {0}; +for (int i = 0; i < num_planes; i++) +dstPtr[i] = dst[i] + dstStride[i] * srcSliceY; + +if (srcFormat == AV_PIX_FMT_YA8) { +switch (dstFormat) { +case AV_PIX_FMT_GBRP: conv = gray8aToPlanar8; break; +case AV_PIX_FMT_GBRAP: conv = gray8aToPlanar8; break; +} +} else if (usePal(srcFormat)) { +switch (dstFormat) { +case AV_PIX_FMT_GBRP: conv = pal8ToPlanar8; break; +case AV_PIX_FMT_GBRAP: conv = pal8ToPlanar8; break; +} +} + +av_assert1(conv); +for (int y = 0; y < srcSliceH; y++) { +conv(srcPtr, dstPtr[0], dstPtr[1], dstPtr[2], dstPtr[3], c->opts.src_w, +(uint8_t *) c->pal_rgb); +srcPtr += srcStride[0]; +for (int i = 0; i < num_planes; i++) +dstPtr[i] += dstStride[i]; +} + +return srcSliceH; +} + static void packed16togbra16(const uint8_t *src, int srcStride, uint16_t *dst[], const int dstStride[], int srcSliceH, int src_alpha, int swap, int shift, int width) @@ -2533,8 +2600,18 @@ void ff_get_unscaled_swscale(SwsInternal *c) IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAPF32)) c->convert_unscaled = bswap_32bpc; -if (usePal(srcFormat) && isByteRGB(dstFormat)) -c->convert_unscaled = palToRgbWrapper; +if (usePal(srcFormat)) { +switch (dstFormat) { +case AV_PIX_FMT_GBRP: +case AV_PIX_FMT_GBRAP: +c->convert_unscaled = palToGbrpWrapper; +
[FFmpeg-cvslog] avcodec/cbs_h2645: revert accidental change
ffmpeg | branch: master | James Almer | Thu Dec 26 15:45:30 2024 -0300| [3e6d89cd97d0ec66cc685fec048273e59b3e5958] | committer: James Almer avcodec/cbs_h2645: revert accidental change This was erroneously included in 7e778586e7efceacae33b12b9b3673838060f8f2. Reported-by: Zhao Zhili Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e6d89cd97d0ec66cc685fec048273e59b3e5958 --- libavcodec/cbs_h2645.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index 647b1c785e..369e3ac876 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -499,9 +499,9 @@ static int cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx, size_t size = nal->size; enum AVCodecID codec_id = ctx->codec->codec_id; -//if (codec_id == AV_CODEC_ID_HEVC && nal->nuh_layer_id > 0 && - // (nal->type < HEVC_NAL_VPS || nal->type > HEVC_NAL_PPS)) -//continue; +if (codec_id == AV_CODEC_ID_HEVC && nal->nuh_layer_id > 0 && +(nal->type < HEVC_NAL_VPS || nal->type > HEVC_NAL_PPS)) +continue; // Remove trailing zeroes. while (size > 0 && nal->data[size - 1] == 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".