[FFmpeg-cvslog] avcodec: add API for automatic handling of icc profiles
ffmpeg | branch: master | Niklas Haas | Tue Jun 28 15:10:00 2022 +0200| [e1a0f2df3d8c150016bfa2f0dfde7d6b56c6bf3f] | committer: Niklas Haas avcodec: add API for automatic handling of icc profiles This functionally already exists, but as pointed out in #9672 and #9673, requiring users to manually include filters is clumsy, error-prone and hard to use together with tools like ffplay. To streamline ICC profile support, add a new AVCodecContext flag to globally enable reading and writing ICC profiles, automatically, for all appropriate media types. Note that this commit only includes the new API. The implementation is split off to separate commits for readability. Signed-off-by: Niklas Haas > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e1a0f2df3d8c150016bfa2f0dfde7d6b56c6bf3f --- doc/APIchanges | 5 + doc/codecs.texi| 2 ++ libavcodec/avcodec.h | 6 ++ libavcodec/options_table.h | 1 + libavcodec/version.h | 2 +- 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index b3563cd528..e374f3ca81 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,11 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-07-xx - x - lavc 59.40.100 - avcodec.h + Add the AV_CODEC_FLAG2_ICC_PROFILES flag to AVCodecContext, to enable + automatic reading and writing of embedded ICC profiles in image files. + The "flags2" option now supports the corresponding flag "icc_profiles". + 2022-07-xx - xx - lavu 57.30.100 - frame.h Add AVFrame.duration, deprecate AVFrame.pkt_duration. diff --git a/doc/codecs.texi b/doc/codecs.texi index 5e10020900..1adacd2b59 100644 --- a/doc/codecs.texi +++ b/doc/codecs.texi @@ -644,6 +644,8 @@ for codecs that support it. See also @file{doc/examples/export_mvs.c}. Do not skip samples and export skip information as frame side data. @item ass_ro_flush_noop Do not reset ASS ReadOrder field on flush. +@item icc_profiles +Generate/parse embedded ICC profiles from/to colorimetry tags. @end table @item export_side_data @var{flags} (@emph{decoding/encoding,audio,video,subtitles}) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index cb5c25bf63..60b215d2e9 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -331,6 +331,12 @@ typedef struct RcOverride{ * Do not reset ASS ReadOrder field on flush (subtitles decoding) */ #define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30) +/** + * Generate/parse ICC profiles on encode/decode, as appropriate for the type of + * file. No effect on codecs which cannot contain embedded ICC profiles, or + * when compiled without support for lcms2. + */ +#define AV_CODEC_FLAG2_ICC_PROFILES (1U << 31) /* Unsupported options : * Syntax Arithmetic coding (SAC) diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index e72b4d12b6..a72085ac90 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -83,6 +83,7 @@ static const AVOption avcodec_options[] = { {"export_mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"}, {"skip_manual", "do not skip samples and export skip information as frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, INT_MIN, INT_MAX, A|D, "flags2"}, {"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, S|D, "flags2"}, +{"icc_profiles", "generate/parse embedded ICC profiles from/to colorimetry tags", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_ICC_PROFILES}, INT_MIN, INT_MAX, S|D, "flags2"}, {"export_side_data", "Export metadata as side data", OFFSET(export_side_data), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, A|V|S|D|E, "export_side_data"}, {"mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_MVS}, INT_MIN, INT_MAX, V|D, "export_side_data"}, {"prft", "export Producer Reference Time through packet side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_PRFT}, INT_MIN, INT_MAX, A|V|S|E, "export_side_data"}, diff --git a/libavcodec/version.h b/libavcodec/version.h index f2f14eaed1..19f3f4a272 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 39 +#define LIBAVCODEC_VERSION_MINOR 40 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ ___ 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 cap for ICC profile support
ffmpeg | branch: master | Niklas Haas | Tue Jun 28 14:25:15 2022 +0200| [61ffa23c2e42887b32d469d9e69e9eb887b29e9c] | committer: Niklas Haas avcodec/codec_internal: add cap for ICC profile support Codecs that can read/write ICC profiles deserve a special capability so the common logic in encode.c/decode.c can decide whether or not there needs to be any special handling for ICC profiles. The motivation here is to be able to use it to decide whether or not an ICC profile needs to be generated in the encode path, but it might as well get added to decoders as well for purely informative reasons. It's not entirely clear to me whether the "thp" and "smvjpeg" variants of "mjpeg" should have this capability set or not, given that the code technically supports it but I somehow doubt these files may contain them. In either case, this cap is purely informative for decoders so it doesn't matter too much either way. It's also not entirely clear whether the "amv" encoder should signal ICC profile support, but again erring on the side of caution, we probably *shouldn't* be generating (and encoding!) ICC profiles for this type of media file. Signed-off-by: Niklas Haas > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61ffa23c2e42887b32d469d9e69e9eb887b29e9c --- libavcodec/codec_internal.h | 4 libavcodec/libjxldec.c | 3 ++- libavcodec/libjxlenc.c | 3 ++- libavcodec/mjpegdec.c | 4 +++- libavcodec/mjpegenc.c | 2 +- libavcodec/pngdec.c | 6 -- libavcodec/pngenc.c | 2 ++ libavcodec/tiff.c | 2 +- libavcodec/webp.c | 1 + 9 files changed, 20 insertions(+), 7 deletions(-) diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h index 3619d04090..62ea91cf4d 100644 --- a/libavcodec/codec_internal.h +++ b/libavcodec/codec_internal.h @@ -75,6 +75,10 @@ * internal logic derive them from AVCodecInternal.last_pkt_props. */ #define FF_CODEC_CAP_SETS_FRAME_PROPS (1 << 8) +/** + * Codec supports embedded ICC profiles (AV_FRAME_DATA_ICC_PROFILE). + */ +#define FF_CODEC_CAP_ICC_PROFILES (1 << 9) /** * FFCodec.codec_tags termination value diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c index b9322b082a..f54701596b 100644 --- a/libavcodec/libjxldec.c +++ b/libavcodec/libjxldec.c @@ -456,6 +456,7 @@ const FFCodec ff_libjxl_decoder = { .close= libjxl_decode_close, .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_OTHER_THREADS, .caps_internal= FF_CODEC_CAP_NOT_INIT_THREADSAFE | -FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP, +FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP | +FF_CODEC_CAP_ICC_PROFILES, .p.wrapper_name = "libjxl", }; diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c index dd85fcbc8e..7e97237cd1 100644 --- a/libavcodec/libjxlenc.c +++ b/libavcodec/libjxlenc.c @@ -469,7 +469,8 @@ const FFCodec ff_libjxl_encoder = { .close= libjxl_encode_close, .p.capabilities = AV_CODEC_CAP_OTHER_THREADS, .caps_internal= FF_CODEC_CAP_NOT_INIT_THREADSAFE | -FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP, +FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP | +FF_CODEC_CAP_ICC_PROFILES, .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB48, AV_PIX_FMT_RGBA64, diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 816eb1ce5d..5f058d026f 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -3027,7 +3027,9 @@ const FFCodec ff_mjpeg_decoder = { .p.priv_class = &mjpegdec_class, .p.profiles = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles), .caps_internal = FF_CODEC_CAP_INIT_CLEANUP | - FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_SETS_PKT_DTS, + FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | + FF_CODEC_CAP_SETS_PKT_DTS | + FF_CODEC_CAP_ICC_PROFILES, .hw_configs = (const AVCodecHWConfigInternal *const []) { #if CONFIG_MJPEG_NVDEC_HWACCEL HWACCEL_NVDEC(mjpeg), diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c index 63862a5043..3df0b51bb4 100644 --- a/libavcodec/mjpegenc.c +++ b/libavcodec/mjpegenc.c @@ -652,7 +652,7 @@ const FFCodec ff_mjpeg_encoder = { FF_CODEC_ENCODE_CB(ff_mpv_encode_picture), .close = mjpeg_encode_close, .p.capabilities = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS, -.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, +.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_ICC_PROFILES, .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV44
[FFmpeg-cvslog] fflcms2: move to libavcodec
ffmpeg | branch: master | Niklas Haas | Tue Jun 28 13:55:37 2022 +0200| [1cbd4552fe3bcdc36b76304d11b883d061cc23ee] | committer: Niklas Haas fflcms2: move to libavcodec We will need this helper inside libavcodec in the future, so move it there, leaving behind an #include to the raw source file in its old location in libvfilter. This approach is inspired by the handling of vulkan.c, and avoids us needing to expose any of it publicly (or semi-publicly) in e.g. libavutil, thus avoiding any ABI headaches. It's debatable whether the actual code belongs in libavcodec or libavfilter, but I decided to put it into libavcodec because it conceptually deals with encoding and decoding ICC profiles, and will be used to decode embedded ICC profiles in image files. Signed-off-by: Niklas Haas > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1cbd4552fe3bcdc36b76304d11b883d061cc23ee --- libavcodec/Makefile | 1 + libavcodec/fflcms2.c | 311 ++ libavcodec/fflcms2.h | 87 ++ libavfilter/fflcms2.c | 294 +-- libavfilter/fflcms2.h | 65 +-- 5 files changed, 401 insertions(+), 357 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index a4fab108d6..6751b6b591 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1240,6 +1240,7 @@ SKIPHEADERS-$(CONFIG_AMF) += amfenc.h SKIPHEADERS-$(CONFIG_D3D11VA) += d3d11va.h dxva2_internal.h SKIPHEADERS-$(CONFIG_DXVA2)+= dxva2.h dxva2_internal.h SKIPHEADERS-$(CONFIG_JNI) += ffjni.h +SKIPHEADERS-$(CONFIG_LCMS2)+= fflcms2.h SKIPHEADERS-$(CONFIG_LIBJXL) += libjxl.h SKIPHEADERS-$(CONFIG_LIBVPX) += libvpx.h SKIPHEADERS-$(CONFIG_LIBWEBP_ENCODER) += libwebpenc_common.h diff --git a/libavcodec/fflcms2.c b/libavcodec/fflcms2.c new file mode 100644 index 00..fd370fb310 --- /dev/null +++ b/libavcodec/fflcms2.c @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2022 Niklas Haas + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/color_utils.h" +#include "libavutil/csp.h" + +#include "fflcms2.h" + +static void log_cb(cmsContext ctx, cmsUInt32Number error, const char *str) +{ +FFIccContext *s = cmsGetContextUserData(ctx); +av_log(s->avctx, AV_LOG_ERROR, "lcms2: [%"PRIu32"] %s\n", error, str); +} + +int ff_icc_context_init(FFIccContext *s, void *avctx) +{ +memset(s, 0, sizeof(*s)); +s->avctx = avctx; +s->ctx = cmsCreateContext(NULL, s); +if (!s->ctx) +return AVERROR(ENOMEM); + +cmsSetLogErrorHandlerTHR(s->ctx, log_cb); +return 0; +} + +void ff_icc_context_uninit(FFIccContext *s) +{ +for (int i = 0; i < FF_ARRAY_ELEMS(s->curves); i++) +cmsFreeToneCurve(s->curves[i]); +cmsDeleteContext(s->ctx); +memset(s, 0, sizeof(*s)); +} + +static int get_curve(FFIccContext *s, enum AVColorTransferCharacteristic trc, + cmsToneCurve **out_curve) +{ +if (trc >= AVCOL_TRC_NB) +return AVERROR_INVALIDDATA; + +if (s->curves[trc]) +goto done; + +switch (trc) { +case AVCOL_TRC_LINEAR: +s->curves[trc] = cmsBuildGamma(s->ctx, 1.0); +break; +case AVCOL_TRC_GAMMA22: +s->curves[trc] = cmsBuildGamma(s->ctx, 2.2); +break; +case AVCOL_TRC_GAMMA28: +s->curves[trc] = cmsBuildGamma(s->ctx, 2.8); +break; +case AVCOL_TRC_BT709: +case AVCOL_TRC_SMPTE170M: +case AVCOL_TRC_BT2020_10: +case AVCOL_TRC_BT2020_12: +s->curves[trc] = cmsBuildParametricToneCurve(s->ctx, 4, (double[5]) { +/* γ = */ 1/0.45, +/* a = */ 1/1.099296826809442, +/* b = */ 1 - 1/1.099296826809442, +/* c = */ 1/4.5, +/* d = */ 4.5 * 0.018053968510807, +}); +break; +case AVCOL_TRC_SMPTE240M: +s->curves[trc] = cmsBuildParametricToneCurve(s->ctx, 4, (double[5]) { +/* γ = */ 1/0.45, +/* a = */ 1/1.1115, +/* b = */ 1 - 1/1.1115, +/* c = */ 1/4.0, +/* d = */ 4.0 * 0.0228, +}); +break; +case AVCOL_TRC_LOG: +s->curves[trc] = cmsBuildParametricToneCurve
[FFmpeg-cvslog] avcodec: add common fflcms2 boilerplate
ffmpeg | branch: master | Niklas Haas | Tue Jun 28 15:13:04 2022 +0200| [c688ddc067e0d9ade731b3adb5c6fde259cbc5f6] | committer: Niklas Haas avcodec: add common fflcms2 boilerplate Handling this in general code makes more sense than handling it in individual codec files, because it would be a lot of unnecessary code duplication for the plenty of formats that support exporting ICC profiles (jpg, png, tiff, webp, jxl, ...). encode.c and decode.c will be in charge of initializing this state as needed, so we merely need to make sure to uninit it afterwards from the common destructor path. Signed-off-by: Niklas Haas > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c688ddc067e0d9ade731b3adb5c6fde259cbc5f6 --- configure | 2 +- libavcodec/Makefile | 1 + libavcodec/avcodec.c | 4 libavcodec/decode.c | 4 libavcodec/internal.h | 8 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 6629d14099..8c7e8c9d1d 100755 --- a/configure +++ b/configure @@ -3814,7 +3814,7 @@ swresample_suggest="libm libsoxr stdatomic" swscale_deps="avutil" swscale_suggest="libm stdatomic" -avcodec_extralibs="pthreads_extralibs iconv_extralibs dxva2_extralibs" +avcodec_extralibs="pthreads_extralibs iconv_extralibs dxva2_extralibs lcms2_extralibs" avfilter_extralibs="pthreads_extralibs" avutil_extralibs="d3d11va_extralibs nanosleep_extralibs pthreads_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vdpau_x11_extralibs" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 6751b6b591..aff7752856 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -114,6 +114,7 @@ OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o msmpeg4data.o OBJS-$(CONFIG_IVIDSP) += ivi_dsp.o OBJS-$(CONFIG_JNI) += ffjni.o jni.o OBJS-$(CONFIG_JPEGTABLES) += jpegtables.o +OBJS-$(CONFIG_LCMS2) += fflcms2.o OBJS-$(CONFIG_LLAUDDSP)+= lossless_audiodsp.o OBJS-$(CONFIG_LLVIDDSP)+= lossless_videodsp.o OBJS-$(CONFIG_LLVIDENCDSP) += lossless_videoencdsp.o diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 4bc18183a9..c9105c5df2 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -479,6 +479,10 @@ av_cold int avcodec_close(AVCodecContext *avctx) av_channel_layout_uninit(&avci->initial_ch_layout); +#if CONFIG_LCMS2 +ff_icc_context_uninit(&avci->icc); +#endif + av_freep(&avctx->internal); } diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 0613681f89..892271 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -49,6 +49,10 @@ #include "internal.h" #include "thread.h" +#if CONFIG_LCMS2 +# include "fflcms2.h" +#endif + static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt) { int ret; diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 6fb4e1b9af..8809a7079a 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -33,6 +33,10 @@ #include "avcodec.h" #include "config.h" +#if CONFIG_LCMS2 +# include "fflcms2.h" +#endif + #define FF_SANE_NB_CHANNELS 512U #if HAVE_SIMD_ALIGN_64 @@ -146,6 +150,10 @@ typedef struct AVCodecInternal { uint64_t initial_channel_layout; #endif AVChannelLayout initial_ch_layout; + +#if CONFIG_LCMS2 +FFIccContext icc; /* used to read and write embedded ICC profiles */ +#endif } AVCodecInternal; /** ___ 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/png: add test for ICC profile parsing
ffmpeg | branch: master | Niklas Haas | Thu Jul 28 16:47:34 2022 +0200| [1001bdc5047ec7ed0754a2084b77637028bb82cc] | committer: Niklas Haas fate/png: add test for ICC profile parsing This tests the new "-flags2 icc_profiles" option by making sure the embedded ICC profile gets correctly detected as sRGB. Signed-off-by: Niklas Haas > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1001bdc5047ec7ed0754a2084b77637028bb82cc --- tests/fate/image.mak | 4 tests/ref/fate/png-icc-parse | 48 2 files changed, 52 insertions(+) diff --git a/tests/fate/image.mak b/tests/fate/image.mak index fca4eaf60a..03e794dc48 100644 --- a/tests/fate/image.mak +++ b/tests/fate/image.mak @@ -392,6 +392,10 @@ fate-png-side-data: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_frames \ FATE_PNG_TRANSCODE-$(call TRANSCODE, PNG, IMAGE2 IMAGE_PNG_PIPE) += fate-png-icc fate-png-icc: CMD = transcode png_pipe $(TARGET_SAMPLES)/png1/lena-int_rgb24.png image2 "-c png" "" "-show_frames" +FATE_PNG_PROBE-$(call ALLYES, LCMS2) += fate-png-icc-parse +fate-png-icc-parse: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_frames \ +-flags2 icc_profiles $(TARGET_SAMPLES)/png1/lena-int_rgb24.png + FATE_PNG-$(call DEMDEC, IMAGE2, PNG) += $(FATE_PNG) FATE_PNG_PROBE-$(call DEMDEC, IMAGE2, PNG) += $(FATE_PNG_PROBE) FATE_IMAGE_FRAMECRC += $(FATE_PNG-yes) diff --git a/tests/ref/fate/png-icc-parse b/tests/ref/fate/png-icc-parse new file mode 100644 index 00..18bb18a804 --- /dev/null +++ b/tests/ref/fate/png-icc-parse @@ -0,0 +1,48 @@ +[FRAME] +media_type=video +stream_index=0 +key_frame=1 +pts=0 +pts_time=0.00 +pkt_dts=0 +pkt_dts_time=0.00 +best_effort_timestamp=0 +best_effort_timestamp_time=0.00 +pkt_duration=1 +pkt_duration_time=0.04 +duration=1 +duration_time=0.04 +pkt_pos=0 +pkt_size=40194 +width=128 +height=128 +pix_fmt=rgb24 +sample_aspect_ratio=1:1 +pict_type=I +coded_picture_number=0 +display_picture_number=0 +interlaced_frame=1 +top_field_first=0 +repeat_pict=0 +color_range=pc +color_space=unknown +color_primaries=bt709 +color_transfer=iec61966-2-1 +chroma_location=unspecified +[SIDE_DATA] +side_data_type=ICC profile +name=Photoshop ICC profile +size=3144 +[/SIDE_DATA] +[SIDE_DATA] +side_data_type=Mastering display metadata +red_x=63999/10 +red_y=33001/10 +green_x=3/10 +green_y=6/10 +blue_x=15000/10 +blue_y=5999/10 +white_point_x=31269/10 +white_point_y=32899/10 +[/SIDE_DATA] +[/FRAME] ___ 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/decode: parse ICC profiles
ffmpeg | branch: master | Niklas Haas | Tue Jun 28 15:15:40 2022 +0200| [77f8dcb26582b00c53caf35f05eedef2523a2578] | committer: Niklas Haas avcodec/decode: parse ICC profiles Implementation for the decode side of the ICC profile API, roughly matching the behavior of the existing vf_iccdetect filter. Closes: #9673 Signed-off-by: Niklas Haas > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=77f8dcb26582b00c53caf35f05eedef2523a2578 --- libavcodec/decode.c | 61 - 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 892271..92958745df 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -49,10 +49,6 @@ #include "internal.h" #include "thread.h" -#if CONFIG_LCMS2 -# include "fflcms2.h" -#endif - static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt) { int ret; @@ -508,6 +504,54 @@ FF_ENABLE_DEPRECATION_WARNINGS return ret < 0 ? ret : 0; } +#if CONFIG_LCMS2 +static int detect_colorspace(AVCodecContext *avctx, AVFrame *frame) +{ +AVCodecInternal *avci = avctx->internal; +enum AVColorTransferCharacteristic trc; +AVColorPrimariesDesc coeffs; +enum AVColorPrimaries prim; +cmsHPROFILE profile; +AVFrameSideData *sd; +int ret; +if (!(avctx->flags2 & AV_CODEC_FLAG2_ICC_PROFILES)) +return 0; + +sd = av_frame_get_side_data(frame, AV_FRAME_DATA_ICC_PROFILE); +if (!sd || !sd->size) +return 0; + +if (!avci->icc.avctx) { +ret = ff_icc_context_init(&avci->icc, avctx); +if (ret < 0) +return ret; +} + +profile = cmsOpenProfileFromMemTHR(avci->icc.ctx, sd->data, sd->size); +if (!profile) +return AVERROR_INVALIDDATA; + +ret = ff_icc_profile_read_primaries(&avci->icc, profile, &coeffs); +if (!ret) +ret = ff_icc_profile_detect_transfer(&avci->icc, profile, &trc); +cmsCloseProfile(profile); +if (ret < 0) +return ret; + +prim = av_csp_primaries_id_from_desc(&coeffs); +if (prim != AVCOL_PRI_UNSPECIFIED) +frame->color_primaries = prim; +if (trc != AVCOL_TRC_UNSPECIFIED) +frame->color_trc = trc; +return 0; +} +#else /* !CONFIG_LCMS2 */ +static int detect_colorspace(av_unused AVCodecContext *c, av_unused AVFrame *f) +{ +return 0; +} +#endif + static int decode_simple_receive_frame(AVCodecContext *avctx, AVFrame *frame) { int ret; @@ -528,7 +572,7 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) { AVCodecInternal *avci = avctx->internal; const FFCodec *const codec = ffcodec(avctx->codec); -int ret; +int ret, ok; av_assert0(!frame->buf[0]); @@ -542,6 +586,13 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) if (ret == AVERROR_EOF) avci->draining_done = 1; +/* preserve ret */ +ok = detect_colorspace(avctx, frame); +if (ok < 0) { +av_frame_unref(frame); +return ok; +} + if (!(codec->caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS) && IS_EMPTY(avci->last_pkt_props)) { // May fail if the FIFO is empty. ___ 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/encode:: generate ICC profiles
ffmpeg | branch: master | Niklas Haas | Tue Jun 28 15:03:19 2022 +0200| [8377ef43f4f9be46391bb5b43bbe7e9c6c1ad8dc] | committer: Niklas Haas avcodec/encode:: generate ICC profiles Only if requested, and only if the codec signals support for ICC profiles. Implementation roughly matches the functionality of the existing vf_iccgen filter, albeit with some reduced flexibility and no caching. Ideally, we'd also only do this on the first frame (e.g. mjpeg, apng), but there's no meaningful way for us to distinguish between this case and e.g. somebody using the image2 muxer, in which case we'd want to attach ICC profiles to every frame in the stream. Closes: #9672 Signed-off-by: Niklas Haas > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8377ef43f4f9be46391bb5b43bbe7e9c6c1ad8dc --- libavcodec/encode.c | 53 + 1 file changed, 53 insertions(+) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index 310fe20777..7cf13bf6d6 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -308,6 +308,53 @@ static int encode_receive_packet_internal(AVCodecContext *avctx, AVPacket *avpkt return ret; } +#if CONFIG_LCMS2 +static int encode_generate_icc_profile(AVCodecContext *avctx, AVFrame *frame) +{ +enum AVColorTransferCharacteristic trc = frame->color_trc; +enum AVColorPrimaries prim = frame->color_primaries; +const FFCodec *const codec = ffcodec(avctx->codec); +AVCodecInternal *avci = avctx->internal; +cmsHPROFILE profile; +int ret; + +/* don't generate ICC profiles if disabled or unsupported */ +if (!(avctx->flags2 & AV_CODEC_FLAG2_ICC_PROFILES)) +return 0; +if (!(codec->caps_internal & FF_CODEC_CAP_ICC_PROFILES)) +return 0; + +if (trc == AVCOL_TRC_UNSPECIFIED) +trc = avctx->color_trc; +if (prim == AVCOL_PRI_UNSPECIFIED) +prim = avctx->color_primaries; +if (trc == AVCOL_TRC_UNSPECIFIED || prim == AVCOL_PRI_UNSPECIFIED) +return 0; /* can't generate ICC profile with missing csp tags */ + +if (av_frame_get_side_data(frame, AV_FRAME_DATA_ICC_PROFILE)) +return 0; /* don't overwrite existing ICC profile */ + +if (!avci->icc.avctx) { +ret = ff_icc_context_init(&avci->icc, avctx); +if (ret < 0) +return ret; +} + +ret = ff_icc_profile_generate(&avci->icc, prim, trc, &profile); +if (ret < 0) +return ret; + +ret = ff_icc_profile_attach(&avci->icc, profile, frame); +cmsCloseProfile(profile); +return ret; +} +#else /* !CONFIG_LCMS2 */ +static int encode_generate_icc_profile(av_unused AVCodecContext *c, av_unused AVFrame *f) +{ +return 0; +} +#endif + static int encode_send_frame_internal(AVCodecContext *avctx, const AVFrame *src) { AVCodecInternal *avci = avctx->internal; @@ -360,6 +407,12 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif +if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) { +ret = encode_generate_icc_profile(avctx, dst); +if (ret < 0) +return ret; +} + return 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] lavfi/edge_common: Templatify ff_gaussian_blur and ff_sobel
ffmpeg | branch: master | Thilo Borgmann | Mon Jul 18 16:09:46 2022 +0200| [cf1f57443158bcbe84a213e8dc631a302993f9a2] | committer: Thilo Borgmann lavfi/edge_common: Templatify ff_gaussian_blur and ff_sobel > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf1f57443158bcbe84a213e8dc631a302993f9a2 --- libavfilter/edge_common.c | 74 +++ libavfilter/edge_common.h | 22 ++--- libavfilter/edge_template.c | 118 libavfilter/vf_blurdetect.c | 8 +-- libavfilter/vf_edgedetect.c | 14 +++--- 5 files changed, 150 insertions(+), 86 deletions(-) diff --git a/libavfilter/edge_common.c b/libavfilter/edge_common.c index d72e8521cd..ebd47d7c53 100644 --- a/libavfilter/edge_common.c +++ b/libavfilter/edge_common.c @@ -46,33 +46,13 @@ static int get_rounded_direction(int gx, int gy) return DIRECTION_VERTICAL; } -// Simple sobel operator to get rounded gradients -void ff_sobel(int w, int h, -uint16_t *dst, int dst_linesize, -int8_t *dir, int dir_linesize, -const uint8_t *src, int src_linesize) -{ -int i, j; - -for (j = 1; j < h - 1; j++) { -dst += dst_linesize; -dir += dir_linesize; -src += src_linesize; -for (i = 1; i < w - 1; i++) { -const int gx = --1*src[-src_linesize + i-1] + 1*src[-src_linesize + i+1] --2*src[i-1] + 2*src[i+1] --1*src[ src_linesize + i-1] + 1*src[ src_linesize + i+1]; -const int gy = --1*src[-src_linesize + i-1] + 1*src[ src_linesize + i-1] --2*src[-src_linesize + i ] + 2*src[ src_linesize + i ] --1*src[-src_linesize + i+1] + 1*src[ src_linesize + i+1]; +#undef DEPTH +#define DEPTH 8 +#include "edge_template.c" -dst[i] = FFABS(gx) + FFABS(gy); -dir[i] = get_rounded_direction(gx, gy); -} -} -} +#undef DEPTH +#define DEPTH 16 +#include "edge_template.c" // Filters rounded gradients to drop all non-maxima // Expects gradients generated by ff_sobel() @@ -137,45 +117,3 @@ void ff_double_threshold(int low, int high, int w, int h, src += src_linesize; } } - -// Applies gaussian blur, using 5x5 kernels, sigma = 1.4 -void ff_gaussian_blur(int w, int h, - uint8_t *dst, int dst_linesize, - const uint8_t *src, int src_linesize) -{ -int i, j; - -memcpy(dst, src, w); dst += dst_linesize; src += src_linesize; -memcpy(dst, src, w); dst += dst_linesize; src += src_linesize; -for (j = 2; j < h - 2; j++) { -dst[0] = src[0]; -dst[1] = src[1]; -for (i = 2; i < w - 2; i++) { -/* Gaussian mask of size 5x5 with sigma = 1.4 */ -dst[i] = ((src[-2*src_linesize + i-2] + src[2*src_linesize + i-2]) * 2 -+ (src[-2*src_linesize + i-1] + src[2*src_linesize + i-1]) * 4 -+ (src[-2*src_linesize + i ] + src[2*src_linesize + i ]) * 5 -+ (src[-2*src_linesize + i+1] + src[2*src_linesize + i+1]) * 4 -+ (src[-2*src_linesize + i+2] + src[2*src_linesize + i+2]) * 2 - -+ (src[ -src_linesize + i-2] + src[ src_linesize + i-2]) * 4 -+ (src[ -src_linesize + i-1] + src[ src_linesize + i-1]) * 9 -+ (src[ -src_linesize + i ] + src[ src_linesize + i ]) * 12 -+ (src[ -src_linesize + i+1] + src[ src_linesize + i+1]) * 9 -+ (src[ -src_linesize + i+2] + src[ src_linesize + i+2]) * 4 - -+ src[i-2] * 5 -+ src[i-1] * 12 -+ src[i ] * 15 -+ src[i+1] * 12 -+ src[i+2] * 5) / 159; -} -dst[i] = src[i]; -dst[i + 1] = src[i + 1]; - -dst += dst_linesize; -src += src_linesize; -} -memcpy(dst, src, w); dst += dst_linesize; src += src_linesize; -memcpy(dst, src, w); -} diff --git a/libavfilter/edge_common.h b/libavfilter/edge_common.h index 87c143f2b8..cff4febd70 100644 --- a/libavfilter/edge_common.h +++ b/libavfilter/edge_common.h @@ -48,10 +48,14 @@ enum AVRoundedDirection { * @param src data pointers to source image * @param src_linesize linesizes for the source image */ -void ff_sobel(int w, int h, - uint16_t *dst, int dst_linesize, - int8_t *dir, int dir_linesize, - const uint8_t *src, int src_linesize); +#define PROTO_SOBEL(depth) \ +void ff_sobel_##depth(int w, int h, \ + uint16_t *dst, int dst_linesize, \ + int8_t *dir, int dir_linesize, \ + const uint8_t *src, int src_linesize, int
[FFmpeg-cvslog] lavfi/cropdetect: Add new mode to detect crop-area based on motion vectors and edges
ffmpeg | branch: master | Thilo Borgmann | Sat Jul 30 13:10:45 2022 +0200| [9d66417cc5bd705dca15e90aea3fa59d07422705] | committer: Thilo Borgmann lavfi/cropdetect: Add new mode to detect crop-area based on motion vectors and edges This filter allows crop detection even if the video is embedded in non-black areas. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9d66417cc5bd705dca15e90aea3fa59d07422705 --- doc/filters.texi | 53 +++- libavfilter/version.h | 2 +- libavfilter/vf_cropdetect.c| 211 - tests/fate/filter-video.mak| 8 +- tests/ref/fate/filter-metadata-cropdetect1 | 9 ++ tests/ref/fate/filter-metadata-cropdetect2 | 9 ++ 6 files changed, 288 insertions(+), 4 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 9c4dea9abc..4a5412c91d 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -10138,12 +10138,23 @@ Auto-detect the crop size. It calculates the necessary cropping parameters and prints the recommended parameters via the logging system. The detected dimensions -correspond to the non-black area of the input video. +correspond to the non-black or video area of the input video according to @var{mode}. It accepts the following parameters: @table @option +@item mode +Depending on @var{mode} crop detection is based on either the mere black value of surrounding pixels or a combination of motion vectors and edge pixels. + +@table @samp +@item black +Detect black pixels surrounding the playing video. For fine control use option @var{limit}. + +@item mvedges +Detect the playing video by the motion vectors inside the video and scanning for edge pixels typically forming the border of a playing video. +@end table + @item limit Set higher black value threshold, which can be optionally specified from nothing (0) to everything (255 for 8-bit based formats). An intensity @@ -10169,8 +10180,48 @@ detect the current optimal crop area. Default value is 0. This can be useful when channel logos distort the video area. 0 indicates 'never reset', and returns the largest area encountered during playback. + +@item mv_threshold +Set motion in pixel units as threshold for motion detection. It defaults to 8. + +@item low +@item high +Set low and high threshold values used by the Canny thresholding +algorithm. + +The high threshold selects the "strong" edge pixels, which are then +connected through 8-connectivity with the "weak" edge pixels selected +by the low threshold. + +@var{low} and @var{high} threshold values must be chosen in the range +[0,1], and @var{low} should be lesser or equal to @var{high}. + +Default value for @var{low} is @code{5/255}, and default value for @var{high} +is @code{15/255}. @end table +@subsection Examples + +@itemize +@item +Find video area surrounded by black borders: +@example +ffmpeg -i file.mp4 -vf cropdetect,metadata=mode=print -f null - +@end example + +@item +Find an embedded video area, generate motion vectors beforehand: +@example +ffmpeg -i file.mp4 -vf mestimate,cropdetect=mode=mvedges,metadata=mode=print -f null - +@end example + +@item +Find an embedded video area, use motion vectors from decoder: +@example +ffmpeg -flags2 +export_mvs -i file.mp4 -vf cropdetect=mode=mvedges,metadata=mode=print -f null - +@end example +@end itemize + @anchor{cue} @section cue diff --git a/libavfilter/version.h b/libavfilter/version.h index 0946ee91e8..19a009c110 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -32,7 +32,7 @@ #include "version_major.h" #define LIBAVFILTER_VERSION_MINOR 46 -#define LIBAVFILTER_VERSION_MICRO 100 +#define LIBAVFILTER_VERSION_MICRO 101 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index b887b9ecb1..e920e671ab 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -26,11 +26,14 @@ #include "libavutil/imgutils.h" #include "libavutil/internal.h" #include "libavutil/opt.h" +#include "libavutil/motion_vector.h" +#include "libavutil/qsort.h" #include "avfilter.h" #include "formats.h" #include "internal.h" #include "video.h" +#include "edge_common.h" typedef struct CropDetectContext { const AVClass *class; @@ -42,6 +45,16 @@ typedef struct CropDetectContext { int frame_nb; int max_pixsteps[4]; int max_outliers; +int mode; +int window_size; +int mv_threshold; +float low, high; +uint8_t low_u8, high_u8; +uint8_t *filterbuf; +uint8_t *tmpbuf; +uint16_t *gradients; +char *directions; +int *bboxes[4]; } CropDetectContext; static const enum AVPixelFormat pix_fmts[] = { @@ -61,6 +74,17 @@ static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_NONE }; +enum CropMode { +MODE_BLACK, +MODE_MV_EDGES, +MODE_NB +}; + +static int comp(const
[FFmpeg-cvslog] Changelog: Update after last commit
ffmpeg | branch: master | Thilo Borgmann | Sat Jul 30 13:20:02 2022 +0200| [cd8515eb70f7ab0961b9401248ff5046b99c67ec] | committer: Thilo Borgmann Changelog: Update after last commit > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cd8515eb70f7ab0961b9401248ff5046b99c67ec --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index 92780c9953..40ea7ccecf 100644 --- a/Changelog +++ b/Changelog @@ -7,6 +7,7 @@ version : - ffmpeg -shortest_buf_duration option - ffmpeg now requires threading to be built - ffmpeg now runs every muxer in a separate thread +- Add new mode to cropdetect filter to detect crop-area based on motion vectors and edges version 5.1: ___ 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] lavfi/vf_cropdetect: Reindent after last commit
ffmpeg | branch: master | Thilo Borgmann | Sat Jul 30 13:20:56 2022 +0200| [665349c4c0fabb6cdb647c8803fad4f3c2937182] | committer: Thilo Borgmann lavfi/vf_cropdetect: Reindent after last commit > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=665349c4c0fabb6cdb647c8803fad4f3c2937182 --- libavfilter/vf_cropdetect.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index e920e671ab..eec0c7ab68 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -290,10 +290,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) } if (s->mode == MODE_BLACK) { -FIND(s->y1, 0, y < s->y1, +1, frame->linesize[0], bpp, frame->width); -FIND(s->y2, frame->height - 1, y > FFMAX(s->y2, s->y1), -1, frame->linesize[0], bpp, frame->width); -FIND(s->x1, 0, y < s->x1, +1, bpp, frame->linesize[0], frame->height); -FIND(s->x2, frame->width - 1, y > FFMAX(s->x2, s->x1), -1, bpp, frame->linesize[0], frame->height); +FIND(s->y1, 0, y < s->y1, +1, frame->linesize[0], bpp, frame->width); +FIND(s->y2, frame->height - 1, y > FFMAX(s->y2, s->y1), -1, frame->linesize[0], bpp, frame->width); +FIND(s->x1, 0, y < s->x1, +1, bpp, frame->linesize[0], frame->height); +FIND(s->x2, frame->width - 1, y > FFMAX(s->x2, s->x1), -1, bpp, frame->linesize[0], frame->height); } else { // MODE_MV_EDGES sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS); s->x1 = 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] avcodec/aacdec: print a log message when treating mono HE-AAC as stereo
ffmpeg | branch: master | James Almer | Thu Jul 28 14:20:22 2022 -0300| [6406d5e430953085a0100b44dd8fceb478b383e2] | committer: James Almer avcodec/aacdec: print a log message when treating mono HE-AAC as stereo Since this behavior is intentional, use the VERBOSE level instead of WARNING as it's nothing the user should worry about. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6406d5e430953085a0100b44dd8fceb478b383e2 --- libavcodec/aac.h | 1 + libavcodec/aacdec_template.c | 4 libavcodec/aacsbr_template.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/libavcodec/aac.h b/libavcodec/aac.h index 53be546857..c8d6b17710 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -366,6 +366,7 @@ struct AACContext { int warned_960_sbr; unsigned warned_71_wide; int warned_gain_control; +int warned_he_aac_mono; /* aacdec functions pointers */ void (*imdct_and_windowing)(AACContext *ac, SingleChannelElement *sce); diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 119976aa19..4266d89c6d 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -2584,6 +2584,10 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, ac->avctx->profile = FF_PROFILE_AAC_HE; } res = AAC_RENAME(ff_decode_sbr_extension)(ac, &che->sbr, gb, crc_flag, cnt, elem_type); +if (ac->oc[1].m4ac.ps == 1 && !ac->warned_he_aac_mono) { +av_log(ac->avctx, AV_LOG_VERBOSE, "Treating HE-AAC mono as stereo.\n"); +ac->warned_he_aac_mono = 1; +} break; case EXT_DYNAMIC_RANGE: res = decode_dynamic_range(&ac->che_drc, gb); diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c index b72c94b76d..dccae0526e 100644 --- a/libavcodec/aacsbr_template.c +++ b/libavcodec/aacsbr_template.c @@ -955,6 +955,8 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, } else { *num_bits_left -= ff_ps_read_data(ac->avctx, gb, &sbr->ps.common, *num_bits_left); ac->avctx->profile = FF_PROFILE_AAC_HE_V2; +// ensure the warning is not printed if PS extension is present +ac->warned_he_aac_mono = 1; } break; default: ___ 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/alac: don't fail if channels aren't set during init() when extradata is valid
ffmpeg | branch: master | James Almer | Fri Jul 29 18:05:51 2022 -0300| [6ca16906439f689e4627b7cb4e6466bd45cc696f] | committer: James Almer avcodec/alac: don't fail if channels aren't set during init() when extradata is valid The decoder is meant to use it as a fallback if the value in extradata is invalid. Regression since d199099be. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ca16906439f689e4627b7cb4e6466bd45cc696f --- libavcodec/alac.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index b232514169..8b87d78dd3 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -574,13 +574,15 @@ static av_cold int alac_decode_init(AVCodecContext * avctx) avctx->bits_per_raw_sample = alac->sample_size; avctx->sample_rate = alac->sample_rate; -if (alac->channels < 1 || alac->channels > ALAC_MAX_CHANNELS) { +if (alac->channels < 1) { av_log(avctx, AV_LOG_WARNING, "Invalid channel count\n"); +if (avctx->ch_layout.nb_channels < 1) +return AVERROR(EINVAL); alac->channels = avctx->ch_layout.nb_channels; } -if (avctx->ch_layout.nb_channels > ALAC_MAX_CHANNELS || avctx->ch_layout.nb_channels <= 0 ) { +if (alac->channels > ALAC_MAX_CHANNELS) { avpriv_report_missing_feature(avctx, "Channel count %d", - avctx->ch_layout.nb_channels); + alac->channels); return AVERROR_PATCHWELCOME; } av_channel_layout_uninit(&avctx->ch_layout); ___ 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/alac: don't fail if channels aren't set during init() when extradata is valid
ffmpeg | branch: release/5.1 | James Almer | Fri Jul 29 18:05:51 2022 -0300| [915ef932a3cd4679fa58d6c514992d90e5fa6930] | committer: James Almer avcodec/alac: don't fail if channels aren't set during init() when extradata is valid The decoder is meant to use it as a fallback if the value in extradata is invalid. Regression since d199099be. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=915ef932a3cd4679fa58d6c514992d90e5fa6930 --- libavcodec/alac.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 9aaf7066b2..4aab82d60b 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -574,13 +574,15 @@ static av_cold int alac_decode_init(AVCodecContext * avctx) avctx->bits_per_raw_sample = alac->sample_size; avctx->sample_rate = alac->sample_rate; -if (alac->channels < 1 || alac->channels > ALAC_MAX_CHANNELS) { +if (alac->channels < 1) { av_log(avctx, AV_LOG_WARNING, "Invalid channel count\n"); +if (avctx->ch_layout.nb_channels < 1) +return AVERROR(EINVAL); alac->channels = avctx->ch_layout.nb_channels; } -if (avctx->ch_layout.nb_channels > ALAC_MAX_CHANNELS || avctx->ch_layout.nb_channels <= 0 ) { +if (alac->channels > ALAC_MAX_CHANNELS) { avpriv_report_missing_feature(avctx, "Channel count %d", - avctx->ch_layout.nb_channels); + alac->channels); return AVERROR_PATCHWELCOME; } av_channel_layout_uninit(&avctx->ch_layout); ___ 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/ttmlenc: Deduplicate ttml_default_namespacing string
ffmpeg | branch: master | Andreas Rheinhardt | Fri Jul 29 08:43:55 2022 +0200| [879eedb2d1f185bd4998631be21b1417874e] | committer: Andreas Rheinhardt avcodec/ttmlenc: Deduplicate ttml_default_namespacing string String literals are allowed to be deduplicated (and toolchains are already capable of doing so), yet the same is not allowed for named arrays (even when they contain strings). Therefore use a const char *const pointing to an unnamed string literal for ttml_default_namespacing. Reviewed-by: Jan Ekström Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=879eedb2d1f185bd4998631be21b1417874e --- libavcodec/ttmlenc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ttmlenc.h b/libavcodec/ttmlenc.h index 467f35c7a6..654ca0ee4d 100644 --- a/libavcodec/ttmlenc.h +++ b/libavcodec/ttmlenc.h @@ -25,7 +25,7 @@ #define TTMLENC_EXTRADATA_SIGNATURE "lavc-ttmlenc" #define TTMLENC_EXTRADATA_SIGNATURE_SIZE (sizeof(TTMLENC_EXTRADATA_SIGNATURE) - 1) -static const char ttml_default_namespacing[] = +static const char *const ttml_default_namespacing = " xmlns=\"http://www.w3.org/ns/ttml\"\n"; " xmlns:ttm=\"http://www.w3.org/ns/ttml#metadata\"\n"; " xmlns:tts=\"http://www.w3.org/ns/ttml#styling\"\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] avcodec/proresdata: Move data only used by ff_prores_ks_encoder to it
ffmpeg | branch: master | Andreas Rheinhardt | Fri Jul 29 09:57:14 2022 +0200| [92e702863ce7df7f7670086cd2edd87e0a1c1487] | committer: Andreas Rheinhardt avcodec/proresdata: Move data only used by ff_prores_ks_encoder to it In this case, this allows to inline the initial run_cb and lev_cb values. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=92e702863ce7df7f7670086cd2edd87e0a1c1487 --- libavcodec/proresdata.c | 27 -- libavcodec/proresdata.h | 4 libavcodec/proresenc_kostya.c | 54 --- 3 files changed, 40 insertions(+), 45 deletions(-) diff --git a/libavcodec/proresdata.c b/libavcodec/proresdata.c index 9849b5cc00..4787907c71 100644 --- a/libavcodec/proresdata.c +++ b/libavcodec/proresdata.c @@ -43,30 +43,3 @@ const uint8_t ff_prores_interlaced_scan[64] = { 30, 23, 31, 38, 45, 52, 60, 53, 46, 39, 47, 54, 61, 62, 55, 63 }; - - -const uint8_t ff_prores_dc_codebook[4] = { -0x04, // rice_order = 0, exp_golomb_order = 1, switch_bits = 0 -0x28, // rice_order = 1, exp_golomb_order = 2, switch_bits = 0 -0x4D, // rice_order = 2, exp_golomb_order = 3, switch_bits = 1 -0x70 // rice_order = 3, exp_golomb_order = 4, switch_bits = 0 -}; - -const uint8_t ff_prores_ac_codebook[7] = { -0x04, // rice_order = 0, exp_golomb_order = 1, switch_bits = 0 -0x28, // rice_order = 1, exp_golomb_order = 2, switch_bits = 0 -0x4C, // rice_order = 2, exp_golomb_order = 3, switch_bits = 0 -0x05, // rice_order = 0, exp_golomb_order = 1, switch_bits = 1 -0x29, // rice_order = 1, exp_golomb_order = 2, switch_bits = 1 -0x06, // rice_order = 0, exp_golomb_order = 1, switch_bits = 2 -0x0A, // rice_order = 0, exp_golomb_order = 2, switch_bits = 2 -}; - -/** - * Lookup tables for adaptive switching between codebooks - * according with previous run/level value. - */ -const uint8_t ff_prores_run_to_cb_index[16] = -{ 5, 5, 3, 3, 0, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 2 }; - -const uint8_t ff_prores_lev_to_cb_index[10] = { 0, 6, 3, 5, 0, 1, 1, 1, 1, 2 }; diff --git a/libavcodec/proresdata.h b/libavcodec/proresdata.h index ee8278d5f4..d8c8786689 100644 --- a/libavcodec/proresdata.h +++ b/libavcodec/proresdata.h @@ -31,9 +31,5 @@ extern const uint8_t ff_prores_progressive_scan[64]; extern const uint8_t ff_prores_interlaced_scan[64]; #define FIRST_DC_CB 0xB8 // rice_order = 5, exp_golomb_order = 6, switch_bits = 0 -extern const uint8_t ff_prores_dc_codebook[4]; -extern const uint8_t ff_prores_ac_codebook[7]; -extern const uint8_t ff_prores_run_to_cb_index[16]; -extern const uint8_t ff_prores_lev_to_cb_index[10]; #endif /* AVCODEC_PRORESDATA_H */ diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index 391072d470..60bb2286f8 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -135,6 +135,32 @@ static const uint8_t prores_quant_matrices[][64] = { }, }; +static const uint8_t prores_dc_codebook[4] = { +0x04, // rice_order = 0, exp_golomb_order = 1, switch_bits = 0 +0x28, // rice_order = 1, exp_golomb_order = 2, switch_bits = 0 +0x4D, // rice_order = 2, exp_golomb_order = 3, switch_bits = 1 +0x70 // rice_order = 3, exp_golomb_order = 4, switch_bits = 0 +}; + +static const uint8_t prores_ac_codebook[7] = { +0x04, // rice_order = 0, exp_golomb_order = 1, switch_bits = 0 +0x28, // rice_order = 1, exp_golomb_order = 2, switch_bits = 0 +0x4C, // rice_order = 2, exp_golomb_order = 3, switch_bits = 0 +0x05, // rice_order = 0, exp_golomb_order = 1, switch_bits = 1 +0x29, // rice_order = 1, exp_golomb_order = 2, switch_bits = 1 +0x06, // rice_order = 0, exp_golomb_order = 1, switch_bits = 2 +0x0A, // rice_order = 0, exp_golomb_order = 2, switch_bits = 2 +}; + +/** + * Lookup tables for adaptive switching between codebooks + * according with previous run/level value. + */ +static const uint8_t prores_run_to_cb_index[16] = +{ 5, 5, 3, 3, 0, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 2 }; + +static const uint8_t prores_lev_to_cb_index[10] = { 0, 6, 3, 5, 0, 1, 1, 1, 1, 2 }; + #define NUM_MB_LIMITS 4 static const int prores_mb_limits[NUM_MB_LIMITS] = { 1620, // up to 720x576 @@ -423,7 +449,7 @@ static void encode_dcs(PutBitContext *pb, int16_t *blocks, new_sign = GET_SIGN(delta); delta= (delta ^ sign) - sign; code = MAKE_CODE(delta); -encode_vlc_codeword(pb, ff_prores_dc_codebook[codebook], code); +encode_vlc_codeword(pb, prores_dc_codebook[codebook], code); codebook = (code + (code & 1)) >> 1; codebook = FFMIN(codebook, 3); sign = new_sign; @@ -441,8 +467,8 @@ static void encode_acs(PutBitContext *pb, int16_t *blocks, int max_coeffs, abs_level; max_coeffs = blocks_per_slice << 6; -run_cb = ff_prores_run_to_cb_index[4]; -lev_cb = ff_prores_lev_to_cb_index[2]; +
[FFmpeg-cvslog] avcodec/threadframe: Constify the frame in ff_thread_await_progress
ffmpeg | branch: master | Andreas Rheinhardt | Fri Jul 22 06:27:05 2022 +0200| [a2d7da01e8f9a2ab5815c0a9718dc952f751667d] | committer: Andreas Rheinhardt avcodec/threadframe: Constify the frame in ff_thread_await_progress It is safe to call it on a const ThreadFrame*. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2d7da01e8f9a2ab5815c0a9718dc952f751667d --- libavcodec/pthread_frame.c | 2 +- libavcodec/threadframe.h | 2 +- libavcodec/utils.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 8faea75a49..a54d16fee4 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -615,7 +615,7 @@ void ff_thread_report_progress(ThreadFrame *f, int n, int field) pthread_mutex_unlock(&p->progress_mutex); } -void ff_thread_await_progress(ThreadFrame *f, int n, int field) +void ff_thread_await_progress(const ThreadFrame *f, int n, int field) { PerThreadContext *p; atomic_int *progress = f->progress ? (atomic_int*)f->progress->data : NULL; diff --git a/libavcodec/threadframe.h b/libavcodec/threadframe.h index dea4dadc6d..100e068e06 100644 --- a/libavcodec/threadframe.h +++ b/libavcodec/threadframe.h @@ -56,7 +56,7 @@ void ff_thread_report_progress(ThreadFrame *f, int progress, int field); * @param field The field being referenced, for field-picture codecs. * 0 for top field or frame pictures, 1 for bottom field. */ -void ff_thread_await_progress(ThreadFrame *f, int progress, int field); +void ff_thread_await_progress(const ThreadFrame *f, int progress, int field); /** * Wrapper around ff_get_buffer() for frame-multithreaded codecs. diff --git a/libavcodec/utils.c b/libavcodec/utils.c index cae61d80ff..e73e3a7d08 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -949,7 +949,7 @@ void ff_thread_report_progress(ThreadFrame *f, int progress, int field) { } -void ff_thread_await_progress(ThreadFrame *f, int progress, int field) +void ff_thread_await_progress(const ThreadFrame *f, int progress, int field) { } ___ 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_cropdetect: Remove set-but-unused variable
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 30 22:14:26 2022 +0200| [f0dd4ab055b16bcfe2f9ad1f00d109494db135aa] | committer: Andreas Rheinhardt avfilter/vf_cropdetect: Remove set-but-unused variable Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f0dd4ab055b16bcfe2f9ad1f00d109494db135aa --- libavfilter/vf_cropdetect.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index eec0c7ab68..7e985fb271 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -204,7 +204,6 @@ static int config_input(AVFilterLink *inlink) CropDetectContext *s = ctx->priv; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); const int bufsize = inlink->w * inlink->h; -int bpp; av_image_fill_max_pixsteps(s->max_pixsteps, NULL, desc); @@ -216,7 +215,6 @@ static int config_input(AVFilterLink *inlink) s->x2 = 0; s->y2 = 0; -bpp= s->max_pixsteps[0]; s->window_size = FFMAX(s->reset_count, 15); s->tmpbuf = av_malloc(bufsize); s->filterbuf = av_malloc(bufsize * s->max_pixsteps[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] tests/ref/fate/filter-metadata-cropdetect[12]: Fix ref file
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 30 22:20:12 2022 +0200| [f654aa8a096a4b1d9f3bd3d81417977486d8d009] | committer: Andreas Rheinhardt tests/ref/fate/filter-metadata-cropdetect[12]: Fix ref file Necessitated by 6ca43a9675d651d7ea47c7ba2fafb1bf831c4d0b and 425b309fa43236f4b7c098c7829b70a421fc1dd7. Reviewed-by: Martin Storsjö Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f654aa8a096a4b1d9f3bd3d81417977486d8d009 --- tests/ref/fate/filter-metadata-cropdetect1 | 20 +++- tests/ref/fate/filter-metadata-cropdetect2 | 21 - 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/tests/ref/fate/filter-metadata-cropdetect1 b/tests/ref/fate/filter-metadata-cropdetect1 index 892373cc11..78fbefd85a 100644 --- a/tests/ref/fate/filter-metadata-cropdetect1 +++ b/tests/ref/fate/filter-metadata-cropdetect1 @@ -1,9 +1,11 @@ -pts=0 -pts=1001 -pts=2002|tag:lavfi.cropdetect.x1=20|tag:lavfi.cropdetect.x2=851|tag:lavfi.cropdetect.y1=311|tag:lavfi.cropdetect.y2=601|tag:lavfi.cropdetect.w=832|tag:lavfi.cropdetect.h=288|tag:lavfi.cropdetect.x=20|tag:lavfi.cropdetect.y=314 -pts=3003|tag:lavfi.cropdetect.x1=20|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=311|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=864|tag:lavfi.cropdetect.h=304|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.y=316 -pts=4004|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.y=122 -pts=5005|tag:lavfi.cropdetect.x1=20|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=311|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=864|tag:lavfi.cropdetect.h=304|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.y=316 -pts=6006|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.y=122 -pts=7007|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.y=122 -pts=8008|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.y=122 +pts=0| + +pts=1001| + +pts=2002|tag:lavfi.cropdetect.x=20|tag:lavfi.cropdetect.x1=20|tag:lavfi.cropdetect.x2=851|tag:lavfi.cropdetect.y1=311|tag:lavfi.cropdetect.y2=601|tag:lavfi.cropdetect.w=832|tag:lavfi.cropdetect.h=288|tag:lavfi.cropdetect.y=314| +pts=3003|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.x1=20|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=311|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=864|tag:lavfi.cropdetect.h=304|tag:lavfi.cropdetect.y=316| +pts=4004|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.y=122| +pts=5005|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.x1=20|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=311|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=864|tag:lavfi.cropdetect.h=304|tag:lavfi.cropdetect.y=316| +pts=6006|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.y=122| +pts=7007|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.y=122| +pts=8008|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.y=122| diff --git a/tests/ref/fate/filter-metadata-cropdetect2 b/tests/ref/fate/filter-metadata-cropdetect2 index 1a628620ef..e58f00770d 100644 --- a/tests/ref/fate/filter-metadata-cropdetect2 +++ b/tests/ref/fate/filter-metadata-cropdetect2 @@ -1,9 +1,12 @@ -pts=0 -pts=512 -pts=1024|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1221|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=1116|tag:lavfi.cropdetect.w=1200|tag:lavfi.cropdetect.h=1088|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.y=22 -pts=1536|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1257|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=1116|tag:lavfi.cropdetect.w=1232|tag:lavfi.cropdetect.h=1088|tag:lavfi.cropdetect.x=24|tag:lavfi.cropdetect.y=22 -pts=2048|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1221|tag:lavfi.cropdetect.y1=15|tag:lavfi.cro
[FFmpeg-cvslog] avcodec/xwdenc: Don't modify input frame
ffmpeg | branch: master | Andreas Rheinhardt | Mon Jul 25 20:33:19 2022 +0200| [41ea00672ac4e4e3d2e4355a3cd4245ee245] | committer: Andreas Rheinhardt avcodec/xwdenc: Don't modify input frame These modifications were actually meant to be applied to the coded_frame, yet 08b31a72dbcf2935e871ef7c1ffa96ae200f78aa changed this and so this code has not been removed when coded_frame has been removed in 11bc79089378a5ec00547d0f85bc152afdf30dfa. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=41ea00672ac4e4e3d2e4355a3cd4245ee245 --- libavcodec/xwdenc.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/xwdenc.c b/libavcodec/xwdenc.c index 0c6dfc6569..a28fca08e0 100644 --- a/libavcodec/xwdenc.c +++ b/libavcodec/xwdenc.c @@ -31,7 +31,7 @@ #define WINDOW_NAME_SIZE11 static int xwd_encode_frame(AVCodecContext *avctx, AVPacket *pkt, -const AVFrame *pict, int *got_packet) +const AVFrame *p, int *got_packet) { enum AVPixelFormat pix_fmt = avctx->pix_fmt; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); @@ -40,7 +40,6 @@ static int xwd_encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint32_t header_size; int i, out_size, ret; uint8_t *ptr, *buf; -AVFrame * const p = (AVFrame *)pict; uint32_t pal[256]; pixdepth = av_get_bits_per_pixel(desc); @@ -151,9 +150,6 @@ static int xwd_encode_frame(AVCodecContext *avctx, AVPacket *pkt, return ret; buf = pkt->data; -p->key_frame = 1; -p->pict_type = AV_PICTURE_TYPE_I; - bytestream_put_be32(&buf, header_size); bytestream_put_be32(&buf, XWD_VERSION); // file version bytestream_put_be32(&buf, XWD_Z_PIXMAP); // pixmap format ___ 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/rgb2rgb: Don't cast const away
ffmpeg | branch: master | Andreas Rheinhardt | Mon Jul 25 20:44:54 2022 +0200| [da668fa7d24e54945b0cce4deb7ca026b5bd8301] | committer: Andreas Rheinhardt swscale/rgb2rgb: Don't cast const away Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=da668fa7d24e54945b0cce4deb7ca026b5bd8301 --- libswscale/rgb2rgb.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index b8be76913b..4f1ac9c465 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -317,7 +317,7 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size) void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size) { uint16_t *d = (uint16_t *)dst; -uint16_t *s = (uint16_t *)src; +const uint16_t *s = (const uint16_t *)src; int i, num_pixels = src_size >> 1; for (i = 0; i < num_pixels; i++) { @@ -331,7 +331,7 @@ void rgb48tobgr48_ ## need_bswap(const uint8_t *src, \ uint8_t *dst, int src_size)\ { \ uint16_t *d = (uint16_t *)dst; \ -uint16_t *s = (uint16_t *)src; \ +const uint16_t *s = (const uint16_t *)src; \ int i, num_pixels = src_size >> 1; \ \ for (i = 0; i < num_pixels; i += 3) { \ @@ -349,7 +349,7 @@ void rgb64tobgr48_ ## need_bswap(const uint8_t *src, \ uint8_t *dst, int src_size)\ { \ uint16_t *d = (uint16_t *)dst; \ -uint16_t *s = (uint16_t *)src; \ +const uint16_t *s = (const uint16_t *)src; \ int i, num_pixels = src_size >> 3; \ \ for (i = 0; i < num_pixels; i++) { \ @@ -367,7 +367,7 @@ void rgb64to48_ ## need_bswap(const uint8_t *src, \ uint8_t *dst, int src_size) \ { \ uint16_t *d = (uint16_t *)dst; \ -uint16_t *s = (uint16_t *)src; \ +const uint16_t *s = (const uint16_t *)src; \ int i, num_pixels = src_size >> 3; \ \ for (i = 0; i < num_pixels; i++) { \ @@ -385,7 +385,7 @@ void rgb48tobgr64_ ## need_bswap(const uint8_t *src, \ uint8_t *dst, int src_size)\ { \ uint16_t *d = (uint16_t *)dst; \ -uint16_t *s = (uint16_t *)src; \ +const uint16_t *s = (const uint16_t *)src; \ int i, num_pixels = src_size / 6; \ \ for (i = 0; i < num_pixels; i++) { \ @@ -404,7 +404,7 @@ void rgb48to64_ ## need_bswap(const uint8_t *src, \ uint8_t *dst, int src_size) \ { \ uint16_t *d = (uint16_t *)dst; \ -uint16_t *s = (uint16_t *)src; \ +const uint16_t *s = (const uint16_t *)src; \ int i, num_pixels = src_size / 6; \ \ for (i = 0; i < num_pixels; i++) { \ ___ 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/fitsenc: Don't cast const away unnecessarily
ffmpeg | branch: master | Andreas Rheinhardt | Mon Jul 25 21:19:53 2022 +0200| [021336317584fdf51e26b8eb205e27c955ab9292] | committer: Andreas Rheinhardt avcodec/fitsenc: Don't cast const away unnecessarily Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=021336317584fdf51e26b8eb205e27c955ab9292 --- libavcodec/fitsenc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/fitsenc.c b/libavcodec/fitsenc.c index 5e9100be85..6e0597c8ca 100644 --- a/libavcodec/fitsenc.c +++ b/libavcodec/fitsenc.c @@ -36,9 +36,8 @@ #include "encode.h" static int fits_encode_frame(AVCodecContext *avctx, AVPacket *pkt, -const AVFrame *pict, int *got_packet) + const AVFrame *p, int *got_packet) { -AVFrame * const p = (AVFrame *)pict; uint8_t *bytestream, *ptr; const uint16_t flip = (1 << 15); uint64_t data_size = 0, padded_data_size = 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] avcodec/gif: Remove redundant cast
ffmpeg | branch: master | Andreas Rheinhardt | Mon Jul 25 21:13:05 2022 +0200| [90c38612f8265d3751afa8d3f885023e472560c4] | committer: Andreas Rheinhardt avcodec/gif: Remove redundant cast Possible since 529a9893d769f381b72785c500662be2020da5fe. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90c38612f8265d3751afa8d3f885023e472560c4 --- libavcodec/gif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/gif.c b/libavcodec/gif.c index 4904f791ef..8e84b79b8c 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -508,7 +508,7 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (!s->image) { av_frame_unref(s->last_frame); -ret = av_frame_ref(s->last_frame, (AVFrame*)pict); +ret = av_frame_ref(s->last_frame, pict); if (ret < 0) return ret; } ___ 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/diracdsp: Don't cast const away unnecessarily
ffmpeg | branch: master | Andreas Rheinhardt | Mon Jul 25 21:24:12 2022 +0200| [e207f75ba8c9e74cb606bc36697149fca3a13a4c] | committer: Andreas Rheinhardt avcodec/diracdsp: Don't cast const away unnecessarily Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e207f75ba8c9e74cb606bc36697149fca3a13a4c --- libavcodec/diracdsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/diracdsp.c b/libavcodec/diracdsp.c index aafdddcdc3..284f914f9d 100644 --- a/libavcodec/diracdsp.c +++ b/libavcodec/diracdsp.c @@ -139,7 +139,7 @@ ADD_OBMC(32) static void put_signed_rect_clamped_8bit_c(uint8_t *dst, int dst_stride, const uint8_t *_src, int src_stride, int width, int height) { int x, y; -int16_t *src = (int16_t *)_src; +const int16_t *src = (const int16_t *)_src; for (y = 0; y < height; y++) { for (x = 0; x < width; x+=4) { dst[x ] = av_clip_uint8(src[x ] + 128); @@ -158,7 +158,7 @@ static void put_signed_rect_clamped_ ## PX ## bit_c(uint8_t *_dst, int dst_strid { \ int x, y; \ uint16_t *dst = (uint16_t *)_dst; \ -int32_t *src = (int32_t *)_src; \ +const int32_t *src = (const int32_t *)_src; \ for (y = 0; y < height; y++) { \ for (x = 0; x < width; x+=4) { \ dst[x ] = av_clip_uintp2(src[x ] + (1U << (PX - 1)), PX); \ ___ 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/pnmdec, pnm_parser: Improve const-correctness
ffmpeg | branch: master | Andreas Rheinhardt | Tue Jul 26 00:32:28 2022 +0200| [22ca2ef018096ce6019070e2067128dbd2f8d1fc] | committer: Andreas Rheinhardt avcodec/pnmdec, pnm_parser: Improve const-correctness Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=22ca2ef018096ce6019070e2067128dbd2f8d1fc --- libavcodec/pnm.c| 2 +- libavcodec/pnm.h| 6 +++--- libavcodec/pnm_parser.c | 8 libavcodec/pnmdec.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c index 605a529622..aabc788684 100644 --- a/libavcodec/pnm.c +++ b/libavcodec/pnm.c @@ -38,7 +38,7 @@ static void pnm_get(PNMContext *sc, char *str, int buf_size) { char *s; int c; -uint8_t *bs = sc->bytestream; +const uint8_t *bs = sc->bytestream; const uint8_t *end = sc->bytestream_end; /* skip spaces and comments */ diff --git a/libavcodec/pnm.h b/libavcodec/pnm.h index f109d16239..5bf2eaa4d9 100644 --- a/libavcodec/pnm.h +++ b/libavcodec/pnm.h @@ -25,9 +25,9 @@ #include "avcodec.h" typedef struct PNMContext { -uint8_t *bytestream; -uint8_t *bytestream_start; -uint8_t *bytestream_end; +const uint8_t *bytestream; +const uint8_t *bytestream_start; +const uint8_t *bytestream_end; int maxval; ///< maximum value of a pixel int type; int endian; diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c index 6607ac7e7f..74f918a94b 100644 --- a/libavcodec/pnm_parser.c +++ b/libavcodec/pnm_parser.c @@ -65,8 +65,8 @@ retry: pnmctx.bytestream_end = pc->buffer + pc->index; } else { pnmctx.bytestream_start = -pnmctx.bytestream = (uint8_t *) buf + skip; /* casts avoid warnings */ -pnmctx.bytestream_end = (uint8_t *) buf + buf_size - skip; +pnmctx.bytestream = buf + skip; +pnmctx.bytestream_end = buf + buf_size - skip; } if (ff_pnm_decode_header(avctx, &pnmctx) < 0) { if (pnmctx.bytestream < pnmctx.bytestream_end) { @@ -81,9 +81,9 @@ retry: goto retry; } } else if (pnmctx.type < 4) { - uint8_t *bs = pnmctx.bytestream; +const uint8_t *bs = pnmctx.bytestream; const uint8_t *end = pnmctx.bytestream_end; -uint8_t *sync = bs; +const uint8_t *sync = bs; if (pc->index) { av_assert0(pnmpc->ascii_scan <= end - bs); diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c index bb2ce53496..7cf9886ce7 100644 --- a/libavcodec/pnmdec.c +++ b/libavcodec/pnmdec.c @@ -52,8 +52,8 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p, float scale; s->bytestream_start = -s->bytestream = (uint8_t *)buf; -s->bytestream_end = (uint8_t *)buf + buf_size; +s->bytestream = buf; +s->bytestream_end = buf + buf_size; if ((ret = ff_pnm_decode_header(avctx, s)) < 0) return ret; ___ 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/ilbcdec: Move transient GetBitContext from ctx to stack
ffmpeg | branch: master | Andreas Rheinhardt | Mon Jul 25 23:02:11 2022 +0200| [d8388e1b4e3965dd17d6aafbee1438e49cb6a219] | committer: Andreas Rheinhardt avcodec/ilbcdec: Move transient GetBitContext from ctx to stack Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d8388e1b4e3965dd17d6aafbee1438e49cb6a219 --- libavcodec/ilbcdec.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libavcodec/ilbcdec.c b/libavcodec/ilbcdec.c index 4905ee4145..2bc559a3e8 100644 --- a/libavcodec/ilbcdec.c +++ b/libavcodec/ilbcdec.c @@ -91,7 +91,6 @@ typedef struct ILBCContext { int enhancer; int mode; -GetBitContextgb; ILBCFrameframe; int prev_enh_pl; @@ -127,11 +126,14 @@ typedef struct ILBCContext { int16_t hpimemy[4]; } ILBCContext; -static int unpack_frame(ILBCContext *s) +static int unpack_frame(ILBCContext *s, const uint8_t *buf, int size) { ILBCFrame *frame = &s->frame; -GetBitContext *gb = &s->gb; -int j; +GetBitContext gb0, *const gb = &gb0; +int j, ret; + +if ((ret = init_get_bits8(gb, buf, size)) < 0) +return ret; frame->lsf[0] = get_bits(gb, 6); frame->lsf[1] = get_bits(gb, 7); @@ -1357,21 +1359,21 @@ static void hp_output(int16_t *signal, const int16_t *ba, int16_t *y, static int ilbc_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt) { -const uint8_t *buf = avpkt->data; ILBCContext *s = avctx->priv_data; int mode = s->mode, ret; int16_t *plc_data = &s->plc_residual[LPC_FILTERORDER]; -if ((ret = init_get_bits8(&s->gb, buf, avpkt->size)) < 0) -return ret; memset(&s->frame, 0, sizeof(ILBCFrame)); +ret = unpack_frame(s, avpkt->data, avpkt->size); +if (ret < 0) +return ret; +if (ret) +mode = 0; frame->nb_samples = s->block_samples; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; -if (unpack_frame(s)) -mode = 0; if (s->frame.start < 1 || s->frame.start > 5) mode = 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] avcodec/dxv: Don't cast const away unnecessarily
ffmpeg | branch: master | Andreas Rheinhardt | Mon Jul 25 21:24:43 2022 +0200| [941a82b57c8e69ca72a82695cef97604f5a9e944] | committer: Andreas Rheinhardt avcodec/dxv: Don't cast const away unnecessarily Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=941a82b57c8e69ca72a82695cef97604f5a9e944 --- libavcodec/dxv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index b3df00a5d8..f36454a9f6 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -432,7 +432,7 @@ static int get_opcodes(GetByteContext *gb, uint32_t *table, uint8_t *dst, int op int64_t size_in_bits; unsigned endoffset, newoffset, offset; unsigned next; -uint8_t *src = (uint8_t *)gb->buffer; +const uint8_t *src = gb->buffer; ret = fill_optable(table, optable, nb_elements); 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] avcodec/ilbcdec: Fix const correctness
ffmpeg | branch: master | Andreas Rheinhardt | Mon Jul 25 22:37:21 2022 +0200| [86460b366cfb12f7a192e15883148272b1dd5513] | committer: Andreas Rheinhardt avcodec/ilbcdec: Fix const correctness Also constify everything that can be constified. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86460b366cfb12f7a192e15883148272b1dd5513 --- libavcodec/ilbcdec.c | 66 +--- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/libavcodec/ilbcdec.c b/libavcodec/ilbcdec.c index 4c82631c34..4905ee4145 100644 --- a/libavcodec/ilbcdec.c +++ b/libavcodec/ilbcdec.c @@ -331,8 +331,8 @@ static void lsf_check_stability(int16_t *lsf, int dim, int nb_vectors) } } -static void lsf_interpolate(int16_t *out, int16_t *in1, -int16_t *in2, int16_t coef, +static void lsf_interpolate(int16_t *out, const int16_t *in1, +const int16_t *in2, int16_t coef, int size) { int invcoef = 16384 - coef, i; @@ -341,7 +341,7 @@ static void lsf_interpolate(int16_t *out, int16_t *in1, out[i] = (coef * in1[i] + invcoef * in2[i] + 8192) >> 14; } -static void lsf2lsp(int16_t *lsf, int16_t *lsp, int order) +static void lsf2lsp(const int16_t *lsf, int16_t *lsp, int order) { int16_t diff, freq; int32_t tmp; @@ -364,7 +364,7 @@ static void lsf2lsp(int16_t *lsf, int16_t *lsp, int order) } } -static void get_lsp_poly(int16_t *lsp, int32_t *f) +static void get_lsp_poly(const int16_t *lsp, int32_t *f) { int16_t high, low; int i, j, k, l; @@ -391,7 +391,7 @@ static void get_lsp_poly(int16_t *lsp, int32_t *f) } } -static void lsf2poly(int16_t *a, int16_t *lsf) +static void lsf2poly(int16_t *a, const int16_t *lsf) { int32_t f[2][6]; int16_t lsp[10]; @@ -418,8 +418,8 @@ static void lsf2poly(int16_t *a, int16_t *lsf) } } -static void lsp_interpolate2polydec(int16_t *a, int16_t *lsf1, - int16_t *lsf2, int coef, int length) +static void lsp_interpolate2polydec(int16_t *a, const int16_t *lsf1, +const int16_t *lsf2, int coef, int length) { int16_t lsftmp[LPC_FILTERORDER]; @@ -437,13 +437,13 @@ static void bw_expand(int16_t *out, const int16_t *in, const int16_t *coef, int } static void lsp_interpolate(int16_t *syntdenum, int16_t *weightdenum, -int16_t *lsfdeq, int16_t length, +const int16_t *lsfdeq, int16_t length, ILBCContext *s) { -int16_t lp[LPC_FILTERORDER + 1], *lsfdeq2; +int16_t lp[LPC_FILTERORDER + 1]; +const int16_t *const lsfdeq2 = lsfdeq + length; int i, pos, lp_length; -lsfdeq2 = lsfdeq + length; lp_length = length + 1; if (s->mode == 30) { @@ -478,8 +478,8 @@ static void lsp_interpolate(int16_t *syntdenum, int16_t *weightdenum, } } -static void filter_mafq12(int16_t *in_ptr, int16_t *out_ptr, - int16_t *B, int16_t B_length, +static void filter_mafq12(const int16_t *in_ptr, int16_t *out_ptr, + const int16_t *B, int16_t B_length, int16_t length) { int o, i, j; @@ -520,13 +520,14 @@ static void filter_arfq12(const int16_t *data_in, } } -static void state_construct(int16_t ifm, int16_t *idx, - int16_t *synt_denum, int16_t *Out_fix, +static void state_construct(int16_t ifm, const int16_t *idx, +const int16_t *synt_denum, int16_t *Out_fix, int16_t len) { int k; int16_t maxVal; -int16_t *tmp1, *tmp2, *tmp3; +int16_t *tmp1, *tmp3; +const int16_t *tmp2; /* Stack based */ int16_t numerator[1 + LPC_FILTERORDER]; int16_t sampleValVec[2 * STATE_SHORT_LEN_30MS + LPC_FILTERORDER]; @@ -630,7 +631,7 @@ static void add_vector_and_shift(int16_t *out, const int16_t *in1, out[i] = (in1[i] + in2[i]) >> shift; } -static void create_augmented_vector(int index, int16_t *buffer, int16_t *cbVec) +static void create_augmented_vector(int index, const int16_t *buffer, int16_t *cbVec) { int16_t cbVecTmp[4]; int interpolation_length = FFMIN(4, index); @@ -696,7 +697,7 @@ static void get_codebook(int16_t * cbvec, /* (o) Constructed codebook vector * /* do filtering to get the codebook vector */ -filter_mafq12(&mem[memIndTest + 4], cbvec, (int16_t *) kCbFiltersRev, CB_FILTERLEN, cbveclen); +filter_mafq12(&mem[memIndTest + 4], cbvec, kCbFiltersRev, CB_FILTERLEN, cbveclen); } else { /* interpolated vectors */ /* Stuff zeros outside memory buffer */ @@ -704,7 +705,7 @@ static void get_codebook(int16_t * cbvec, /* (o) Constructed codebook vector * memset(mem + lMem, 0, CB_HALFFILTERL
[FFmpeg-cvslog] avcodec/pnmdec: Fix indentation
ffmpeg | branch: master | Andreas Rheinhardt | Tue Jul 26 00:48:41 2022 +0200| [e4547c136acf4a956824b9cbfd53eecfb8aa93c0] | committer: Andreas Rheinhardt avcodec/pnmdec: Fix indentation Forgotten after ff1450e449f848ad4b37b3cf448315ba4581364e. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e4547c136acf4a956824b9cbfd53eecfb8aa93c0 --- libavcodec/pnmdec.c | 139 ++-- 1 file changed, 70 insertions(+), 69 deletions(-) diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c index 7cf9886ce7..130407df25 100644 --- a/libavcodec/pnmdec.c +++ b/libavcodec/pnmdec.c @@ -166,23 +166,23 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p, ptr+= linesize; } }else{ -for (i = 0; i < avctx->height; i++) { -if (!upgrade) -samplecpy(ptr, s->bytestream, n, s->maxval); -else if (upgrade == 1) { -unsigned int j, f = (255 * 128 + s->maxval / 2) / s->maxval; -for (j = 0; j < n; j++) -ptr[j] = (s->bytestream[j] * f + 64) >> 7; -} else if (upgrade == 2) { -unsigned int j, v, f = (65535 * 32768 + s->maxval / 2) / s->maxval; -for (j = 0; j < n / 2; j++) { -v = AV_RB16(s->bytestream + 2*j); -((uint16_t *)ptr)[j] = (v * f + 16384) >> 15; +for (int i = 0; i < avctx->height; i++) { +if (!upgrade) +samplecpy(ptr, s->bytestream, n, s->maxval); +else if (upgrade == 1) { +unsigned int f = (255 * 128 + s->maxval / 2) / s->maxval; +for (unsigned j = 0; j < n; j++) +ptr[j] = (s->bytestream[j] * f + 64) >> 7; +} else if (upgrade == 2) { +unsigned int f = (65535 * 32768 + s->maxval / 2) / s->maxval; +for (unsigned j = 0; j < n / 2; j++) { +unsigned v = AV_RB16(s->bytestream + 2*j); +((uint16_t *)ptr)[j] = (v * f + 16384) >> 15; +} } +s->bytestream += n; +ptr += linesize; } -s->bytestream += n; -ptr += linesize; -} } break; case AV_PIX_FMT_YUV420P: @@ -260,46 +260,46 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p, break; case AV_PIX_FMT_GBRPF32: if (!s->half) { -if (avctx->width * avctx->height * 12 > s->bytestream_end - s->bytestream) -return AVERROR_INVALIDDATA; -scale = 1.f / s->scale; -if (s->endian) { -float *r, *g, *b; +if (avctx->width * avctx->height * 12 > s->bytestream_end - s->bytestream) +return AVERROR_INVALIDDATA; +scale = 1.f / s->scale; +if (s->endian) { +float *r, *g, *b; -r = (float *)p->data[2]; -g = (float *)p->data[0]; -b = (float *)p->data[1]; -for (int i = 0; i < avctx->height; i++) { -for (int j = 0; j < avctx->width; j++) { -r[j] = av_int2float(AV_RL32(s->bytestream+0)) * scale; -g[j] = av_int2float(AV_RL32(s->bytestream+4)) * scale; -b[j] = av_int2float(AV_RL32(s->bytestream+8)) * scale; -s->bytestream += 12; +r = (float *)p->data[2]; +g = (float *)p->data[0]; +b = (float *)p->data[1]; +for (int i = 0; i < avctx->height; i++) { +for (int j = 0; j < avctx->width; j++) { +r[j] = av_int2float(AV_RL32(s->bytestream+0)) * scale; +g[j] = av_int2float(AV_RL32(s->bytestream+4)) * scale; +b[j] = av_int2float(AV_RL32(s->bytestream+8)) * scale; +s->bytestream += 12; +} + +r += p->linesize[2] / 4; +g += p->linesize[0] / 4; +b += p->linesize[1] / 4; } +} else { +float *r, *g, *b; -r += p->linesize[2] / 4; -g += p->linesize[0] / 4; -b += p->linesize[1] / 4; -} -} else { -float *r, *g, *b; +r = (float *)p->data[2]; +g = (float *)p->data[0]; +b = (float *)p->data[1]; +for (int i = 0; i < avctx->height; i++) { +for (int j = 0; j < avctx->width; j++) { +r[j] = av_int2float(AV_RB32(s->bytestream+0)) * scale; +g[j] = av_int2float(AV_RB32(s->bytestream+4)) * scale; +b[j] = av_int2float(AV_RB
[FFmpeg-cvslog] avcodec/cinepakenc: Avoid casting const away
ffmpeg | branch: master | Andreas Rheinhardt | Mon Jul 25 21:33:14 2022 +0200| [e86b8ca7f1c149b15e1e173191fcd59b48497519] | committer: Andreas Rheinhardt avcodec/cinepakenc: Avoid casting const away Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e86b8ca7f1c149b15e1e173191fcd59b48497519 --- libavcodec/cinepakenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/cinepakenc.c b/libavcodec/cinepakenc.c index 95af3cc7ef..559056a0e8 100644 --- a/libavcodec/cinepakenc.c +++ b/libavcodec/cinepakenc.c @@ -429,7 +429,7 @@ static int encode_codebook(CinepakEncContext *s, int *codebook, int size, // sets out to the sub picture starting at (x,y) in in static void get_sub_picture(CinepakEncContext *s, int x, int y, -uint8_t * in_data[4], int in_linesize[4], +uint8_t *const in_data[4], const int in_linesize[4], uint8_t *out_data[4], int out_linesize[4]) { out_data[0] = in_data[0] + x + y * in_linesize[0]; @@ -1097,7 +1097,7 @@ static int rd_frame(CinepakEncContext *s, const AVFrame *frame, data, linesize); else get_sub_picture(s, 0, y, -(uint8_t **)frame->data, (int *)frame->linesize, +frame->data, frame->linesize, data, linesize); get_sub_picture(s, 0, y, s->last_frame->data, s->last_frame->linesize, ___ 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/snow: Remove unused halfpel_plane
ffmpeg | branch: master | Andreas Rheinhardt | Tue Jul 26 06:21:26 2022 +0200| [7e41f95dce6390f39a5134a25213828ed65fac6b] | committer: Andreas Rheinhardt avcodec/snow: Remove unused halfpel_plane Committed in 5be3a818719d613e2f225cf1532fda01ba106b04 in an unfinished state; never used or finished and always disabled. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e41f95dce6390f39a5134a25213828ed65fac6b --- libavcodec/snow.c | 67 +-- libavcodec/snow.h | 1 - 2 files changed, 1 insertion(+), 67 deletions(-) diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 293a0eb7d9..5e0033063d 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -359,7 +359,7 @@ void ff_snow_pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, ptrdiff_t st } } }else{ -uint8_t *src= s->last_picture[block->ref]->data[plane_index]; +const uint8_t *src = s->last_picture[block->ref]->data[plane_index]; const int scale= plane_index ? (2*s->mv_scale)>>s->chroma_h_shift : 2*s->mv_scale; int mx= block->mx*scale; int my= block->my*scale; @@ -587,72 +587,12 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) { return 0; } -#define USE_HALFPEL_PLANE 0 - -static int halfpel_interpol(SnowContext *s, uint8_t *halfpel[4][4], AVFrame *frame){ -int p,x,y; - -for(p=0; p < s->nb_planes; p++){ -int is_chroma= !!p; -int w= is_chroma ? AV_CEIL_RSHIFT(s->avctx->width, s->chroma_h_shift) : s->avctx->width; -int h= is_chroma ? AV_CEIL_RSHIFT(s->avctx->height, s->chroma_v_shift) : s->avctx->height; -int ls= frame->linesize[p]; -uint8_t *src= frame->data[p]; - -halfpel[1][p] = av_malloc_array(ls, (h + 2 * EDGE_WIDTH)); -halfpel[2][p] = av_malloc_array(ls, (h + 2 * EDGE_WIDTH)); -halfpel[3][p] = av_malloc_array(ls, (h + 2 * EDGE_WIDTH)); -if (!halfpel[1][p] || !halfpel[2][p] || !halfpel[3][p]) { -av_freep(&halfpel[1][p]); -av_freep(&halfpel[2][p]); -av_freep(&halfpel[3][p]); -return AVERROR(ENOMEM); -} -halfpel[1][p] += EDGE_WIDTH * (1 + ls); -halfpel[2][p] += EDGE_WIDTH * (1 + ls); -halfpel[3][p] += EDGE_WIDTH * (1 + ls); - -halfpel[0][p]= src; -for(y=0; y>5; -} -} -for(y=0; y>5; -} -} -src= halfpel[1][p]; -for(y=0; y>5; -} -} - -//FIXME border! -} -return 0; -} - void ff_snow_release_buffer(AVCodecContext *avctx) { SnowContext *s = avctx->priv_data; -int i; if(s->last_picture[s->max_ref_frames-1]->data[0]){ av_frame_unref(s->last_picture[s->max_ref_frames-1]); -for(i=0; i<9; i++) -if(s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3]) { -av_free(s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3] - EDGE_WIDTH*(1+s->current_picture->linesize[i%3])); -s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3] = NULL; -} } } @@ -665,11 +605,6 @@ int ff_snow_frame_start(SnowContext *s){ tmp= s->last_picture[s->max_ref_frames-1]; for(i=s->max_ref_frames-1; i>0; i--) s->last_picture[i] = s->last_picture[i-1]; -memmove(s->halfpel_plane+1, s->halfpel_plane, (s->max_ref_frames-1)*sizeof(void*)*4*4); -if(USE_HALFPEL_PLANE && s->current_picture->data[0]) { -if((ret = halfpel_interpol(s, s->halfpel_plane[0], s->current_picture)) < 0) -return ret; -} s->last_picture[0] = s->current_picture; s->current_picture = tmp; diff --git a/libavcodec/snow.h b/libavcodec/snow.h index f5beca66e9..709fef6be5 100644 --- a/libavcodec/snow.h +++ b/libavcodec/snow.h @@ -127,7 +127,6 @@ typedef struct SnowContext{ AVFrame *input_picture; ///< new_picture with the internal linesizes AVFrame *current_picture; AVFrame *last_picture[MAX_REF_FRAMES]; -uint8_t *halfpel_plane[MAX_REF_FRAMES][4][4]; AVFrame *mconly_picture; // uint8_t q_context[16]; uint8_t header_state[32]; ___ 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/pngenc: Don't cast const away unnecessarily
ffmpeg | branch: master | Andreas Rheinhardt | Tue Jul 26 20:19:06 2022 +0200| [dd20ebb2ca2a572557de612eef2df1a57738efde] | committer: Andreas Rheinhardt avcodec/pngenc: Don't cast const away unnecessarily Possible since 529a9893d769f381b72785c500662be2020da5fe. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd20ebb2ca2a572557de612eef2df1a57738efde --- libavcodec/pngenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 8ef863a6c1..c86cf5a862 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -1056,7 +1056,7 @@ static int encode_apng(AVCodecContext *avctx, AVPacket *pkt, } av_frame_unref(s->last_frame); -ret = av_frame_ref(s->last_frame, (AVFrame*)pict); +ret = av_frame_ref(s->last_frame, pict); if (ret < 0) return ret; ___ 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/mpegvideo: Inline values in ff_update_block_index()
ffmpeg | branch: master | Andreas Rheinhardt | Tue Jul 26 20:02:25 2022 +0200| [145236741d9a7c18da4ee22c30b777b781bc5ac8] | committer: Andreas Rheinhardt avcodec/mpegvideo: Inline values in ff_update_block_index() This is possible for most of the callers, because e.g. only the MPEG-4 decoder can have bits_per_raw_sample > 8. Also most mpegvideo-based codecs are 420 only. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=145236741d9a7c18da4ee22c30b777b781bc5ac8 --- libavcodec/h261dec.c | 4 ++-- libavcodec/h261enc.c | 2 +- libavcodec/h263dec.c | 3 ++- libavcodec/mpeg4videodec.c | 6 -- libavcodec/mpeg_er.c | 3 ++- libavcodec/mpegvideo.h | 12 +++- libavcodec/mpegvideo_enc.c | 2 +- libavcodec/rv10.c | 2 +- libavcodec/rv34.c | 2 +- libavcodec/vc1_block.c | 17 - 10 files changed, 33 insertions(+), 20 deletions(-) diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index af9ccbbd70..97c126ab5a 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -214,7 +214,7 @@ static int h261_decode_mb_skipped(H261DecContext *h, int mba1, int mba2) s->mb_y = ((h->gob_number - 1) / 2) * 3 + i / 11; xy = s->mb_x + s->mb_y * s->mb_stride; ff_init_block_index(s); -ff_update_block_index(s); +ff_update_block_index(s, 8, s->avctx->lowres, 1); for (j = 0; j < 6; j++) s->block_last_index[j] = -1; @@ -400,7 +400,7 @@ static int h261_decode_mb(H261DecContext *h) s->mb_y = ((h->gob_number - 1) / 2) * 3 + ((h->current_mba - 1) / 11); xy = s->mb_x + s->mb_y * s->mb_stride; ff_init_block_index(s); -ff_update_block_index(s); +ff_update_block_index(s, 8, s->avctx->lowres, 1); // Read mtype com->mtype = get_vlc2(&s->gb, h261_mtype_vlc.table, H261_MTYPE_VLC_BITS, 2); diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c index a7fb666faa..a1fba968a4 100644 --- a/libavcodec/h261enc.c +++ b/libavcodec/h261enc.c @@ -139,7 +139,7 @@ void ff_h261_reorder_mb_index(MpegEncContext *s) s->mb_y += 3 * index; ff_init_block_index(s); -ff_update_block_index(s); +ff_update_block_index(s, 8, 0, 1); } } diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 39183c8b27..b4f9fa5022 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -258,7 +258,8 @@ static int decode_slice(MpegEncContext *s) for (; s->mb_x < s->mb_width; s->mb_x++) { int ret; -ff_update_block_index(s); +ff_update_block_index(s, s->avctx->bits_per_raw_sample, + s->avctx->lowres, s->chroma_x_shift); if (s->resync_mb_x == s->mb_x && s->resync_mb_y + 1 == s->mb_y) s->first_slice_line = 0; diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 5591816db5..bfebc3806c 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -772,7 +772,8 @@ static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx) int dir = 0; mb_num++; -ff_update_block_index(s); +ff_update_block_index(s, s->avctx->bits_per_raw_sample, + s->avctx->lowres, s->chroma_x_shift); if (s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y + 1) s->first_slice_line = 0; @@ -963,7 +964,8 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count) const int xy = s->mb_x + s->mb_y * s->mb_stride; mb_num++; -ff_update_block_index(s); +ff_update_block_index(s, s->avctx->bits_per_raw_sample, + s->avctx->lowres, s->chroma_x_shift); if (s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y + 1) s->first_slice_line = 0; diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c index f54cb8548b..02f407d8ea 100644 --- a/libavcodec/mpeg_er.c +++ b/libavcodec/mpeg_er.c @@ -75,7 +75,8 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, memcpy(s->mv, mv, sizeof(*mv)); ff_init_block_index(s); -ff_update_block_index(s); +ff_update_block_index(s, s->avctx->bits_per_raw_sample, + s->avctx->lowres, s->chroma_x_shift); s->bdsp.clear_blocks(s->block[0]); if (!s->chroma_y_shift) diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 82889a0edd..195a2b3238 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -590,9 +590,11 @@ void ff_mpv_motion(MpegEncContext *s, op_pixels_func (*pix_op)[4], qpel_mc_func (*qpix_op)[16]); -static inline void ff_update_block_index(MpegEncContext *s){ -const int bytes_per_pixel = 1 + (s->avctx->bits_per_raw_sample > 8
[FFmpeg-cvslog] avcodec/half2float: Constify arrays in half2float()
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 23 06:17:08 2022 +0200| [2793e4353f2ec11084bcdf211c32649c47a704bc] | committer: Andreas Rheinhardt avcodec/half2float: Constify arrays in half2float() Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2793e4353f2ec11084bcdf211c32649c47a704bc --- libavcodec/half2float.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/half2float.h b/libavcodec/half2float.h index fd11caffdf..7df6747e50 100644 --- a/libavcodec/half2float.h +++ b/libavcodec/half2float.h @@ -61,8 +61,8 @@ static void half2float_table(uint32_t *mantissatable, uint32_t *exponenttable, offsettable[32] = 0; } -static uint32_t half2float(uint16_t h, uint32_t *mantissatable, uint32_t *exponenttable, - uint16_t *offsettable) +static uint32_t half2float(uint16_t h, const uint32_t *mantissatable, const uint32_t *exponenttable, + const uint16_t *offsettable) { uint32_t f; ___ 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/lossless_videoencdsp: Constify src sub_left_predict
ffmpeg | branch: master | Andreas Rheinhardt | Tue Jul 26 06:30:28 2022 +0200| [dc3e25e4d3c152ff87030e89247b3e8d9bdef925] | committer: Andreas Rheinhardt avcodec/lossless_videoencdsp: Constify src sub_left_predict Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dc3e25e4d3c152ff87030e89247b3e8d9bdef925 --- libavcodec/lossless_videoencdsp.c | 2 +- libavcodec/lossless_videoencdsp.h | 2 +- libavcodec/x86/lossless_videoencdsp.asm| 2 +- libavcodec/x86/lossless_videoencdsp_init.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/lossless_videoencdsp.c b/libavcodec/lossless_videoencdsp.c index e0b78bb3da..b4130ebc7b 100644 --- a/libavcodec/lossless_videoencdsp.c +++ b/libavcodec/lossless_videoencdsp.c @@ -74,7 +74,7 @@ static void sub_median_pred_c(uint8_t *dst, const uint8_t *src1, *left_top = lt; } -static void sub_left_predict_c(uint8_t *dst, uint8_t *src, +static void sub_left_predict_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, ptrdiff_t width, int height) { int i, j; diff --git a/libavcodec/lossless_videoencdsp.h b/libavcodec/lossless_videoencdsp.h index 7794f03e3f..f2c2878485 100644 --- a/libavcodec/lossless_videoencdsp.h +++ b/libavcodec/lossless_videoencdsp.h @@ -35,7 +35,7 @@ typedef struct LLVidEncDSPContext { const uint8_t *src2, intptr_t w, int *left, int *left_top); -void (*sub_left_predict)(uint8_t *dst, uint8_t *src, +void (*sub_left_predict)(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, ptrdiff_t width, int height); } LLVidEncDSPContext; diff --git a/libavcodec/x86/lossless_videoencdsp.asm b/libavcodec/x86/lossless_videoencdsp.asm index 2e1d01bc2c..c579891d6a 100644 --- a/libavcodec/x86/lossless_videoencdsp.asm +++ b/libavcodec/x86/lossless_videoencdsp.asm @@ -145,7 +145,7 @@ DIFF_BYTES_PROLOGUE ;-- -;void sub_left_predict(uint8_t *dst, uint8_t *src, ptrdiff_t stride, ptrdiff_t width, int height) +;void sub_left_predict(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, ptrdiff_t width, int height) ;-- INIT_XMM avx diff --git a/libavcodec/x86/lossless_videoencdsp_init.c b/libavcodec/x86/lossless_videoencdsp_init.c index b3efcfdcd7..22a4014ef1 100644 --- a/libavcodec/x86/lossless_videoencdsp_init.c +++ b/libavcodec/x86/lossless_videoencdsp_init.c @@ -34,7 +34,7 @@ void ff_diff_bytes_sse2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, void ff_diff_bytes_avx2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, intptr_t w); -void ff_sub_left_predict_avx(uint8_t *dst, uint8_t *src, +void ff_sub_left_predict_avx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, ptrdiff_t width, int height); #if HAVE_INLINE_ASM ___ 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/videodsp: Constify buf in VideoDSPContext.prefetch
ffmpeg | branch: master | Andreas Rheinhardt | Tue Jul 26 04:50:55 2022 +0200| [af43da3e4d861cd408292aefed0dea2121d5521a] | committer: Andreas Rheinhardt avcodec/videodsp: Constify buf in VideoDSPContext.prefetch Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af43da3e4d861cd408292aefed0dea2121d5521a --- libavcodec/aarch64/videodsp_init.c | 2 +- libavcodec/arm/videodsp_init_armv5te.c | 2 +- libavcodec/loongarch/videodsp_init.c | 2 +- libavcodec/mips/videodsp_init.c| 2 +- libavcodec/ppc/videodsp.c | 2 +- libavcodec/videodsp.c | 2 +- libavcodec/videodsp.h | 2 +- libavcodec/x86/videodsp_init.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/aarch64/videodsp_init.c b/libavcodec/aarch64/videodsp_init.c index 6f667a6d3e..1f77a918d7 100644 --- a/libavcodec/aarch64/videodsp_init.c +++ b/libavcodec/aarch64/videodsp_init.c @@ -21,7 +21,7 @@ #include "libavutil/aarch64/cpu.h" #include "libavcodec/videodsp.h" -void ff_prefetch_aarch64(uint8_t *mem, ptrdiff_t stride, int h); +void ff_prefetch_aarch64(const uint8_t *mem, ptrdiff_t stride, int h); av_cold void ff_videodsp_init_aarch64(VideoDSPContext *ctx, int bpc) { diff --git a/libavcodec/arm/videodsp_init_armv5te.c b/libavcodec/arm/videodsp_init_armv5te.c index 1ea1f3438d..eaa8c5bbf8 100644 --- a/libavcodec/arm/videodsp_init_armv5te.c +++ b/libavcodec/arm/videodsp_init_armv5te.c @@ -23,7 +23,7 @@ #include "libavcodec/videodsp.h" #include "videodsp_arm.h" -void ff_prefetch_arm(uint8_t *mem, ptrdiff_t stride, int h); +void ff_prefetch_arm(const uint8_t *mem, ptrdiff_t stride, int h); av_cold void ff_videodsp_init_armv5te(VideoDSPContext *ctx, int bpc) { diff --git a/libavcodec/loongarch/videodsp_init.c b/libavcodec/loongarch/videodsp_init.c index 6cbb7763ff..92ade4f846 100644 --- a/libavcodec/loongarch/videodsp_init.c +++ b/libavcodec/loongarch/videodsp_init.c @@ -22,7 +22,7 @@ #include "libavcodec/videodsp.h" #include "libavutil/attributes.h" -static void prefetch_loongarch(uint8_t *mem, ptrdiff_t stride, int h) +static void prefetch_loongarch(const uint8_t *mem, ptrdiff_t stride, int h) { register const uint8_t *p = mem; diff --git a/libavcodec/mips/videodsp_init.c b/libavcodec/mips/videodsp_init.c index 07c23bcf7e..89409fc8fd 100644 --- a/libavcodec/mips/videodsp_init.c +++ b/libavcodec/mips/videodsp_init.c @@ -24,7 +24,7 @@ #include "libavutil/mips/asmdefs.h" #include "libavcodec/videodsp.h" -static void prefetch_mips(uint8_t *mem, ptrdiff_t stride, int h) +static void prefetch_mips(const uint8_t *mem, ptrdiff_t stride, int h) { register const uint8_t *p = mem; diff --git a/libavcodec/ppc/videodsp.c b/libavcodec/ppc/videodsp.c index 915702252e..a7ab5a6a42 100644 --- a/libavcodec/ppc/videodsp.c +++ b/libavcodec/ppc/videodsp.c @@ -21,7 +21,7 @@ #include "libavutil/attributes.h" #include "libavcodec/videodsp.h" -static void prefetch_ppc(uint8_t *mem, ptrdiff_t stride, int h) +static void prefetch_ppc(const uint8_t *mem, ptrdiff_t stride, int h) { register const uint8_t *p = mem; do { diff --git a/libavcodec/videodsp.c b/libavcodec/videodsp.c index 90dc1aacbd..bdff2e76f5 100644 --- a/libavcodec/videodsp.c +++ b/libavcodec/videodsp.c @@ -32,7 +32,7 @@ #include "videodsp_template.c" #undef BIT_DEPTH -static void just_return(uint8_t *buf, ptrdiff_t stride, int h) +static void just_return(const uint8_t *buf, ptrdiff_t stride, int h) { } diff --git a/libavcodec/videodsp.h b/libavcodec/videodsp.h index b5219d236c..e8960b609d 100644 --- a/libavcodec/videodsp.h +++ b/libavcodec/videodsp.h @@ -72,7 +72,7 @@ typedef struct VideoDSPContext { * @param stride distance between two lines of buf (in bytes) * @param h number of lines to prefetch */ -void (*prefetch)(uint8_t *buf, ptrdiff_t stride, int h); +void (*prefetch)(const uint8_t *buf, ptrdiff_t stride, int h); } VideoDSPContext; void ff_videodsp_init(VideoDSPContext *ctx, int bpc); diff --git a/libavcodec/x86/videodsp_init.c b/libavcodec/x86/videodsp_init.c index a14c9635fb..ae9db95624 100644 --- a/libavcodec/x86/videodsp_init.c +++ b/libavcodec/x86/videodsp_init.c @@ -215,7 +215,7 @@ static av_noinline void emulated_edge_mc_avx2(uint8_t *buf, const uint8_t *src, #endif /* HAVE_AVX2_EXTERNAL */ #endif /* HAVE_X86ASM */ -void ff_prefetch_mmxext(uint8_t *buf, ptrdiff_t stride, int h); +void ff_prefetch_mmxext(const uint8_t *buf, ptrdiff_t stride, int h); av_cold void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc) { ___ 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/cfhdencdsp: Constify input pointers
ffmpeg | branch: master | Andreas Rheinhardt | Tue Jul 26 07:50:01 2022 +0200| [e7cb7c762abca7444ed3a5a2a839b10c05c455f3] | committer: Andreas Rheinhardt avcodec/cfhdencdsp: Constify input pointers Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e7cb7c762abca7444ed3a5a2a839b10c05c455f3 --- libavcodec/cfhdencdsp.c | 6 +++--- libavcodec/cfhdencdsp.h | 4 ++-- libavcodec/x86/cfhdencdsp_init.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/cfhdencdsp.c b/libavcodec/cfhdencdsp.c index 3a35522d69..a122bcaf19 100644 --- a/libavcodec/cfhdencdsp.c +++ b/libavcodec/cfhdencdsp.c @@ -23,7 +23,7 @@ #include "cfhdencdsp.h" -static av_always_inline void filter(int16_t *input, ptrdiff_t in_stride, +static av_always_inline void filter(const int16_t *input, ptrdiff_t in_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len) @@ -46,7 +46,7 @@ static av_always_inline void filter(int16_t *input, ptrdiff_t in_stride, 1 * input[((len-2)-3)*in_stride] + 1 * input[((len-2)-4)*in_stride] + 4) >> 3); } -static void horiz_filter(int16_t *input, int16_t *low, int16_t *high, +static void horiz_filter(const int16_t *input, int16_t *low, int16_t *high, ptrdiff_t in_stride, ptrdiff_t low_stride, ptrdiff_t high_stride, int width, int height) @@ -59,7 +59,7 @@ static void horiz_filter(int16_t *input, int16_t *low, int16_t *high, } } -static void vert_filter(int16_t *input, int16_t *low, int16_t *high, +static void vert_filter(const int16_t *input, int16_t *low, int16_t *high, ptrdiff_t in_stride, ptrdiff_t low_stride, ptrdiff_t high_stride, int width, int height) diff --git a/libavcodec/cfhdencdsp.h b/libavcodec/cfhdencdsp.h index b3aac8d0a7..d234b93797 100644 --- a/libavcodec/cfhdencdsp.h +++ b/libavcodec/cfhdencdsp.h @@ -23,12 +23,12 @@ #include typedef struct CFHDEncDSPContext { -void (*horiz_filter)(int16_t *input, int16_t *low, int16_t *high, +void (*horiz_filter)(const int16_t *input, int16_t *low, int16_t *high, ptrdiff_t in_stride, ptrdiff_t low_stride, ptrdiff_t high_stride, int width, int height); -void (*vert_filter)(int16_t *input, int16_t *low, int16_t *high, +void (*vert_filter)(const int16_t *input, int16_t *low, int16_t *high, ptrdiff_t in_stride, ptrdiff_t low_stride, ptrdiff_t high_stride, int width, int height); diff --git a/libavcodec/x86/cfhdencdsp_init.c b/libavcodec/x86/cfhdencdsp_init.c index 1e3586e08c..5cea39a80a 100644 --- a/libavcodec/x86/cfhdencdsp_init.c +++ b/libavcodec/x86/cfhdencdsp_init.c @@ -27,11 +27,11 @@ #include "libavutil/x86/cpu.h" #include "libavcodec/cfhdencdsp.h" -void ff_cfhdenc_horiz_filter_sse2(int16_t *input, int16_t *low, int16_t *high, +void ff_cfhdenc_horiz_filter_sse2(const int16_t *input, int16_t *low, int16_t *high, ptrdiff_t in_stride, ptrdiff_t low_stride, ptrdiff_t high_stride, int width, int height); -void ff_cfhdenc_vert_filter_sse2(int16_t *input, int16_t *low, int16_t *high, +void ff_cfhdenc_vert_filter_sse2(const int16_t *input, int16_t *low, int16_t *high, ptrdiff_t in_stride, ptrdiff_t low_stride, ptrdiff_t high_stride, int width, int height); ___ 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/me_cmp: Constify me_cmp_func buffer parameters
ffmpeg | branch: master | Andreas Rheinhardt | Tue Jul 26 07:25:02 2022 +0200| [abb85429f3424375f21bdd135656c2d88357b3d5] | committer: Andreas Rheinhardt avcodec/me_cmp: Constify me_cmp_func buffer parameters Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=abb85429f3424375f21bdd135656c2d88357b3d5 --- libavcodec/aarch64/me_cmp_init_aarch64.c | 6 +-- libavcodec/alpha/me_cmp_alpha.c | 12 ++--- libavcodec/alpha/me_cmp_mvi_asm.S| 2 +- libavcodec/arm/me_cmp_init_arm.c | 10 ++-- libavcodec/me_cmp.c | 80 libavcodec/me_cmp.h | 6 +-- libavcodec/mips/me_cmp_mips.h| 32 ++--- libavcodec/mips/me_cmp_msa.c | 80 libavcodec/motion_est.c | 2 +- libavcodec/ppc/me_cmp.c | 30 ++-- libavcodec/snow_dwt.c| 14 +++--- libavcodec/snow_dwt.h| 4 +- libavcodec/x86/me_cmp.asm| 24 +- libavcodec/x86/me_cmp_init.c | 72 ++-- 14 files changed, 187 insertions(+), 187 deletions(-) diff --git a/libavcodec/aarch64/me_cmp_init_aarch64.c b/libavcodec/aarch64/me_cmp_init_aarch64.c index 136b008eb7..79c739914f 100644 --- a/libavcodec/aarch64/me_cmp_init_aarch64.c +++ b/libavcodec/aarch64/me_cmp_init_aarch64.c @@ -23,11 +23,11 @@ #include "libavutil/aarch64/cpu.h" #include "libavcodec/mpegvideo.h" -int ff_pix_abs16_neon(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, +int ff_pix_abs16_neon(MpegEncContext *s, const uint8_t *blk1, const uint8_t *blk2, ptrdiff_t stride, int h); -int ff_pix_abs16_xy2_neon(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, +int ff_pix_abs16_xy2_neon(MpegEncContext *s, const uint8_t *blk1, const uint8_t *blk2, ptrdiff_t stride, int h); -int ff_pix_abs16_x2_neon(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +int ff_pix_abs16_x2_neon(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h); av_cold void ff_me_cmp_init_aarch64(MECmpContext *c, AVCodecContext *avctx) diff --git a/libavcodec/alpha/me_cmp_alpha.c b/libavcodec/alpha/me_cmp_alpha.c index 8f360190f4..4e9e0f88dc 100644 --- a/libavcodec/alpha/me_cmp_alpha.c +++ b/libavcodec/alpha/me_cmp_alpha.c @@ -23,7 +23,7 @@ #include "libavcodec/me_cmp.h" #include "asm.h" -int pix_abs16x16_mvi_asm(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h); +int pix_abs16x16_mvi_asm(void *v, const uint8_t *pix1, const uint8_t *pix2, int line_size, int h); static inline uint64_t avg2(uint64_t a, uint64_t b) { @@ -44,7 +44,7 @@ static inline uint64_t avg4(uint64_t l1, uint64_t l2, uint64_t l3, uint64_t l4) return r1 + r2; } -static int pix_abs8x8_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) +static int pix_abs8x8_mvi(void *v, const uint8_t *pix1, const uint8_t *pix2, int line_size, int h) { int result = 0; @@ -77,7 +77,7 @@ static int pix_abs8x8_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, } #if 0 /* now done in assembly */ -int pix_abs16x16_mvi(uint8_t *pix1, uint8_t *pix2, int line_size) +int pix_abs16x16_mvi(const uint8_t *pix1, const uint8_t *pix2, int line_size) { int result = 0; int h = 16; @@ -119,7 +119,7 @@ int pix_abs16x16_mvi(uint8_t *pix1, uint8_t *pix2, int line_size) } #endif -static int pix_abs16x16_x2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) +static int pix_abs16x16_x2_mvi(void *v, const uint8_t *pix1, const uint8_t *pix2, int line_size, int h) { int result = 0; uint64_t disalign = (size_t) pix2 & 0x7; @@ -192,7 +192,7 @@ static int pix_abs16x16_x2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_s return result; } -static int pix_abs16x16_y2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) +static int pix_abs16x16_y2_mvi(void *v, const uint8_t *pix1, const uint8_t *pix2, int line_size, int h) { int result = 0; @@ -245,7 +245,7 @@ static int pix_abs16x16_y2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_s return result; } -static int pix_abs16x16_xy2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) +static int pix_abs16x16_xy2_mvi(void *v, const uint8_t *pix1, const uint8_t *pix2, int line_size, int h) { int result = 0; diff --git a/libavcodec/alpha/me_cmp_mvi_asm.S b/libavcodec/alpha/me_cmp_mvi_asm.S index 2399085bcb..183feeb40c 100644 --- a/libavcodec/alpha/me_cmp_mvi_asm.S +++ b/libavcodec/alpha/me_cmp_mvi_asm.S @@ -38,7 +38,7 @@ .text /* - * int pix_abs16x16_mvi_asm(uint8_t *pix1, uint8_t *pix2, int line_size) + * int pix_abs16x16_mvi_asm(const uint8_t *pix1, const uint8
[FFmpeg-cvslog] avcodec/mpegvideoencdsp: Allow pointers to const where possible
ffmpeg | branch: master | Andreas Rheinhardt | Tue Jul 26 08:00:28 2022 +0200| [966fc1230a68d4107994038b71c3200b069ed22e] | committer: Andreas Rheinhardt avcodec/mpegvideoencdsp: Allow pointers to const where possible Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=966fc1230a68d4107994038b71c3200b069ed22e --- libavcodec/arm/mpegvideoencdsp_init_arm.c | 4 ++-- libavcodec/mips/h263dsp_mips.h | 2 +- libavcodec/mips/mpegvideoencdsp_msa.c | 4 ++-- libavcodec/mpegvideoencdsp.c | 10 +- libavcodec/mpegvideoencdsp.h | 10 +- libavcodec/ppc/mpegvideoencdsp.c | 8 libavcodec/x86/mpegvideoenc_qns_template.c | 4 ++-- libavcodec/x86/mpegvideoencdsp.asm | 4 ++-- libavcodec/x86/mpegvideoencdsp_init.c | 6 +++--- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/libavcodec/arm/mpegvideoencdsp_init_arm.c b/libavcodec/arm/mpegvideoencdsp_init_arm.c index 31d1474416..a95b5bebe9 100644 --- a/libavcodec/arm/mpegvideoencdsp_init_arm.c +++ b/libavcodec/arm/mpegvideoencdsp_init_arm.c @@ -24,8 +24,8 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpegvideoencdsp.h" -int ff_pix_norm1_armv6(uint8_t *pix, int line_size); -int ff_pix_sum_armv6(uint8_t *pix, int line_size); +int ff_pix_norm1_armv6(const uint8_t *pix, int line_size); +int ff_pix_sum_armv6(const uint8_t *pix, int line_size); av_cold void ff_mpegvideoencdsp_init_arm(MpegvideoEncDSPContext *c, AVCodecContext *avctx) diff --git a/libavcodec/mips/h263dsp_mips.h b/libavcodec/mips/h263dsp_mips.h index 99a43cd44a..f225ee563e 100644 --- a/libavcodec/mips/h263dsp_mips.h +++ b/libavcodec/mips/h263dsp_mips.h @@ -31,6 +31,6 @@ void ff_dct_unquantize_h263_inter_msa(MpegEncContext *s, int16_t *block, int32_t index, int32_t q_scale); void ff_dct_unquantize_h263_intra_msa(MpegEncContext *s, int16_t *block, int32_t index, int32_t q_scale); -int ff_pix_sum_msa(uint8_t *pix, int line_size); +int ff_pix_sum_msa(const uint8_t *pix, int line_size); #endif // #ifndef AVCODEC_MIPS_H263DSP_MIPS_H diff --git a/libavcodec/mips/mpegvideoencdsp_msa.c b/libavcodec/mips/mpegvideoencdsp_msa.c index 46473dafe5..9043730cd7 100644 --- a/libavcodec/mips/mpegvideoencdsp_msa.c +++ b/libavcodec/mips/mpegvideoencdsp_msa.c @@ -21,7 +21,7 @@ #include "h263dsp_mips.h" #include "libavutil/mips/generic_macros_msa.h" -static int32_t sum_u8src_16width_msa(uint8_t *src, int32_t stride) +static int32_t sum_u8src_16width_msa(const uint8_t *src, int32_t stride) { uint32_t sum = 0; v16u8 in0, in1, in2, in3, in4, in5, in6, in7; @@ -56,7 +56,7 @@ static int32_t sum_u8src_16width_msa(uint8_t *src, int32_t stride) return sum; } -int ff_pix_sum_msa(uint8_t *pix, int line_size) +int ff_pix_sum_msa(const uint8_t *pix, int line_size) { return sum_u8src_16width_msa(pix, line_size); } diff --git a/libavcodec/mpegvideoencdsp.c b/libavcodec/mpegvideoencdsp.c index adf19e69f4..997d048663 100644 --- a/libavcodec/mpegvideoencdsp.c +++ b/libavcodec/mpegvideoencdsp.c @@ -28,8 +28,8 @@ #include "me_cmp.h" #include "mpegvideoencdsp.h" -static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], - int16_t basis[64], int scale) +static int try_8x8basis_c(const int16_t rem[64], const int16_t weight[64], + const int16_t basis[64], int scale) { int i; unsigned int sum = 0; @@ -47,7 +47,7 @@ static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], return sum >> 2; } -static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale) +static void add_8x8basis_c(int16_t rem[64], const int16_t basis[64], int scale) { int i; @@ -57,7 +57,7 @@ static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale) (BASIS_SHIFT - RECON_SHIFT); } -static int pix_sum_c(uint8_t *pix, int line_size) +static int pix_sum_c(const uint8_t *pix, int line_size) { int s = 0, i, j; @@ -78,7 +78,7 @@ static int pix_sum_c(uint8_t *pix, int line_size) return s; } -static int pix_norm1_c(uint8_t *pix, int line_size) +static int pix_norm1_c(const uint8_t *pix, int line_size) { int s = 0, i, j; const uint32_t *sq = ff_square_tab + 256; diff --git a/libavcodec/mpegvideoencdsp.h b/libavcodec/mpegvideoencdsp.h index 33f0282fcc..95084679d9 100644 --- a/libavcodec/mpegvideoencdsp.h +++ b/libavcodec/mpegvideoencdsp.h @@ -30,12 +30,12 @@ #define EDGE_BOTTOM 2 typedef struct MpegvideoEncDSPContext { -int (*try_8x8basis)(int16_t rem[64], int16_t weight[64], -int16_t basis[64], int scale); -void (*add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale); +int (*try_8x8basis)(const int16_t rem[64], const int16_t weight[64], +
[FFmpeg-cvslog] avcodec/mpegvideodsp: Constify src pointers
ffmpeg | branch: master | Andreas Rheinhardt | Tue Jul 26 08:20:14 2022 +0200| [209a11053f3249e1f5f36a6a74089df92181d25a] | committer: Andreas Rheinhardt avcodec/mpegvideodsp: Constify src pointers Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=209a11053f3249e1f5f36a6a74089df92181d25a --- libavcodec/mpegvideodsp.c | 4 ++-- libavcodec/mpegvideodsp.h | 6 +++--- libavcodec/ppc/mpegvideodsp.c | 2 +- libavcodec/x86/mpegvideodsp.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/mpegvideodsp.c b/libavcodec/mpegvideodsp.c index a8cf7fbe35..05893d0e01 100644 --- a/libavcodec/mpegvideodsp.c +++ b/libavcodec/mpegvideodsp.c @@ -21,7 +21,7 @@ #include "libavutil/common.h" #include "mpegvideodsp.h" -static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, +static void gmc1_c(uint8_t *dst, const uint8_t *src, int stride, int h, int x16, int y16, int rounder) { const int A = (16 - x16) * (16 - y16); @@ -44,7 +44,7 @@ static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, } } -void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, +void ff_gmc_c(uint8_t *dst, const uint8_t *src, int stride, int h, int ox, int oy, int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) { diff --git a/libavcodec/mpegvideodsp.h b/libavcodec/mpegvideodsp.h index 293e2548d3..69e6053c68 100644 --- a/libavcodec/mpegvideodsp.h +++ b/libavcodec/mpegvideodsp.h @@ -21,7 +21,7 @@ #include -void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, +void ff_gmc_c(uint8_t *dst, const uint8_t *src, int stride, int h, int ox, int oy, int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height); @@ -29,12 +29,12 @@ typedef struct MpegVideoDSPContext { /** * translational global motion compensation. */ -void (*gmc1)(uint8_t *dst /* align 8 */, uint8_t *src /* align 1 */, +void (*gmc1)(uint8_t *dst /* align 8 */, const uint8_t *src /* align 1 */, int srcStride, int h, int x16, int y16, int rounder); /** * global motion compensation. */ -void (*gmc)(uint8_t *dst /* align 8 */, uint8_t *src /* align 1 */, +void (*gmc)(uint8_t *dst /* align 8 */, const uint8_t *src /* align 1 */, int stride, int h, int ox, int oy, int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height); diff --git a/libavcodec/ppc/mpegvideodsp.c b/libavcodec/ppc/mpegvideodsp.c index 42d65dbe3d..3e99e089ea 100644 --- a/libavcodec/ppc/mpegvideodsp.c +++ b/libavcodec/ppc/mpegvideodsp.c @@ -31,7 +31,7 @@ #if HAVE_ALTIVEC /* AltiVec-enhanced gmc1. ATM this code assumes stride is a multiple of 8 * to preserve proper dst alignment. */ -static void gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, +static void gmc1_altivec(uint8_t *dst /* align 8 */, const uint8_t *src /* align1 */, int stride, int h, int x16, int y16, int rounder) { int i; diff --git a/libavcodec/x86/mpegvideodsp.c b/libavcodec/x86/mpegvideodsp.c index 6009b64e07..ea1d941fba 100644 --- a/libavcodec/x86/mpegvideodsp.c +++ b/libavcodec/x86/mpegvideodsp.c @@ -25,7 +25,7 @@ #if HAVE_INLINE_ASM -static void gmc_mmx(uint8_t *dst, uint8_t *src, +static void gmc_mmx(uint8_t *dst, const uint8_t *src, int stride, int h, int ox, int oy, int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) ___ 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/motion_est: Constify pointers to frame data
ffmpeg | branch: master | Andreas Rheinhardt | Tue Jul 26 08:36:11 2022 +0200| [34276b815b7eddffdd0713569e4b8009c923b029] | committer: Andreas Rheinhardt avcodec/motion_est: Constify pointers to frame data Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=34276b815b7eddffdd0713569e4b8009c923b029 --- libavcodec/motion_est.c | 31 +-- libavcodec/motion_est.h | 4 ++-- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 0903536697..29ab41dc8c 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -79,7 +79,10 @@ static int minima_cmp(const void *a, const void *b){ #define FLAG_CHROMA 2 #define FLAG_DIRECT 4 -static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3], uint8_t *ref2[3], int x, int y, int ref_index){ +static inline void init_ref(MotionEstContext *c, uint8_t *const src[3], +uint8_t *const ref[3], uint8_t *const ref2[3], +int x, int y, int ref_index) +{ const int offset[3]= { y*c-> stride + x, ((y*c->uvstride + x)>>1), @@ -110,8 +113,8 @@ static av_always_inline int cmp_direct_inline(MpegEncContext *s, const int x, co const int stride= c->stride; const int hx = subx + x * (1 << (1 + qpel)); const int hy = suby + y * (1 << (1 + qpel)); -uint8_t * const * const ref= c->ref[ref_index]; -uint8_t * const * const src= c->src[src_index]; +const uint8_t * const * const ref = c->ref[ref_index]; +const uint8_t * const * const src = c->src[src_index]; int d; //FIXME check chroma 4mv, (no crashes ...) av_assert2(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)); @@ -184,8 +187,8 @@ static av_always_inline int cmp_inline(MpegEncContext *s, const int x, const int const int dxy= subx + (suby<<(1+qpel)); //FIXME log2_subpel? const int hx= subx + x*(1<<(1+qpel)); const int hy= suby + y*(1<<(1+qpel)); -uint8_t * const * const ref= c->ref[ref_index]; -uint8_t * const * const src= c->src[src_index]; +const uint8_t * const * const ref = c->ref[ref_index]; +const uint8_t * const * const src = c->src[src_index]; int d; //FIXME check chroma 4mv, (no crashes ...) int uvdxy; /* no, it might not be used uninitialized */ @@ -396,7 +399,7 @@ static int sad_hpel_motion_search(MpegEncContext * s, MotionEstContext * const c= &s->me; const int penalty_factor= c->sub_penalty_factor; int mx, my, dminh; -uint8_t *pix, *ptr; +const uint8_t *pix, *ptr; int stride= c->stride; LOAD_COMMON @@ -641,7 +644,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) const int offset= ((block&1) + (block>>1)*stride)*8; uint8_t *dest_y = c->scratchpad + offset; if(s->quarter_sample){ -uint8_t *ref= c->ref[block][0] + (mx4>>2) + (my4>>2)*stride; +const uint8_t *ref = c->ref[block][0] + (mx4>>2) + (my4>>2)*stride; dxy = ((my4 & 3) << 2) | (mx4 & 3); if(s->no_rounding) @@ -649,7 +652,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) else s->qdsp.put_qpel_pixels_tab[1][dxy](dest_y, ref, stride); }else{ -uint8_t *ref= c->ref[block][0] + (mx4>>1) + (my4>>1)*stride; +const uint8_t *ref = c->ref[block][0] + (mx4>>1) + (my4>>1)*stride; dxy = ((my4 & 1) << 1) | (mx4 & 1); if(s->no_rounding) @@ -805,7 +808,7 @@ static int interlaced_search(MpegEncContext *s, int ref_index, int dxy; //FIXME chroma ME -uint8_t *ref= c->ref[field_select+ref_index][0] + (mx_i>>1) + (my_i>>1)*stride; +const uint8_t *ref = c->ref[field_select+ref_index][0] + (mx_i>>1) + (my_i>>1)*stride; dxy = ((my_i & 1) << 1) | (mx_i & 1); if(s->no_rounding){ @@ -885,7 +888,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y) { MotionEstContext * const c= &s->me; -uint8_t *pix, *ppix; +const uint8_t *pix, *ppix; int sum, mx = 0, my = 0, dmin = 0; int varc;///< the variance of the block (sum of squared (p[y][x]-average)) int vard;///< sum of squared differences with the estimated motion vector @@ -1187,13 +1190,13 @@ static inline int check_bidir_mv(MpegEncContext * s, const uint8_t * const mv_penalty_b = c->mv_penalty[s->b_code] + MAX_DMV; // f_code of the prev frame int stride= c->stride; uint8_t *dest_y = c->scratchpad; -uint8_t *ptr; +const uint8_t *ptr; int dxy; int sr
[FFmpeg-cvslog] avcodec/vp9dec: Constify VP9TileData->VP9Context pointer target
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 23 03:34:17 2022 +0200| [4368e86a02b8dde9824b44923dc01834046ad360] | committer: Andreas Rheinhardt avcodec/vp9dec: Constify VP9TileData->VP9Context pointer target This is possible now that ff_thread_await_progress() accepts a const ThreadFrame*. Reviewed-by: Ronald S. Bultje Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4368e86a02b8dde9824b44923dc01834046ad360 --- libavcodec/vp9_mc_template.c | 2 +- libavcodec/vp9block.c| 30 +++--- libavcodec/vp9dec.h | 4 +--- libavcodec/vp9mvs.c | 6 +++--- libavcodec/vp9recon.c| 22 +++--- 5 files changed, 31 insertions(+), 33 deletions(-) diff --git a/libavcodec/vp9_mc_template.c b/libavcodec/vp9_mc_template.c index 0340c9f48a..e654c0e5ed 100644 --- a/libavcodec/vp9_mc_template.c +++ b/libavcodec/vp9_mc_template.c @@ -33,7 +33,7 @@ static void FN(inter_pred)(VP9TileData *td) { 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 }, { 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 }, }; -VP9Context *s = td->s; +const VP9Context *s = td->s; VP9Block *b = td->b; int row = td->row, col = td->col; const ThreadFrame *tref1 = &s->s.refs[s->s.h.refidx[b->ref[0]]], *tref2; diff --git a/libavcodec/vp9block.c b/libavcodec/vp9block.c index c6103ee6f0..5743f048cc 100644 --- a/libavcodec/vp9block.c +++ b/libavcodec/vp9block.c @@ -88,7 +88,7 @@ static void decode_mode(VP9TileData *td) TX_32X32, TX_32X32, TX_32X32, TX_32X32, TX_16X16, TX_16X16, TX_16X16, TX_8X8, TX_8X8, TX_8X8, TX_4X4, TX_4X4, TX_4X4 }; -VP9Context *s = td->s; +const VP9Context *s = td->s; VP9Block *b = td->b; int row = td->row, col = td->col, row7 = td->row7; enum TxfmMode max_tx = max_tx_for_bl_bp[b->bs]; @@ -804,9 +804,9 @@ static void decode_mode(VP9TileData *td) static av_always_inline int decode_coeffs_b_generic(VPXRangeCoder *c, int16_t *coef, int n_coeffs, int is_tx32x32, int is8bitsperpixel, int bpp, unsigned (*cnt)[6][3], -unsigned (*eob)[6][2], uint8_t (*p)[6][11], +unsigned (*eob)[6][2], const uint8_t (*p)[6][11], int nnz, const int16_t *scan, const int16_t (*nb)[2], -const int16_t *band_counts, int16_t *qmul) +const int16_t *band_counts, const int16_t *qmul) { int i = 0, band = 0, band_left = band_counts[band]; const uint8_t *tp = p[0][nnz]; @@ -923,9 +923,9 @@ skip_eob: static int decode_coeffs_b_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs, unsigned (*cnt)[6][3], unsigned (*eob)[6][2], -uint8_t (*p)[6][11], int nnz, const int16_t *scan, +const uint8_t (*p)[6][11], int nnz, const int16_t *scan, const int16_t (*nb)[2], const int16_t *band_counts, -int16_t *qmul) +const int16_t *qmul) { return decode_coeffs_b_generic(td->c, coef, n_coeffs, 0, 1, 8, cnt, eob, p, nnz, scan, nb, band_counts, qmul); @@ -933,9 +933,9 @@ static int decode_coeffs_b_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs, static int decode_coeffs_b32_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs, unsigned (*cnt)[6][3], unsigned (*eob)[6][2], - uint8_t (*p)[6][11], int nnz, const int16_t *scan, + const uint8_t (*p)[6][11], int nnz, const int16_t *scan, const int16_t (*nb)[2], const int16_t *band_counts, - int16_t *qmul) + const int16_t *qmul) { return decode_coeffs_b_generic(td->c, coef, n_coeffs, 1, 1, 8, cnt, eob, p, nnz, scan, nb, band_counts, qmul); @@ -943,9 +943,9 @@ static int decode_coeffs_b32_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs, static int decode_coeffs_b_16bpp(VP9TileData *td, int16_t *coef, int n_coeffs, unsigned (*cnt)[6][3], unsigned (*eob)[6][2], - uint8_t (*p)[6][11], int nnz, const int16_t *scan, + const uint8_t (*p)[6][11], int nnz, const int16_t *scan, const int16_t (*nb)[2], const int16_t *band_counts, - int16_t *qmul) + const int16_t *qmul) { return decode_coeffs_b_generic(td->c, coef, n_coeffs, 0, 0, td->s->s.h.bpp, cnt, eob, p, nnz, scan, nb, band_counts, qmul); @@ -953,9 +953,9 @@ static int decode_coeffs_b_16bpp(VP9TileData *td, int16_t *coef,
[FFmpeg-cvslog] avcodec/wavpack: Constify slice threads' ptr to main context
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 23 04:28:03 2022 +0200| [94dd8f421eedf58c3399f25dee169790b28c614b] | committer: Andreas Rheinhardt avcodec/wavpack: Constify slice threads' ptr to main context Modifying the main context from a slice thread is (usually) a data race, so it must not happen. So only use a pointer to const to access the main context. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=94dd8f421eedf58c3399f25dee169790b28c614b --- libavcodec/wavpack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 0e8d1286c2..c12e1d6ec6 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -1616,7 +1616,7 @@ static void wavpack_decode_flush(AVCodecContext *avctx) static int dsd_channel(AVCodecContext *avctx, void *frmptr, int jobnr, int threadnr) { -WavpackContext *s = avctx->priv_data; +const WavpackContext *s = avctx->priv_data; AVFrame *frame = frmptr; ff_dsd2pcm_translate (&s->dsdctx [jobnr], s->samples, 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] avcodec: Constify ThreadFrames if possible
ffmpeg | branch: master | Andreas Rheinhardt | Fri Jul 22 07:11:47 2022 +0200| [0eb399ac3953da16f880a1e455bb009a45f76d49] | committer: Andreas Rheinhardt avcodec: Constify ThreadFrames if possible This is possible now that ff_thread_await_progress() accepts a const ThreadFrame*. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0eb399ac3953da16f880a1e455bb009a45f76d49 --- libavcodec/h264_slice.c | 2 +- libavcodec/hevc_mvs.c| 2 +- libavcodec/hevcdec.c | 4 ++-- libavcodec/rv34.c| 2 +- libavcodec/vp3.c | 2 +- libavcodec/vp8.c | 9 + libavcodec/vp9_mc_template.c | 4 ++-- libavcodec/vp9recon.c| 8 8 files changed, 17 insertions(+), 16 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index d56722a5c2..8f9d0a6231 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1649,7 +1649,7 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, while (h->poc.frame_num != h->poc.prev_frame_num && !h->first_field && h->poc.frame_num != (h->poc.prev_frame_num + 1) % (1 << sps->log2_max_frame_num)) { -H264Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL; +const H264Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL; av_log(h->avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->poc.frame_num, h->poc.prev_frame_num); if (!sps->gaps_in_frame_num_allowed_flag) diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c index bcf6ec3abc..c231797a57 100644 --- a/libavcodec/hevc_mvs.c +++ b/libavcodec/hevc_mvs.c @@ -227,7 +227,7 @@ static int temporal_luma_motion_vector(const HEVCContext *s, int x0, int y0, int availableFlagLXCol = 0; int colPic; -HEVCFrame *ref = s->ref->collocated_ref; +const HEVCFrame *ref = s->ref->collocated_ref; if (!ref) { memset(mvLXCol, 0, sizeof(*mvLXCol)); diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index dbc77ade2a..9b14fa50f9 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -1799,7 +1799,7 @@ static void chroma_mc_bi(HEVCLocalContext *lc, uint8_t *dst0, ptrdiff_t dststrid _mx1, _my1, block_w); } -static void hevc_await_progress(const HEVCContext *s, HEVCFrame *ref, +static void hevc_await_progress(const HEVCContext *s, const HEVCFrame *ref, const Mv *mv, int y0, int height) { if (s->threads_type == FF_THREAD_FRAME ) { @@ -1869,7 +1869,7 @@ static void hls_prediction_unit(HEVCLocalContext *lc, int x0, int y0, MvField *tab_mvf = s->ref->tab_mvf; const RefPicList *refPicList = s->ref->refPicList; -HEVCFrame *ref0 = NULL, *ref1 = NULL; +const HEVCFrame *ref0 = NULL, *ref1 = NULL; uint8_t *dst0 = POS(0, x0, y0); uint8_t *dst1 = POS(1, x0, y0); uint8_t *dst2 = POS(2, x0, y0); diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index b789db05fd..61d1e4c527 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -703,7 +703,7 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) { /* wait for the referenced mb row to be finished */ int mb_row = s->mb_y + ((yoff + my + 5 + 8 * height) >> 4); -ThreadFrame *f = dir ? &s->next_picture_ptr->tf : &s->last_picture_ptr->tf; +const ThreadFrame *f = dir ? &s->next_picture_ptr->tf : &s->last_picture_ptr->tf; ff_thread_await_progress(f, mb_row, 0); } diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 53fc514788..3f6b0100d9 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -1950,7 +1950,7 @@ static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y) static void await_reference_row(Vp3DecodeContext *s, Vp3Fragment *fragment, int motion_y, int y) { -ThreadFrame *ref_frame; +const ThreadFrame *ref_frame; int ref_row; int border = motion_y & 1; diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 06752e8c37..2687aeb1f8 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1283,7 +1283,7 @@ void decode_intra4x4_modes(VP8Context *s, VPXRangeCoder *c, VP8Macroblock *mb, static av_always_inline void decode_mb_mode(VP8Context *s, VP8mvbounds *mv_bounds, VP8Macroblock *mb, int mb_x, int mb_y, -uint8_t *segment, uint8_t *ref, int layout, int is_vp7) +uint8_t *segment, const uint8_t *ref, int layout, int is_vp7) { VPXRangeCoder *c = &s->c; static const char * const vp7_feature_name[] = { "q-index", @@ -1848,7 +1848,7 @@ static const uint8_t subpel_idx[3][8] = { */ static av_always_inline void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst, - ThreadFrame *ref, const VP8mv *mv, +
[FFmpeg-cvslog] avcodec/vp8: Constify slice threads' ptr to main context
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 23 04:35:33 2022 +0200| [9c4f7d1e880a000a070f445386c870427e57971c] | committer: Andreas Rheinhardt avcodec/vp8: Constify slice threads' ptr to main context Modifying the main context from a slice thread is (usually) a data race, so it must not happen. So only use a pointer to const to access the main context. Reviewed-by: Ronald S. Bultje Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9c4f7d1e880a000a070f445386c870427e57971c --- libavcodec/vp8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 2687aeb1f8..7a151feb79 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -2619,7 +2619,7 @@ static av_always_inline int vp78_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr, int is_vp7) { -VP8Context *s = avctx->priv_data; +const VP8Context *s = avctx->priv_data; VP8ThreadData *td = &s->thread_data[jobnr]; VP8ThreadData *next_td = NULL, *prev_td = NULL; VP8Frame *curframe = s->curframe; ___ 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/proresdec2: Constify slice threads' ptr to main context
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 23 06:11:35 2022 +0200| [0eae123dbd610b4ad371c6ebfc41a9d5b56abec8] | committer: Andreas Rheinhardt avcodec/proresdec2: Constify slice threads' ptr to main context Modifying the main context from a slice thread is (usually) a data race, so it must not happen. So only use a pointer to const to access the main context. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0eae123dbd610b4ad371c6ebfc41a9d5b56abec8 --- libavcodec/proresdec2.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index 01e650a650..659f9ff16b 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -500,7 +500,7 @@ static const uint8_t lev_to_cb[10] = { 0x04, 0x0A, 0x05, 0x06, 0x04, 0x28, 0x28, static av_always_inline int decode_ac_coeffs(AVCodecContext *avctx, GetBitContext *gb, int16_t *out, int blocks_per_slice) { -ProresContext *ctx = avctx->priv_data; +const ProresContext *ctx = avctx->priv_data; int block_mask, sign; unsigned pos, run, level; int max_coeffs, i, bits_left; @@ -545,7 +545,7 @@ static int decode_slice_luma(AVCodecContext *avctx, SliceContext *slice, const uint8_t *buf, unsigned buf_size, const int16_t *qmat) { -ProresContext *ctx = avctx->priv_data; +const ProresContext *ctx = avctx->priv_data; LOCAL_ALIGNED_32(int16_t, blocks, [8*4*64]); int16_t *block; GetBitContext gb; @@ -611,7 +611,7 @@ static int decode_slice_chroma(AVCodecContext *avctx, SliceContext *slice, /** * Decode alpha slice plane. */ -static void decode_slice_alpha(ProresContext *ctx, +static void decode_slice_alpha(const ProresContext *ctx, uint16_t *dst, int dst_stride, const uint8_t *buf, int buf_size, int blocks_per_slice) @@ -643,7 +643,7 @@ static void decode_slice_alpha(ProresContext *ctx, static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr) { -ProresContext *ctx = avctx->priv_data; +const ProresContext *ctx = avctx->priv_data; SliceContext *slice = &ctx->slices[jobnr]; const uint8_t *buf = slice->data; AVFrame *pic = ctx->frame; ___ 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/magicyuv: Constify slice threads' ptr to main context
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 23 06:11:59 2022 +0200| [0980d3801d12939bd0eaa6b23b7a21d9012d8c5e] | committer: Andreas Rheinhardt avcodec/magicyuv: Constify slice threads' ptr to main context Modifying the main context from a slice thread is (usually) a data race, so it must not happen. So only use a pointer to const to access the main context. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0980d3801d12939bd0eaa6b23b7a21d9012d8c5e --- libavcodec/magicyuv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c index ae1660eaa3..65dbb6a2f1 100644 --- a/libavcodec/magicyuv.c +++ b/libavcodec/magicyuv.c @@ -115,7 +115,7 @@ static void magicyuv_median_pred16(uint16_t *dst, const uint16_t *src1, static int magy_decode_slice10(AVCodecContext *avctx, void *tdata, int j, int threadnr) { -MagicYUVContext *s = avctx->priv_data; +const MagicYUVContext *s = avctx->priv_data; int interlaced = s->interlaced; const int bps = s->bps; const int max = s->max - 1; @@ -247,7 +247,7 @@ static int magy_decode_slice10(AVCodecContext *avctx, void *tdata, static int magy_decode_slice(AVCodecContext *avctx, void *tdata, int j, int threadnr) { -MagicYUVContext *s = avctx->priv_data; +const MagicYUVContext *s = avctx->priv_data; int interlaced = s->interlaced; AVFrame *p = s->p; int i, k, x, min_width; ___ 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/jpeg2000dec: Constify slice threads' ptr to main context
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 23 06:14:10 2022 +0200| [a18c372390346d089580a18183115c8f8ef2d1ec] | committer: Andreas Rheinhardt avcodec/jpeg2000dec: Constify slice threads' ptr to main context Modifying the main context from a slice thread is (usually) a data race, so it must not happen. So only use a pointer to const to access the main context. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a18c372390346d089580a18183115c8f8ef2d1ec --- libavcodec/jpeg2000dec.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 4823127758..503753c4d6 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -1679,7 +1679,7 @@ static void decode_refpass(Jpeg2000T1Context *t1, int width, int height, } } -static void decode_clnpass(Jpeg2000DecoderContext *s, Jpeg2000T1Context *t1, +static void decode_clnpass(const Jpeg2000DecoderContext *s, Jpeg2000T1Context *t1, int width, int height, int bpno, int bandno, int seg_symbols, int vert_causal_ctx_csty_symbol) { @@ -1745,7 +1745,7 @@ static void decode_clnpass(Jpeg2000DecoderContext *s, Jpeg2000T1Context *t1, } } -static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty, +static int decode_cblk(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty, Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk, int width, int height, int bandpos, uint8_t roi_shift) { @@ -1896,7 +1896,7 @@ static void dequantization_int_97(int x, int y, Jpeg2000Cblk *cblk, } } -static inline void mct_decode(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile) +static inline void mct_decode(const Jpeg2000DecoderContext *s, Jpeg2000Tile *tile) { int i, csize = 1; void *src[3]; @@ -1937,7 +1937,7 @@ static inline void roi_scale_cblk(Jpeg2000Cblk *cblk, } } -static inline void tile_codeblocks(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile) +static inline void tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile *tile) { Jpeg2000T1Context t1; @@ -2009,7 +2009,7 @@ static inline void tile_codeblocks(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile } #define WRITE_FRAME(D, PIXEL) \ -static inline void write_frame_ ## D(Jpeg2000DecoderContext * s, Jpeg2000Tile * tile, \ +static inline void write_frame_ ## D(const Jpeg2000DecoderContext * s, Jpeg2000Tile * tile, \ AVFrame * picture, int precision) \ { \ const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(s->avctx->pix_fmt); \ @@ -2078,7 +2078,7 @@ WRITE_FRAME(16, uint16_t) static int jpeg2000_decode_tile(AVCodecContext *avctx, void *td, int jobnr, int threadnr) { -Jpeg2000DecoderContext *s = avctx->priv_data; +const Jpeg2000DecoderContext *s = avctx->priv_data; AVFrame *picture = td; Jpeg2000Tile *tile = s->tile + jobnr; ___ 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/exr: Constify slice threads' ptr to main context
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 23 06:17:55 2022 +0200| [e725c5e24eaa94cd5a99e039d6c569a24e335d5a] | committer: Andreas Rheinhardt avcodec/exr: Constify slice threads' ptr to main context Modifying the main context from a slice thread is (usually) a data race, so it must not happen. So only use a pointer to const to access the main context. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e725c5e24eaa94cd5a99e039d6c569a24e335d5a --- libavcodec/exr.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index e4b66a08ac..3a6b9c3014 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -196,7 +196,7 @@ typedef struct EXRContext { uint16_t offsettable[64]; } EXRContext; -static int zip_uncompress(EXRContext *s, const uint8_t *src, int compressed_size, +static int zip_uncompress(const EXRContext *s, const uint8_t *src, int compressed_size, int uncompressed_size, EXRThreadData *td) { unsigned long dest_len = uncompressed_size; @@ -255,7 +255,7 @@ static int rle(uint8_t *dst, const uint8_t *src, return 0; } -static int rle_uncompress(EXRContext *ctx, const uint8_t *src, int compressed_size, +static int rle_uncompress(const EXRContext *ctx, const uint8_t *src, int compressed_size, int uncompressed_size, EXRThreadData *td) { rle(td->tmp, src, compressed_size, uncompressed_size); @@ -365,7 +365,7 @@ static int huf_unpack_enc_table(GetByteContext *gb, return 0; } -static int huf_build_dec_table(EXRContext *s, +static int huf_build_dec_table(const EXRContext *s, EXRThreadData *td, int im, int iM) { int j = 0; @@ -440,7 +440,7 @@ static int huf_decode(VLC *vlc, GetByteContext *gb, int nbits, int run_sym, return 0; } -static int huf_uncompress(EXRContext *s, +static int huf_uncompress(const EXRContext *s, EXRThreadData *td, GetByteContext *gb, uint16_t *dst, int dst_size) @@ -588,7 +588,7 @@ static void wav_decode(uint16_t *in, int nx, int ox, } } -static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize, +static int piz_uncompress(const EXRContext *s, const uint8_t *src, int ssize, int dsize, EXRThreadData *td) { GetByteContext gb; @@ -674,7 +674,7 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize, return 0; } -static int pxr24_uncompress(EXRContext *s, const uint8_t *src, +static int pxr24_uncompress(const EXRContext *s, const uint8_t *src, int compressed_size, int uncompressed_size, EXRThreadData *td) { @@ -809,7 +809,7 @@ static void unpack_3(const uint8_t b[3], uint16_t s[16]) } -static int b44_uncompress(EXRContext *s, const uint8_t *src, int compressed_size, +static int b44_uncompress(const EXRContext *s, const uint8_t *src, int compressed_size, int uncompressed_size, EXRThreadData *td) { const int8_t *sr = src; int stay_to_uncompress = compressed_size; @@ -833,7 +833,7 @@ static int b44_uncompress(EXRContext *s, const uint8_t *src, int compressed_size for (iY = 0; iY < nb_b44_block_h; iY++) { for (iX = 0; iX < nb_b44_block_w; iX++) {/* For each B44 block */ if (stay_to_uncompress < 3) { -av_log(s, AV_LOG_ERROR, "Not enough data for B44A block: %d", stay_to_uncompress); +av_log(s->avctx, AV_LOG_ERROR, "Not enough data for B44A block: %d", stay_to_uncompress); return AVERROR_INVALIDDATA; } @@ -843,7 +843,7 @@ static int b44_uncompress(EXRContext *s, const uint8_t *src, int compressed_size stay_to_uncompress -= 3; } else {/* B44 Block */ if (stay_to_uncompress < 14) { -av_log(s, AV_LOG_ERROR, "Not enough data for B44 block: %d", stay_to_uncompress); +av_log(s->avctx, AV_LOG_ERROR, "Not enough data for B44 block: %d", stay_to_uncompress); return AVERROR_INVALIDDATA; } unpack_14(sr, tmp_buffer); @@ -868,7 +868,7 @@ static int b44_uncompress(EXRContext *s, const uint8_t *src, int compressed_size target_channel_offset += 2; } else {/* Float or UINT 32 channel */ if (stay_to_uncompress < td->ysize * td->xsize * 4) { -av_log(s, AV_LOG_ERROR, "Not enough data for uncompress channel: %d", stay_to_uncompress); +av_log(s->avctx, AV_LOG_ERROR, "Not enough data for uncompress channel: %d", stay_to_uncompress); return AVERROR_
[FFmpeg-cvslog] avcodec/diracdec: Constify slice threads' ptr to main context
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 23 06:16:33 2022 +0200| [9ea03f5678c21e07da9f484846beb2637d41cd7d] | committer: Andreas Rheinhardt avcodec/diracdec: Constify slice threads' ptr to main context Modifying the main context from a slice thread is (usually) a data race, so it must not happen. So only use a pointer to const to access the main context. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ea03f5678c21e07da9f484846beb2637d41cd7d --- libavcodec/diracdec.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index d8fdc27b2c..aef6ab20a3 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -486,7 +486,7 @@ UNPACK_ARITH(10, int32_t) * Decode the coeffs in the rectangle defined by left, right, top, bottom * [DIRAC_STD] 13.4.3.2 Codeblock unpacking loop. codeblock() */ -static inline int codeblock(DiracContext *s, SubBand *b, +static inline int codeblock(const DiracContext *s, SubBand *b, GetBitContext *gb, DiracArith *c, int left, int right, int top, int bottom, int blockcnt_one, int is_arith) @@ -596,7 +596,8 @@ INTRA_DC_PRED(10, uint32_t) * Dirac Specification -> * 13.4.2 Non-skipped subbands. subband_coeffs() */ -static av_always_inline int decode_subband_internal(DiracContext *s, SubBand *b, int is_arith) +static av_always_inline int decode_subband_internal(const DiracContext *s, +SubBand *b, int is_arith) { int cb_x, cb_y, left, right, top, bottom; DiracArith c; @@ -640,13 +641,13 @@ static av_always_inline int decode_subband_internal(DiracContext *s, SubBand *b, static int decode_subband_arith(AVCodecContext *avctx, void *b) { -DiracContext *s = avctx->priv_data; +const DiracContext *s = avctx->priv_data; return decode_subband_internal(s, b, 1); } static int decode_subband_golomb(AVCodecContext *avctx, void *arg) { -DiracContext *s = avctx->priv_data; +const DiracContext *s = avctx->priv_data; SubBand **b = arg; return decode_subband_internal(s, *b, 0); } @@ -721,9 +722,9 @@ static int decode_component(DiracContext *s, int comp) return; \ } \ -static void decode_subband(DiracContext *s, GetBitContext *gb, int quant, +static void decode_subband(const DiracContext *s, GetBitContext *gb, int quant, int slice_x, int slice_y, int bits_end, - SubBand *b1, SubBand *b2) + const SubBand *b1, const SubBand *b2) { int left = b1->width * slice_x/ s->num_x; int right = b1->width *(slice_x+1) / s->num_x; @@ -775,7 +776,7 @@ static void decode_subband(DiracContext *s, GetBitContext *gb, int quant, */ static int decode_lowdelay_slice(AVCodecContext *avctx, void *arg) { -DiracContext *s = avctx->priv_data; +const DiracContext *s = avctx->priv_data; DiracSlice *slice = arg; GetBitContext *gb = &slice->gb; enum dirac_subband orientation; @@ -819,13 +820,13 @@ typedef struct SliceCoeffs { int tot; } SliceCoeffs; -static int subband_coeffs(DiracContext *s, int x, int y, int p, +static int subband_coeffs(const DiracContext *s, int x, int y, int p, SliceCoeffs c[MAX_DWT_LEVELS]) { int level, coef = 0; for (level = 0; level < s->wavelet_depth; level++) { SliceCoeffs *o = &c[level]; -SubBand *b = &s->plane[p].band[level][3]; /* orientation doens't matter */ +const SubBand *b = &s->plane[p].band[level][3]; /* orientation doens't matter */ o->top = b->height * y / s->num_y; o->left = b->width * x / s->num_x; o->tot_h = ((b->width * (x + 1)) / s->num_x) - o->left; @@ -840,7 +841,7 @@ static int subband_coeffs(DiracContext *s, int x, int y, int p, * VC-2 Specification -> * 13.5.3 hq_slice(sx,sy) */ -static int decode_hq_slice(DiracContext *s, DiracSlice *slice, uint8_t *tmp_buf) +static int decode_hq_slice(const DiracContext *s, DiracSlice *slice, uint8_t *tmp_buf) { int i, level, orientation, quant_idx; int qfactor[MAX_DWT_LEVELS][4], qoffset[MAX_DWT_LEVELS][4]; @@ -917,7 +918,7 @@ static int decode_hq_slice(DiracContext *s, DiracSlice *slice, uint8_t *tmp_buf) static int decode_hq_slice_row(AVCodecContext *avctx, void *arg, int jobnr, int threadnr) { int i; -DiracContext *s = avctx->priv_data; +const DiracContext *s = avctx->priv_data; DiracSlice *slices = ((DiracSlice *)arg) + s->num_x*jobnr; uint8_t *thread_buf = &s->thread_buf[s->thread_buf_size*threadnr]; for (i = 0; i < s->num_x; i++) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To un
[FFmpeg-cvslog] avcodec/dxv: Constify slice threads' ptr to main context
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 23 06:14:32 2022 +0200| [5ad29e15908523c423c881bce2aaf62e433169b6] | committer: Andreas Rheinhardt avcodec/dxv: Constify slice threads' ptr to main context Modifying the main context from a slice thread is (usually) a data race, so it must not happen. So only use a pointer to const to access the main context. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5ad29e15908523c423c881bce2aaf62e433169b6 --- libavcodec/dxv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index f36454a9f6..13c028d8ba 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -193,7 +193,7 @@ static int yao_block(uint8_t *plane0, ptrdiff_t stride0, static int decompress_texture_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb) { -DXVContext *ctx = avctx->priv_data; +const DXVContext *ctx = avctx->priv_data; AVFrame *frame = arg; const uint8_t *d = ctx->tex_data; int w_block = avctx->coded_width / ctx->texture_block_w; ___ 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/dvdec: Constify slice threads' ptr to main context
ffmpeg | branch: master | Andreas Rheinhardt | Sat Jul 23 06:15:23 2022 +0200| [597dc96736a960ed95f2cbbf0b32ddad210c7f2a] | committer: Andreas Rheinhardt avcodec/dvdec: Constify slice threads' ptr to main context Modifying the main context from a slice thread is (usually) a data race, so it must not happen. So only use a pointer to const to access the main context. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=597dc96736a960ed95f2cbbf0b32ddad210c7f2a --- libavcodec/dv.h| 4 ++-- libavcodec/dvdec.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/dv.h b/libavcodec/dv.h index 855afcc758..331b8e846a 100644 --- a/libavcodec/dv.h +++ b/libavcodec/dv.h @@ -109,8 +109,8 @@ static inline int dv_work_pool_size(const AVDVProfile *d) return size; } -static inline void dv_calculate_mb_xy(DVVideoContext *s, - DVwork_chunk *work_chunk, +static inline void dv_calculate_mb_xy(const DVVideoContext *s, + const DVwork_chunk *work_chunk, int m, int *mb_x, int *mb_y) { *mb_x = work_chunk->mb_coordinates[m] & 0xff; diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index 4760618a97..f7423580aa 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -345,7 +345,7 @@ static av_always_inline void put_block_8x4(int16_t *block, uint8_t *av_restrict } } -static void dv100_idct_put_last_row_field_chroma(DVVideoContext *s, uint8_t *data, +static void dv100_idct_put_last_row_field_chroma(const DVVideoContext *s, uint8_t *data, int stride, int16_t *blocks) { s->idsp.idct(blocks + 0*64); @@ -357,7 +357,7 @@ static void dv100_idct_put_last_row_field_chroma(DVVideoContext *s, uint8_t *dat put_block_8x4(blocks+1*64 + 4*8, data + 8 + stride, stride<<1); } -static void dv100_idct_put_last_row_field_luma(DVVideoContext *s, uint8_t *data, +static void dv100_idct_put_last_row_field_luma(const DVVideoContext *s, uint8_t *data, int stride, int16_t *blocks) { s->idsp.idct(blocks + 0*64); @@ -378,7 +378,7 @@ static void dv100_idct_put_last_row_field_luma(DVVideoContext *s, uint8_t *data, /* mb_x and mb_y are in units of 8 pixels */ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) { -DVVideoContext *s = avctx->priv_data; +const DVVideoContext *s = avctx->priv_data; DVwork_chunk *work_chunk = arg; int quant, dc, dct_mode, class1, j; int mb_index, mb_x, mb_y, last_index; ___ 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/ttmlenc: Use string literal macro for default namespacing
ffmpeg | branch: master | Andreas Rheinhardt | Sun Jul 31 04:57:23 2022 +0200| [1368b5a72502ad18794854ed61a574653bfa5900] | committer: Andreas Rheinhardt avcodec/ttmlenc: Use string literal macro for default namespacing Fixes -Werror=format-security build failures when building with disabled optimizations and (according to fate.ffmpeg.org also with several other old GCC versions). Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1368b5a72502ad18794854ed61a574653bfa5900 --- libavcodec/ttmlenc.c | 2 +- libavcodec/ttmlenc.h | 10 +- libavformat/ttmlenc.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/ttmlenc.c b/libavcodec/ttmlenc.c index 2a0be99028..7a09c8fb5e 100644 --- a/libavcodec/ttmlenc.c +++ b/libavcodec/ttmlenc.c @@ -315,7 +315,7 @@ static int ttml_write_header_content(AVCodecContext *avctx) } // write the first string in extradata, attributes in the base "tt" element. -av_bprintf(&s->buffer, ttml_default_namespacing); +av_bprintf(&s->buffer, TTML_DEFAULT_NAMESPACING); // the cell resolution is in character cells, so not exactly 1:1 against // a pixel based resolution, but as the tts:extent in the root // "tt" element is frowned upon (and disallowed in the EBU-TT profile), diff --git a/libavcodec/ttmlenc.h b/libavcodec/ttmlenc.h index 654ca0ee4d..cbed6f63b3 100644 --- a/libavcodec/ttmlenc.h +++ b/libavcodec/ttmlenc.h @@ -25,10 +25,10 @@ #define TTMLENC_EXTRADATA_SIGNATURE "lavc-ttmlenc" #define TTMLENC_EXTRADATA_SIGNATURE_SIZE (sizeof(TTMLENC_EXTRADATA_SIGNATURE) - 1) -static const char *const ttml_default_namespacing = -" xmlns=\"http://www.w3.org/ns/ttml\"\n"; -" xmlns:ttm=\"http://www.w3.org/ns/ttml#metadata\"\n"; -" xmlns:tts=\"http://www.w3.org/ns/ttml#styling\"\n"; -" xmlns:ttp=\"http://www.w3.org/ns/ttml#parameter\"\n";; +#define TTML_DEFAULT_NAMESPACING\ +" xmlns=\"http://www.w3.org/ns/ttml\"\n"; \ +" xmlns:ttm=\"http://www.w3.org/ns/ttml#metadata\"\n"; \ +" xmlns:tts=\"http://www.w3.org/ns/ttml#styling\"\n"; \ +" xmlns:ttp=\"http://www.w3.org/ns/ttml#parameter\"\n"; #endif /* AVCODEC_TTMLENC_H */ diff --git a/libavformat/ttmlenc.c b/libavformat/ttmlenc.c index 896fc81958..fc8069f7b5 100644 --- a/libavformat/ttmlenc.c +++ b/libavformat/ttmlenc.c @@ -91,7 +91,7 @@ static int ttml_set_header_values_from_extradata( if (!additional_data_size) { // simple case, we don't have to go through local_params and just // set default fall-back values (for old extradata format). -header_params->tt_element_params = ttml_default_namespacing; +header_params->tt_element_params = TTML_DEFAULT_NAMESPACING; header_params->pre_body_elements = ""; return 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".