[FFmpeg-cvslog] avcodec/hevcpred_template: Removed unreachable code

2023-10-03 Thread Dawid Kozinski
ffmpeg | branch: master | Dawid Kozinski  | Fri Sep 29 
10:32:13 2023 +0200| [3ba3e188b32a48cfca36f02ea9671e22f4c2482c] | committer: 
Ronald S. Bultje

avcodec/hevcpred_template: Removed unreachable code

Signed-off-by: Dawid Kozinski 
Signed-off-by: Ronald S. Bultje 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3ba3e188b32a48cfca36f02ea9671e22f4c2482c
---

 libavcodec/hevcpred_template.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c
index 16d1c7f35f..46bd806523 100644
--- a/libavcodec/hevcpred_template.c
+++ b/libavcodec/hevcpred_template.c
@@ -213,13 +213,10 @@ do {  \
 j = 0;
 while (j < size_max_x && !IS_INTRA(j, -1))
 j++;
-if (j > 0)
-if (cand_up_left) {
-EXTEND_LEFT_CIP(top, j, j + 1);
-} else {
-EXTEND_LEFT_CIP(top, j, j);
-top[-1] = top[0];
-}
+if (j > 0) {
+EXTEND_LEFT_CIP(top, j, j);
+top[-1] = top[0];
+}
 left[-1] = top[-1];
 }
 left[-1] = top[-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] doc/developer: move a sentence to a more appropriate place

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Mon Mar 20 
11:20:33 2023 +0100| [491a0ad0b9513d9de7909cc795f683f7b34a6737] | committer: 
Anton Khirnov

doc/developer: move a sentence to a more appropriate place

It's targeted at our users, not developers, so it makes more sense to
group it with other text targeted at our users.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=491a0ad0b9513d9de7909cc795f683f7b34a6737
---

 doc/developer.texi | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index 0c2f2cd7d1..85515f5d37 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -24,6 +24,10 @@ generated from the headers
 the examples under @file{doc/examples}
 @end itemize
 
+For more detailed legal information about the use of FFmpeg in
+external programs read the @file{LICENSE} file in the source tree and
+consult @url{https://ffmpeg.org/legal.html}.
+
 If you modify FFmpeg code for your own use case, you are highly encouraged to
 @emph{submit your changes back to us}, using this document as a guide. There 
are
 both pragmatic and ideological reasons to do so:
@@ -40,10 +44,6 @@ By supporting the project you find useful you ensure it 
continues to be
 maintained and developed.
 @end itemize
 
-For more detailed legal information about the use of FFmpeg in
-external programs read the @file{LICENSE} file in the source tree and
-consult @url{https://ffmpeg.org/legal.html}.
-
 @section Contributing code
 
 All proposed code changes should be submitted for review to

___
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] doc/developer: fix a nonsense statement

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Thu Aug 24 
09:33:26 2023 +0200| [836a8e116a06847bb6f2c79bd41ad3108fb3268e] | committer: 
Anton Khirnov

doc/developer: fix a nonsense statement

Adding new fields to _functions_ makes no sense, it was supposed to be
structs.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=836a8e116a06847bb6f2c79bd41ad3108fb3268e
---

 doc/developer.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index d27716ab97..df43119f98 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -425,7 +425,7 @@ number remains unchanged.
 @subsection Adding new interfaces
 Any new public identifiers in installed headers are considered new API - this
 includes new functions, structs, macros, enum values, typedefs, new fields in
-existing functions, new installed headers, etc. Consider the following
+existing structs, new installed headers, etc. Consider the following
 guidelines when adding new APIs.
 
 @subsubheading Motivation

___
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] doc/developer: add a code behaviour section to development policy

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Thu Aug 24 
10:22:35 2023 +0200| [e89844766163b34f4428f4a732b25f4e268098cf] | committer: 
Anton Khirnov

doc/developer: add a code behaviour section to development policy

Document our longstanding de facto policies on things like correctness,
thread-safety, undefined behaviour, etc.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e89844766163b34f4428f4a732b25f4e268098cf
---

 doc/developer.texi | 50 --
 1 file changed, 36 insertions(+), 14 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index df43119f98..b4aef256c0 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -274,10 +274,6 @@ symbols. If in doubt, just avoid names starting with 
@code{_} altogether.
 @section Miscellaneous conventions
 
 @itemize @bullet
-@item
-fprintf and printf are forbidden in libavformat and libavcodec,
-please use av_log() instead.
-
 @item
 Casts should be used only when necessary. Unneeded parentheses
 should also be avoided if they don't make the code easier to understand.
@@ -286,6 +282,42 @@ should also be avoided if they don't make the code easier 
to understand.
 @anchor{Development Policy}
 @chapter Development Policy
 
+@section Code behaviour
+
+@subheading Correctness
+The code must be valid. It must not crash, abort, access invalid pointers, leak
+memory, cause data races or signed integer overflow, or otherwise cause
+undefined behaviour. Error codes should be checked and, when applicable,
+forwarded to the caller.
+
+@subheading Thread- and library-safety
+Our libraries may be called by multiple independent callers in the same 
process.
+These calls may happen from any number of threads and the different call sites
+may not be aware of each other - e.g. a user program may be calling our
+libraries directly, and use one or more libraries that also call our libraries.
+The code must behave correctly under such conditions.
+
+@subheading Robustness
+The code must treat as untrusted any bytestream received from a caller or read
+from a file, network, etc. It must not misbehave when arbitrary data is sent to
+it - typically it should print an error message and return
+@code{AVERROR_INVALIDDATA} on encountering invalid input data.
+
+@subheading Memory allocation
+The code must use the @code{av_malloc()} family of functions from
+@file{libavutil/mem.h} to perform all memory allocation, except in special 
cases
+(e.g. when interacting with an external library that requires a specific
+allocator to be used).
+
+All allocations should be checked and @code{AVERROR(ENOMEM)} returned on
+failure. A common mistake is that error paths leak memory - make sure that does
+not happen.
+
+@subheading stdio
+Our libraries must not access the stdio streams stdin/stdout/stderr directly
+(e.g. via @code{printf()} family of functions), as that is not library-safe. 
For
+logging, use @code{av_log()}.
+
 @section Patches/Committing
 @subheading Licenses for patches must be compatible with FFmpeg.
 Contributions should be licensed under the
@@ -395,11 +427,6 @@ If it is a bug, the bug has to be fixed. If it is not, the 
code should
 be changed to not generate a warning unless that causes a slowdown
 or obfuscates the code.
 
-@subheading Check untrusted input properly.
-Never write to unallocated memory, never write over the end of arrays,
-always check values read from some untrusted source before using them
-as array index or other risky things.
-
 @section Library public interfaces
 Every library in FFmpeg provides a set of public APIs in its installed headers,
 which are those listed in the variable @code{HEADERS} in that library's
@@ -811,11 +838,6 @@ an explanation why to your patchset, its ok to not test if 
theres a reason.
 @item
 If you added YASM code please check that things still work with --disable-yasm.
 
-@item
-Make sure you check the return values of function and return appropriate
-error codes. Especially memory allocation functions like @code{av_malloc()}
-are notoriously left unchecked, which is a serious problem.
-
 @item
 Test your code with valgrind and or Address Sanitizer to ensure it's free
 of leaks, out of array accesses, etc.

___
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] doc/developer: merge the 'contributing code' section into its parent chapter

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Mon Mar 20 
11:23:08 2023 +0100| [f3ba1158e44f4b1517277ef660edbc7c88f089dc] | committer: 
Anton Khirnov

doc/developer: merge the 'contributing code' section into its parent chapter

The section consistes of a single short paragraph linking to other
chapters. The enclosing chapter also has no other sections, all other
text is placed in the chapter directly.
Keeping a separate section for this paragraph just adds more clutter.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3ba1158e44f4b1517277ef660edbc7c88f089dc
---

 doc/developer.texi | 2 --
 1 file changed, 2 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index 85515f5d37..d27716ab97 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -44,8 +44,6 @@ By supporting the project you find useful you ensure it 
continues to be
 maintained and developed.
 @end itemize
 
-@section Contributing code
-
 All proposed code changes should be submitted for review to
 @url{mailto:ffmpeg-devel@@ffmpeg.org, the development mailing list}, as
 described in more detail in the @ref{Submitting patches} chapter. The code

___
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] doc/developer: drop an outdated item

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Thu Aug 24 
10:46:46 2023 +0200| [4c4bf54d99a7245683aef6a197179043df8b178c] | committer: 
Anton Khirnov

doc/developer: drop an outdated item

It dates back to pre-2005 days, when people generally tended to commit
their work directly without going through the mailing list. Few
developers do it today, and never outside of their standalone modules.
This item is thus confusing and misleading and is better removed.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c4bf54d99a7245683aef6a197179043df8b178c
---

 doc/developer.texi | 9 -
 1 file changed, 9 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index b4aef256c0..6a67515980 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -365,15 +365,6 @@ later on.
 Also if you have doubts about splitting or not splitting, do not hesitate to
 ask/discuss it on the developer mailing list.
 
-@subheading Ask before you change the build system (configure, etc).
-Do not commit changes to the build system (Makefiles, configure script)
-which change behavior, defaults etc, without asking first. The same
-applies to compiler warning fixes, trivial looking fixes and to code
-maintained by other developers. We usually have a reason for doing things
-the way we do. Send your changes as patches to the ffmpeg-devel mailing
-list, and if the code maintainers say OK, you may commit. This does not
-apply to files you wrote and/or maintain.
-
 @subheading Cosmetic changes should be kept in separate patches.
 We refuse source indentation and other cosmetic changes if they are mixed
 with functional changes, such commits will be rejected and removed. Every

___
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] doc/developer: deduplicate commit message rules

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Thu Aug 24 
11:12:55 2023 +0200| [99fe00ab4b690578ef6c8c496812dbb477d2bc7b] | committer: 
Anton Khirnov

doc/developer: deduplicate commit message rules

The patches/committing section currently contains several
partially-overlapping rules on commit messages. Merge and simplify them
into one item.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99fe00ab4b690578ef6c8c496812dbb477d2bc7b
---

 doc/developer.texi | 41 ++---
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index 6a67515980..26dc5b9749 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -340,13 +340,24 @@ missing samples or an implementation with a small subset 
of features.
 Always check the mailing list for any reviewers with issues and test
 FATE before you push.
 
-@subheading Keep the main commit message short with an extended description 
below.
-The commit message should have a short first line in the form of
-a @samp{topic: short description} as a header, separated by a newline
-from the body consisting of an explanation of why the change is necessary.
-If the commit fixes a known bug on the bug tracker, the commit message
-should include its bug ID. Referring to the issue on the bug tracker does
-not exempt you from writing an excerpt of the bug in the commit message.
+@subheading Commit messages
+Commit messages are highly important tools for informing other developers on
+what a given change does and why. Every commit must always have a properly
+filled out commit message with the following format:
+@example
+area changed: short 1 line description
+
+details describing what and why and giving references.
+@end example
+
+If the commit addresses a known bug on our bug tracker or other external issue
+(e.g. CVE), the commit message should include the relevant bug ID(s) or other
+external identifiers. Note that this should be done in addition to a proper
+explanation and not instead of it. Comments such as "fixed!" or "Changed it."
+are not acceptable.
+
+When applying patches that have been discussed at length on the mailing list,
+reference the thread in the commit message.
 
 @subheading Testing must be adequate but not excessive.
 If it works for you, others, and passes FATE then it should be OK to commit
@@ -379,28 +390,12 @@ NOTE: If you had to put if()@{ .. @} over a large (> 5 
lines) chunk of code,
 then either do NOT change the indentation of the inner part within (do not
 move it to the right)! or do so in a separate commit
 
-@subheading Commit messages should always be filled out properly.
-Always fill out the commit log message. Describe in a few lines what you
-changed and why. You can refer to mailing list postings if you fix a
-particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
-Recommended format:
-
-@example
-area changed: Short 1 line description
-
-details describing what and why and giving references.
-@end example
-
 @subheading Credit the author of the patch.
 Make sure the author of the commit is set correctly. (see git commit --author)
 If you apply a patch, send an
 answer to ffmpeg-devel (or wherever you got the patch from) saying that
 you applied the patch.
 
-@subheading Complex patches should refer to discussion surrounding them.
-When applying patches that have been discussed (at length) on the mailing
-list, reference the thread in the log message.
-
 @subheading Always wait long enough before pushing changes
 Do NOT commit to code actively maintained by others without permission.
 Send a patch to ffmpeg-devel. If no one answers within a reasonable

___
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] lavf/gifdec: do not mark as notimestamps

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Thu Sep 28 
16:43:04 2023 +0200| [3562993d82e49347757a7112009f5a1d2391cb74] | committer: 
Anton Khirnov

lavf/gifdec: do not mark as notimestamps

The demuxer does not set packet timestamps itself after
c6b6356635f598b095606cd126f31bc6ab916225 and instead relies on the
parser to do it. However, this does not matter from the caller
perspective as it still happens inside the demuxer. The demuxer should
thus not be flagged as not having timestamps.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3562993d82e49347757a7112009f5a1d2391cb74
---

 libavformat/gifdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c
index 774358e1fa..32286adafe 100644
--- a/libavformat/gifdec.c
+++ b/libavformat/gifdec.c
@@ -285,7 +285,7 @@ const AVInputFormat ff_gif_demuxer = {
 .read_probe = gif_probe,
 .read_header= gif_read_header,
 .read_packet= gif_read_packet,
-.flags  = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
+.flags  = AVFMT_GENERIC_INDEX,
 .extensions = "gif",
 .priv_class = &demuxer_class,
 };

___
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] lavc/mpegvideo_parser: improve exporting field-coding information

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Sat Sep 30 
16:32:05 2023 +0200| [4a376f45ab58f29045be6df1af8121702299c701] | committer: 
Anton Khirnov

lavc/mpegvideo_parser: improve exporting field-coding information

* export AVCodecParserContext.picture_structure.
* when there are two field pictures in the packet, set
  the interlacing parameters accordingly:
* repeat_pict=1 and picture_structure=FRAME to indicate 2 fields
* field_order to indicate the first field of the two

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a376f45ab58f29045be6df1af8121702299c701
---

 libavcodec/mpegvideo_parser.c | 31 ---
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index 76cd2a5131..2cd0348317 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -111,9 +111,15 @@ static void mpegvideo_extract_headers(AVCodecParserContext 
*s,
 int bit_rate = 0;
 int vbv_delay = 0;
 enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
-//FIXME replace the crap with get_bits()
-s->repeat_pict = 0;
 
+// number of picture coding extensions (i.e. MPEG2 pictures)
+// in this packet - should be 1 or 2
+int nb_pic_ext = 0;
+// when there are two pictures in the packet this indicates
+// which field is in the first of them
+int first_field = AV_FIELD_UNKNOWN;
+
+//FIXME replace the crap with get_bits()
 while (buf < buf_end) {
 uint32_t start_code = -1;
 buf= avpriv_find_start_code(buf, buf_end, &start_code);
@@ -124,7 +130,6 @@ static void mpegvideo_extract_headers(AVCodecParserContext 
*s,
 s->pict_type = (buf[1] >> 3) & 7;
 if (bytes_left >= 4)
 vbv_delay = ((buf[1] & 0x07) << 13) | (buf[2] << 5) | 
(buf[3] >> 3);
-s->repeat_pict = 1;
 }
 break;
 case SEQ_START_CODE:
@@ -190,6 +195,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 int  progressive_frame = buf[4] & (1 << 7);
 
 /* check if we must repeat the frame */
+s->repeat_pict = 1;
 if (repeat_first_field) {
 if (pc->progressive_sequence) {
 if (top_field_first)
@@ -208,6 +214,19 @@ FF_ENABLE_DEPRECATION_WARNINGS
 s->field_order = AV_FIELD_BB;
 } else
 s->field_order = AV_FIELD_PROGRESSIVE;
+
+s->picture_structure = buf[2] & 3;
+
+if (!nb_pic_ext) {
+// remember parity of the first field for the case
+// when there are 2 fields in packet
+switch (s->picture_structure) {
+case AV_PICTURE_STRUCTURE_BOTTOM_FIELD: 
first_field = AV_FIELD_BB; break;
+case AV_PICTURE_STRUCTURE_TOP_FIELD:
first_field = AV_FIELD_TT; break;
+}
+}
+
+nb_pic_ext++;
 }
 break;
 }
@@ -243,6 +262,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
 s->coded_width  = FFALIGN(pc->width,  16);
 s->coded_height = FFALIGN(pc->height, 16);
 }
+
+if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO || nb_pic_ext > 1) {
+s->repeat_pict   = 1;
+s->picture_structure = AV_PICTURE_STRUCTURE_FRAME;
+s->field_order   = nb_pic_ext > 1 ? first_field : 
AV_FIELD_PROGRESSIVE;
+}
 }
 
 static int mpegvideo_parse(AVCodecParserContext *s,

___
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] lavf/demux: restrict video parser duration handling to just GIF

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Thu Sep 28 
16:33:33 2023 +0200| [80401b86d30a9348decef6341aa4779469fad281] | committer: 
Anton Khirnov

lavf/demux: restrict video parser duration handling to just GIF

The parser does not have a timebase associated with it, so in general it
makes no sense for it to be exporting durations. Longer-term this
should be handled more cleanly with a new parser API.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80401b86d30a9348decef6341aa4779469fad281
---

 libavformat/demux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 6decb08698..45cdb8e1b7 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1200,7 +1200,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
  st->time_base,
  AV_ROUND_DOWN);
 }
-} else if ((s->iformat->flags & AVFMT_NOTIMESTAMPS) && 
st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+} else if (st->codecpar->codec_id == AV_CODEC_ID_GIF) {
 if (st->time_base.num > 0 && st->time_base.den > 0 &&
 sti->parser->duration) {
 out_pkt->duration = sti->parser->duration;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] fftools/ffmpeg_enc: do not round frame durations prematurely

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Sun Oct  1 
14:33:13 2023 +0200| [9d4ca76c08aae1e6b3e54b424da211bfe369] | committer: 
Anton Khirnov

fftools/ffmpeg_enc: do not round frame durations prematurely

Changes the results of fate-idroq-video-encode and fate-lavf* tests,
where different frames now get duplicated by framerate conversion code.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9d4ca76c08aae1e6b3e54b424da211bfe369
---

 fftools/ffmpeg_enc.c  | 6 +++---
 tests/ref/fate/idroq-video-encode | 2 +-
 tests/ref/lavf/dv_ntsc| 4 ++--
 tests/ref/lavf/gxf_ntsc   | 6 +++---
 tests/ref/lavf/ismv   | 6 +++---
 tests/ref/lavf/mov| 6 +++---
 tests/ref/lavf/mp4| 6 +++---
 tests/ref/lavf/mpg| 4 ++--
 tests/ref/lavf/mxf| 6 +++---
 9 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index b40a6211a9..6c00156121 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -1030,11 +1030,11 @@ static void video_sync_process(OutputFile *of, 
OutputStream *ost,
 *nb_frames = 0;
 else if (delta > 0.6)
 e->next_pts = llrint(sync_ipts);
-frame->duration = duration;
+frame->duration = llrint(duration);
 break;
 case VSYNC_DROP:
 case VSYNC_PASSTHROUGH:
-frame->duration = duration;
+frame->duration = llrint(duration);
 e->next_pts = llrint(sync_ipts);
 break;
 default:
@@ -1112,7 +1112,7 @@ static int do_video_out(OutputFile *of, OutputStream 
*ost, AVFrame *frame)
 if (frame) {
 FrameData *fd = frame_data(frame);
 
-duration = lrintf(frame->duration * av_q2d(frame->time_base) / 
av_q2d(enc->time_base));
+duration = frame->duration * av_q2d(frame->time_base) / 
av_q2d(enc->time_base);
 
 if (duration <= 0 &&
 fd->frame_rate_filter.num > 0 && fd->frame_rate_filter.den > 0)
diff --git a/tests/ref/fate/idroq-video-encode 
b/tests/ref/fate/idroq-video-encode
index bdb6fedf56..f777247efd 100644
--- a/tests/ref/fate/idroq-video-encode
+++ b/tests/ref/fate/idroq-video-encode
@@ -1 +1 @@
-e9ff61023826fce304350ff6e7c63b2f
+6d8303bb56b8da2a63efef323aea235e
diff --git a/tests/ref/lavf/dv_ntsc b/tests/ref/lavf/dv_ntsc
index 410b6ec254..c6aa6b1fbb 100644
--- a/tests/ref/lavf/dv_ntsc
+++ b/tests/ref/lavf/dv_ntsc
@@ -1,3 +1,3 @@
-5569626370c7c72d40de2c4559e32856 *tests/data/lavf/lavf.dv_ntsc
+d28a4c67aa8e3413458de9ca7e6f00ed *tests/data/lavf/lavf.dv_ntsc
 348 tests/data/lavf/lavf.dv_ntsc
-tests/data/lavf/lavf.dv_ntsc CRC=0xa0088163
+tests/data/lavf/lavf.dv_ntsc CRC=0xaa69ba6a
diff --git a/tests/ref/lavf/gxf_ntsc b/tests/ref/lavf/gxf_ntsc
index 60efd80462..d74e8d8ba4 100644
--- a/tests/ref/lavf/gxf_ntsc
+++ b/tests/ref/lavf/gxf_ntsc
@@ -1,3 +1,3 @@
-9a27673c85f1671ba9ff7cd33e5735de *tests/data/lavf/lavf.gxf_ntsc
-794660 tests/data/lavf/lavf.gxf_ntsc
-tests/data/lavf/lavf.gxf_ntsc CRC=0xdcd39443
+5071abe1fd46a3ca3d669203c6d45883 *tests/data/lavf/lavf.gxf_ntsc
+793900 tests/data/lavf/lavf.gxf_ntsc
+tests/data/lavf/lavf.gxf_ntsc CRC=0xb73f184e
diff --git a/tests/ref/lavf/ismv b/tests/ref/lavf/ismv
index ac7f72ba33..bb89412d8c 100644
--- a/tests/ref/lavf/ismv
+++ b/tests/ref/lavf/ismv
@@ -1,9 +1,9 @@
 48fb8d7a5d19bd60f3a49ccf4b7d6593 *tests/data/lavf/lavf.ismv
 313169 tests/data/lavf/lavf.ismv
 tests/data/lavf/lavf.ismv CRC=0x9d9a638a
-d19cd8e310a2e94fe0a0d11c5dc29217 *tests/data/lavf/lavf.ismv
-322075 tests/data/lavf/lavf.ismv
-tests/data/lavf/lavf.ismv CRC=0xe8130120
+b3ba38e148c00466441627ea04749f63 *tests/data/lavf/lavf.ismv
+322247 tests/data/lavf/lavf.ismv
+tests/data/lavf/lavf.ismv CRC=0xc5569484
 3b6023766845b51b075aed474c00f73c *tests/data/lavf/lavf.ismv
 312546 tests/data/lavf/lavf.ismv
 tests/data/lavf/lavf.ismv CRC=0x9d9a638a
diff --git a/tests/ref/lavf/mov b/tests/ref/lavf/mov
index 75a0c4892d..cfc64141aa 100644
--- a/tests/ref/lavf/mov
+++ b/tests/ref/lavf/mov
@@ -1,9 +1,9 @@
 11bd76730274924e02623172b82b5236 *tests/data/lavf/lavf.mov
 357539 tests/data/lavf/lavf.mov
 tests/data/lavf/lavf.mov CRC=0xbb2b949b
-6efa586655e3db043cb29668f5216610 *tests/data/lavf/lavf.mov
-366621 tests/data/lavf/lavf.mov
-tests/data/lavf/lavf.mov CRC=0xa9793231
+9ed9ce9b636f85b62d3c3583ff84691e *tests/data/lavf/lavf.mov
+366793 tests/data/lavf/lavf.mov
+tests/data/lavf/lavf.mov CRC=0xc75fc595
 c80c625ded376602e71d5aa6ac6fdb1c *tests/data/lavf/lavf.mov
 356921 tests/data/lavf/lavf.mov
 tests/data/lavf/lavf.mov CRC=0xbb2b949b
diff --git a/tests/ref/lavf/mp4 b/tests/ref/lavf/mp4
index b05fa34d0b..686e4f48f8 100644
--- a/tests/ref/lavf/mp4
+++ b/tests/ref/lavf/mp4
@@ -1,9 +1,9 @@
 a6e44724cab1c4b50c49b0fd227b87d3 *tests/data/lavf/lavf.mp4
 312477 tests/data/lavf/lavf.mp4
 tests/data/lavf/lavf.mp4 CRC=0x9d9a638a
-19cbdb02f2f3e35bae779e2323be1b8e *tests/data/lavf/lavf.mp4
-321363 tests/data/lavf/lavf.mp4
-tests/data/lavf

[FFmpeg-cvslog] lavfi/yadif: update output frame durations

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Sat Sep 30 
21:19:01 2023 +0200| [63bc6430a67ad9409093c1e613f5120e72c39985] | committer: 
Anton Khirnov

lavfi/yadif: update output frame durations

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=63bc6430a67ad9409093c1e613f5120e72c39985
---

 libavfilter/yadif_common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavfilter/yadif_common.c b/libavfilter/yadif_common.c
index b26989f574..21097011f5 100644
--- a/libavfilter/yadif_common.c
+++ b/libavfilter/yadif_common.c
@@ -151,6 +151,7 @@ int ff_yadif_filter_frame(AVFilterLink *link, AVFrame 
*frame)
 av_frame_free(&yadif->prev);
 if (yadif->out->pts != AV_NOPTS_VALUE)
 yadif->out->pts *= 2;
+yadif->out->duration *= 2;
 return ff_filter_frame(ctx->outputs[0], yadif->out);
 }
 
@@ -168,6 +169,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 if (yadif->out->pts != AV_NOPTS_VALUE)
 yadif->out->pts *= 2;
+if (!(yadif->mode & 1))
+yadif->out->duration *= 2;
 
 return return_frame(ctx, 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] fftools/ffmpeg_dec: disregard demuxer timestamps for NOTIMESTAMPS formats

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Sun Oct  1 
13:04:33 2023 +0200| [303f10d4dd642b903091728447e2d26ef77614b9] | committer: 
Anton Khirnov

fftools/ffmpeg_dec: disregard demuxer timestamps for NOTIMESTAMPS formats

In this case any timestamps are guessed by compute_pkt_fields() in
libavformat. Since we are decoding the stream, we have more accurate
information from the decoder and do not need any guesses.

Eliminates spurious PTS gaps in a number of FATE tests.

Also avoids dropping the majority of frames in fate-dirac*

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=303f10d4dd642b903091728447e2d26ef77614b9
---

 fftools/ffmpeg_dec.c  |  8 -
 tests/ref/fate/dirac  | 28 ++
 tests/ref/fate/dirac-low-delay| 28 ++
 tests/ref/fate/mpeg2-ticket6677   | 14 -
 tests/ref/fate/vc1_ilaced_twomv   | 24 +++
 tests/ref/fate/vc1_sa00040| 12 
 tests/ref/fate/vc1_sa00050| 28 +-
 tests/ref/fate/vc1_sa10091| 26 
 tests/ref/fate/vc1_sa10143| 58 ++--
 tests/ref/fate/vc1_sa20021| 62 +++
 tests/ref/fate/xvid-custom-matrix |  2 +-
 tests/ref/fate/xvid-idct  |  2 +-
 12 files changed, 177 insertions(+), 115 deletions(-)

diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 1de8234a97..fcee8b65ac 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -540,8 +540,9 @@ static int send_filter_eof(InputStream *ist)
 return 0;
 }
 
-static int packet_decode(InputStream *ist, const AVPacket *pkt, AVFrame *frame)
+static int packet_decode(InputStream *ist, AVPacket *pkt, AVFrame *frame)
 {
+const InputFile *ifile = input_files[ist->file_index];
 Decoder *d = ist->decoder;
 AVCodecContext *dec = ist->dec_ctx;
 const char *type_desc = av_get_media_type_string(dec->codec_type);
@@ -556,6 +557,11 @@ static int packet_decode(InputStream *ist, const AVPacket 
*pkt, AVFrame *frame)
 if (pkt && pkt->size == 0)
 return 0;
 
+if (pkt && ifile->format_nots) {
+pkt->pts = AV_NOPTS_VALUE;
+pkt->dts = AV_NOPTS_VALUE;
+}
+
 ret = avcodec_send_packet(dec, pkt);
 if (ret < 0 && !(ret == AVERROR_EOF && !pkt)) {
 // In particular, we don't expect AVERROR(EAGAIN), because we read all
diff --git a/tests/ref/fate/dirac b/tests/ref/fate/dirac
index f3f3dafb19..2027a44395 100644
--- a/tests/ref/fate/dirac
+++ b/tests/ref/fate/dirac
@@ -5,3 +5,31 @@
 #sar 0: 1/1
 0,  0,  0,1,   115200, 0xf73819e8
 0,  1,  1,1,   115200, 0x082e3788
+0,  2,  2,1,   115200, 0x9fe73790
+0,  3,  3,1,   115200, 0x58f63cc4
+0,  4,  4,1,   115200, 0xd91c3767
+0,  5,  5,1,   115200, 0xac39658c
+0,  6,  6,1,   115200, 0xd6d57406
+0,  7,  7,1,   115200, 0x791b707f
+0,  8,  8,1,   115200, 0x02e05e31
+0,  9,  9,1,   115200, 0x7737ca43
+0, 10, 10,1,   115200, 0xa9b5b019
+0, 11, 11,1,   115200, 0x8b2685be
+0, 12, 12,1,   115200, 0x2f547334
+0, 13, 13,1,   115200, 0x9c2ba0ad
+0, 14, 14,1,   115200, 0x17069da3
+0, 15, 15,1,   115200, 0xbc7fadd1
+0, 16, 16,1,   115200, 0xbf651cce
+0, 17, 17,1,   115200, 0x2e1abc0d
+0, 18, 18,1,   115200, 0xc6c9a945
+0, 19, 19,1,   115200, 0x5234c510
+0, 20, 20,1,   115200, 0x84b5ab26
+0, 21, 21,1,   115200, 0xf01da61e
+0, 22, 22,1,   115200, 0xfb339d74
+0, 23, 23,1,   115200, 0x0973bf98
+0, 24, 24,1,   115200, 0x7467023a
+0, 25, 25,1,   115200, 0x3c8ba9a1
+0, 26, 26,1,   115200, 0xdc699e3e
+0, 27, 27,1,   115200, 0xe57f9d2e
+0, 28, 28,1,   115200, 0x79b18bc4
+0, 29, 29,1,   115200, 0x4c4c98a0
diff --git a/tests/ref/fate/dirac-low-delay b/tests/ref/fate/dirac-low-delay
index 13bf8e8517..758f17f05d 100644
--- a/tests/ref/fate/dirac-low-delay
+++ b/tests/ref/fate/dirac-low-delay
@@ -5,3 +5,31 @@
 #sar 0: 1/1
 0,  0,  0,1,   115200, 0x2599a172
 0,  1,  1,1,   115200, 0x08a8c08d
+0,  2,  2,1,   115200, 0xf586aa9e
+0,  3,  3,1,   115200, 0x5295c51e
+0,  4,  4,1,   115200, 0x06b3d0c4
+0,  5,  5,1,   115200, 0xed28999a
+0,  6,  6,1,   115200, 0x566e7b4b
+0

[FFmpeg-cvslog] lavc/mpeg4videodec: do not invent a framerate from guessed numbers

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Sun Oct  1 
14:11:20 2023 +0200| [cdfd15f4d85c3e089ad258d8a24fb2c6907af10c] | committer: 
Anton Khirnov

lavc/mpeg4videodec: do not invent a framerate from guessed numbers

Improves timestamps for fate-m4v*

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cdfd15f4d85c3e089ad258d8a24fb2c6907af10c
---

 libavcodec/mpeg4videodec.c |  3 --
 tests/ref/fate/m4v | 84 +++---
 tests/ref/fate/m4v-cfr |  1 +
 3 files changed, 43 insertions(+), 45 deletions(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index a8dd57bf6b..b24fe3db20 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3141,9 +3141,6 @@ static int decode_vop_header(Mpeg4DecContext *ctx, 
GetBitContext *gb,
 
 av_log(s->avctx, AV_LOG_WARNING,
"time_increment_bits set to %d bits, based on bitstream 
analysis\n", ctx->time_increment_bits);
-if (s->avctx->framerate.num && 4*s->avctx->framerate.num < 
1avctx->framerate.num = 1

[FFmpeg-cvslog] lavc/mpegvideo_parser: reduce variable scopes

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Sat Sep 30 
15:28:56 2023 +0200| [2c9eb491220503280246e1a2f84bb7a87383b328] | committer: 
Anton Khirnov

lavc/mpegvideo_parser: reduce variable scopes

Drop some variables only used in a switch().

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2c9eb491220503280246e1a2f84bb7a87383b328
---

 libavcodec/mpegvideo_parser.c | 33 ++---
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index d0b22634bb..76cd2a5131 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -105,22 +105,17 @@ static void 
mpegvideo_extract_headers(AVCodecParserContext *s,
 {
 struct MpvParseContext *pc = s->priv_data;
 const uint8_t *buf_end = buf + buf_size;
-uint32_t start_code;
-int frame_rate_index, ext_type, bytes_left;
-int frame_rate_ext_n, frame_rate_ext_d;
-int top_field_first, repeat_first_field, progressive_frame;
-int horiz_size_ext, vert_size_ext, bit_rate_ext;
+int bytes_left;
 int did_set_size=0;
 int set_dim_ret = 0;
 int bit_rate = 0;
 int vbv_delay = 0;
-int chroma_format;
 enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
 //FIXME replace the crap with get_bits()
 s->repeat_pict = 0;
 
 while (buf < buf_end) {
-start_code= -1;
+uint32_t start_code = -1;
 buf= avpriv_find_start_code(buf, buf_end, &start_code);
 bytes_left = buf_end - buf;
 switch(start_code) {
@@ -134,6 +129,8 @@ static void mpegvideo_extract_headers(AVCodecParserContext 
*s,
 break;
 case SEQ_START_CODE:
 if (bytes_left >= 7) {
+int frame_rate_index;
+
 pc->width  = (buf[0] << 4) | (buf[1] >> 4);
 pc->height = ((buf[1] & 0x0f) << 8) | buf[2];
 if(!avctx->width || !avctx->height || !avctx->coded_width || 
!avctx->coded_height){
@@ -154,20 +151,18 @@ FF_ENABLE_DEPRECATION_WARNINGS
 break;
 case EXT_START_CODE:
 if (bytes_left >= 1) {
-ext_type = (buf[0] >> 4);
-switch(ext_type) {
+switch (buf[0] >> 4) { // ext_type
 case 0x1: /* sequence extension */
 if (bytes_left >= 6) {
-horiz_size_ext = ((buf[1] & 1) << 1) | (buf[2] >> 7);
-vert_size_ext = (buf[2] >> 5) & 3;
-bit_rate_ext = ((buf[2] & 0x1F)<<7) | (buf[3]>>1);
-frame_rate_ext_n = (buf[5] >> 5) & 3;
-frame_rate_ext_d = (buf[5] & 0x1f);
+int horiz_size_ext   = ((buf[1] & 1) << 1) | (buf[2] 
>> 7);
+int  vert_size_ext   = (buf[2] >> 5) & 3;
+int   bit_rate_ext   = ((buf[2] & 0x1F)<<7) | 
(buf[3]>>1);
+int frame_rate_ext_n = (buf[5] >> 5) & 3;
+int frame_rate_ext_d = (buf[5] & 0x1f);
 pc->progressive_sequence = buf[1] & (1 << 3);
 avctx->has_b_frames= !(buf[5] >> 7);
 
-chroma_format = (buf[1] >> 1) & 3;
-switch (chroma_format) {
+switch ((buf[1] >> 1) & 3) { // chroma_format
 case 1: pix_fmt = AV_PIX_FMT_YUV420P; break;
 case 2: pix_fmt = AV_PIX_FMT_YUV422P; break;
 case 3: pix_fmt = AV_PIX_FMT_YUV444P; break;
@@ -190,9 +185,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
 break;
 case 0x8: /* picture coding extension */
 if (bytes_left >= 5) {
-top_field_first = buf[3] & (1 << 7);
-repeat_first_field = buf[3] & (1 << 1);
-progressive_frame = buf[4] & (1 << 7);
+inttop_field_first = buf[3] & (1 << 7);
+int repeat_first_field = buf[3] & (1 << 1);
+int  progressive_frame = buf[4] & (1 << 7);
 
 /* check if we must repeat the frame */
 if (repeat_first_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] fftools/ffmpeg: move derivation of frame duration from filter framerate

2023-10-03 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Fri Jul 21 
18:39:08 2023 +0200| [8d12762b42c27ffc0b4ce9890bc622c96c524549] | committer: 
Anton Khirnov

fftools/ffmpeg: move derivation of frame duration from filter framerate

>From ffmpeg_enc to ffmpeg_filter, which is a more appropriate
place for it.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d12762b42c27ffc0b4ce9890bc622c96c524549
---

 fftools/ffmpeg_enc.c| 9 +
 fftools/ffmpeg_filter.c | 6 +-
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 6c00156121..ec9cebbd96 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -1109,16 +1109,9 @@ static int do_video_out(OutputFile *of, OutputStream 
*ost, AVFrame *frame)
 int64_t nb_frames, nb_frames_prev, i;
 double duration = 0;
 
-if (frame) {
-FrameData *fd = frame_data(frame);
-
+if (frame)
 duration = frame->duration * av_q2d(frame->time_base) / 
av_q2d(enc->time_base);
 
-if (duration <= 0 &&
-fd->frame_rate_filter.num > 0 && fd->frame_rate_filter.den > 0)
-duration = 1 / (av_q2d(fd->frame_rate_filter) * 
av_q2d(enc->time_base));
-}
-
 video_sync_process(of, ost, frame, duration,
&nb_frames, &nb_frames_prev);
 
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 9bf870b615..b6348d7f87 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1817,8 +1817,12 @@ static int fg_output_step(OutputFilterPriv *ofp, int 
flush)
 
 if (ost->type == AVMEDIA_TYPE_VIDEO) {
 AVRational fr = av_buffersink_get_frame_rate(filter);
-if (fr.num > 0 && fr.den > 0)
+if (fr.num > 0 && fr.den > 0) {
 fd->frame_rate_filter = fr;
+
+if (!frame->duration)
+frame->duration = av_rescale_q(1, av_inv_q(fr), 
frame->time_base);
+}
 }
 
 ret = enc_frame(ost, 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/mpegvideo_dec: Check for existence of planes before accesses

2023-10-03 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sat Sep 30 18:07:58 2023 +0200| [3ede6cc0f18c3da842d18153b860d911bdbfbde9] | 
committer: Andreas Rheinhardt

avcodec/mpegvideo_dec: Check for existence of planes before accesses

Fixes segfaults with -debug +nomc -flags +gray (presuming
a build with --enable-gray).

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3ede6cc0f18c3da842d18153b860d911bdbfbde9
---

 libavcodec/mpegvideo_dec.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index aab2a4655a..c5e42e8ab6 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -249,10 +249,12 @@ static void gray_frame(AVFrame *frame)
 {
 int h_chroma_shift, v_chroma_shift;
 
-av_pix_fmt_get_chroma_sub_sample(frame->format, &h_chroma_shift, 
&v_chroma_shift);
-
 for (int i = 0; i < frame->height; i++)
 memset(frame->data[0] + frame->linesize[0] * i, 0x80, frame->width);
+
+if (!frame->data[1])
+return;
+av_pix_fmt_get_chroma_sub_sample(frame->format, &h_chroma_shift, 
&v_chroma_shift);
 for (int i = 0; i < AV_CEIL_RSHIFT(frame->height, v_chroma_shift); i++) {
 memset(frame->data[1] + frame->linesize[1] * i,
0x80, AV_CEIL_RSHIFT(frame->width, h_chroma_shift));

___
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_dec: Don't memset twice

2023-10-03 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sat Sep 30 19:20:00 2023 +0200| [06388250d953e5cd47bb03c2d0e1599db6d9a79f] | 
committer: Andreas Rheinhardt

avcodec/mpegvideo_dec: Don't memset twice

This has been done for the luma plane of missing FLV1 and H263
references.
Also remove code duplication by reusing gray_frame(), which
has been renamed to color_frame() for this purpose.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=06388250d953e5cd47bb03c2d0e1599db6d9a79f
---

 libavcodec/mpegvideo_dec.c | 28 +---
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index c5e42e8ab6..f9fccff518 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -245,12 +245,12 @@ static int alloc_picture(MpegEncContext *s, Picture *pic)
 &s->linesize, &s->uvlinesize);
 }
 
-static void gray_frame(AVFrame *frame)
+static void color_frame(AVFrame *frame, int luma)
 {
 int h_chroma_shift, v_chroma_shift;
 
 for (int i = 0; i < frame->height; i++)
-memset(frame->data[0] + frame->linesize[0] * i, 0x80, frame->width);
+memset(frame->data[0] + frame->linesize[0] * i, luma, frame->width);
 
 if (!frame->data[1])
 return;
@@ -365,9 +365,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 if ((!s->last_picture_ptr || !s->last_picture_ptr->f->buf[0]) &&
 (s->pict_type != AV_PICTURE_TYPE_I)) {
-int h_chroma_shift, v_chroma_shift;
-av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
- &h_chroma_shift, &v_chroma_shift);
 if (s->pict_type == AV_PICTURE_TYPE_B && s->next_picture_ptr && 
s->next_picture_ptr->f->buf[0])
 av_log(avctx, AV_LOG_DEBUG,
"allocating dummy last picture for B frame\n");
@@ -393,23 +390,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 
 if (!avctx->hwaccel) {
-for (int i = 0; i < avctx->height; i++)
-memset(s->last_picture_ptr->f->data[0] + 
s->last_picture_ptr->f->linesize[0]*i,
-   0x80, avctx->width);
-if (s->last_picture_ptr->f->data[2]) {
-for (int i = 0; i < AV_CEIL_RSHIFT(avctx->height, 
v_chroma_shift); i++) {
-memset(s->last_picture_ptr->f->data[1] + 
s->last_picture_ptr->f->linesize[1]*i,
-0x80, AV_CEIL_RSHIFT(avctx->width, h_chroma_shift));
-memset(s->last_picture_ptr->f->data[2] + 
s->last_picture_ptr->f->linesize[2]*i,
-0x80, AV_CEIL_RSHIFT(avctx->width, h_chroma_shift));
-}
-}
-
-if (s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == 
AV_CODEC_ID_H263) {
-for (int i = 0; i < avctx->height; i++)
-memset(s->last_picture_ptr->f->data[0] + 
s->last_picture_ptr->f->linesize[0] * i,
-   16, avctx->width);
-}
+int luma_val = s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == 
AV_CODEC_ID_H263 ? 16 : 0x80;
+color_frame(s->last_picture_ptr->f, luma_val);
 }
 
 ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 0);
@@ -480,7 +462,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 
 if (s->avctx->debug & FF_DEBUG_NOMC)
-gray_frame(s->current_picture_ptr->f);
+color_frame(s->current_picture_ptr->f, 0x80);
 
 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] avcodec/h264_slice: Don't keep AVCodecContext props in sync manually

2023-10-03 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sat Sep 30 19:55:32 2023 +0200| [e1f3041b93cc8a382fd16d7a062edd154bdec2ea] | 
committer: Andreas Rheinhardt

avcodec/h264_slice: Don't keep AVCodecContext props in sync manually

It is already done generically in update_context_from_thread()
before this function is called.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e1f3041b93cc8a382fd16d7a062edd154bdec2ea
---

 libavcodec/h264_slice.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 5657327f0c..24f4690e79 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -404,10 +404,6 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
 memcpy(h->block_offset, h1->block_offset, sizeof(h->block_offset));
 }
 
-h->avctx->coded_height  = h1->avctx->coded_height;
-h->avctx->coded_width   = h1->avctx->coded_width;
-h->avctx->width = h1->avctx->width;
-h->avctx->height= h1->avctx->height;
 h->width_from_caller= h1->width_from_caller;
 h->height_from_caller   = h1->height_from_caller;
 h->coded_picture_number = h1->coded_picture_number;

___
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: avoid S-regs in RISC-V V uyvytoyuv422

2023-10-03 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Fri Sep 29 
22:36:16 2023 +0300| [e50f8e861ba1390e6ceab7bab591bd3bfa08ced8] | committer: 
Rémi Denis-Courmont

swscale/rgb2rgb: avoid S-regs in RISC-V V uyvytoyuv422

We can make do with callee-clobbered registers only now.
As an added bonus, this makes the code XLEN-independent.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e50f8e861ba1390e6ceab7bab591bd3bfa08ced8
---

 libswscale/riscv/rgb2rgb.c |  2 --
 libswscale/riscv/rgb2rgb_rvv.S | 10 ++
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/libswscale/riscv/rgb2rgb.c b/libswscale/riscv/rgb2rgb.c
index 162a4082b0..565f0b77f1 100644
--- a/libswscale/riscv/rgb2rgb.c
+++ b/libswscale/riscv/rgb2rgb.c
@@ -55,10 +55,8 @@ av_cold void rgb2rgb_init_riscv(void)
 shuffle_bytes_1230 = ff_shuffle_bytes_1230_rvv;
 shuffle_bytes_3012 = ff_shuffle_bytes_3012_rvv;
 interleaveBytes = ff_interleave_bytes_rvv;
-#if (__riscv_xlen == 64)
 uyvytoyuv422 = ff_uyvytoyuv422_rvv;
 yuyvtoyuv422 = ff_yuyvtoyuv422_rvv;
-#endif
 }
 #endif
 }
diff --git a/libswscale/riscv/rgb2rgb_rvv.S b/libswscale/riscv/rgb2rgb_rvv.S
index 3e7988ca01..3200370224 100644
--- a/libswscale/riscv/rgb2rgb_rvv.S
+++ b/libswscale/riscv/rgb2rgb_rvv.S
@@ -100,12 +100,9 @@ func ff_interleave_bytes_rvv, zve32x
 ret
 endfunc
 
-#if (__riscv_xlen == 64)
 .macro yuy2_to_i422p y_shift
-addisp, sp, -16
-sd  s0,   (sp)
 addia4, a4, 1
-lw  s0, 16(sp)
+lw  t6, (sp)
 sraia4, a4, 1 // pixel width -> chroma width
 1:
 mv  t4, a4
@@ -131,14 +128,12 @@ endfunc
 addt2, t5, t2
 bnez   t4, 2b
 
-add a3, a3, s0
+add a3, a3, t6
 add a0, a0, a6
 add a1, a1, a7
 add a2, a2, a7
 bneza5, 1b
 
-ld  s0,   (sp)
-addisp, sp, 16
 ret
 .endm
 
@@ -149,4 +144,3 @@ endfunc
 func ff_yuyvtoyuv422_rvv, zve32x
 yuy2_to_i422p 0
 endfunc
-#endif

___
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: rework RISC-V V uyvytoyuv422

2023-10-03 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Fri Sep 29 
22:36:16 2023 +0300| [be37a2e3644fc3db4c297b347fba687c3ff9cca1] | committer: 
Rémi Denis-Courmont

swscale/rgb2rgb: rework RISC-V V uyvytoyuv422

This avoids using relatively slow register strides.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=be37a2e3644fc3db4c297b347fba687c3ff9cca1
---

 libswscale/riscv/rgb2rgb_rvv.S | 24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/libswscale/riscv/rgb2rgb_rvv.S b/libswscale/riscv/rgb2rgb_rvv.S
index 008f098bfe..3e7988ca01 100644
--- a/libswscale/riscv/rgb2rgb_rvv.S
+++ b/libswscale/riscv/rgb2rgb_rvv.S
@@ -101,34 +101,33 @@ func ff_interleave_bytes_rvv, zve32x
 endfunc
 
 #if (__riscv_xlen == 64)
-.macro yuy2_to_i422p v_y0, v_y1, v_u, v_v
+.macro yuy2_to_i422p y_shift
 addisp, sp, -16
 sd  s0,   (sp)
-sd  s1,  8(sp)
 addia4, a4, 1
 lw  s0, 16(sp)
 sraia4, a4, 1 // pixel width -> chroma width
-li  s1, 2
 1:
 mv  t4, a4
 mv  t3, a3
 mv  t0, a0
-addit6, a0, 1
 mv  t1, a1
 mv  t2, a2
 addia5, a5, -1
 2:
 vsetvlit5, t4, e8, m1, ta, ma
+vlseg2e16.v v16, (t3)
 subt4, t4, t5
-vlseg4e8.v v8, (t3)
+vnsrl.wi   v24, v16, \y_shift // Y0
 sh2add t3, t5, t3
-vsse8.v\v_y0, (t0), s1
+vnsrl.wi   v25, v18, \y_shift // Y1
+vnsrl.wi   v28, v16, 8 - \y_shift // U
+vnsrl.wi   v30, v18, 8 - \y_shift // V
+vsseg2e8.v v24, (t0)
 sh1add t0, t5, t0
-vsse8.v\v_y1, (t6), s1
-sh1add t6, t5, t6
-vse8.v \v_u, (t1)
+vse8.v v28, (t1)
 addt1, t5, t1
-vse8.v \v_v, (t2)
+vse8.v v30, (t2)
 addt2, t5, t2
 bnez   t4, 2b
 
@@ -138,17 +137,16 @@ endfunc
 add a2, a2, a7
 bneza5, 1b
 
-ld  s1,  8(sp)
 ld  s0,   (sp)
 addisp, sp, 16
 ret
 .endm
 
 func ff_uyvytoyuv422_rvv, zve32x
-yuy2_to_i422p v9, v11, v8, v10
+yuy2_to_i422p 8
 endfunc
 
 func ff_yuyvtoyuv422_rvv, zve32x
-yuy2_to_i422p v8, v10, v9, v11
+yuy2_to_i422p 0
 endfunc
 #endif

___
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: unroll R-V V interleave_bytes

2023-10-03 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sat Sep 30 
12:03:37 2023 +0300| [d14130aea34de66e89fe1d50344835a017def72b] | committer: 
Rémi Denis-Courmont

swscale/rgb2rgb: unroll R-V V interleave_bytes

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d14130aea34de66e89fe1d50344835a017def72b
---

 libswscale/riscv/rgb2rgb_rvv.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswscale/riscv/rgb2rgb_rvv.S b/libswscale/riscv/rgb2rgb_rvv.S
index ff02eba9bf..56539690bc 100644
--- a/libswscale/riscv/rgb2rgb_rvv.S
+++ b/libswscale/riscv/rgb2rgb_rvv.S
@@ -82,11 +82,11 @@ func ff_interleave_bytes_rvv, zve32x
 mv  t3, a3
 addia4, a4, -1
 2:
-vsetvlit4, t3, e8, m1, ta, ma
+vsetvlit4, t3, e8, m4, ta, ma
 subt3, t3, t4
 vle8.v v8, (t0)
 addt0, t4, t0
-vle8.v v9, (t1)
+vle8.v v12, (t1)
 addt1, t4, t1
 vsseg2e8.v v8, (t2)
 sh1add t2, t4, t2

___
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] lavu/float_dsp: avoid reg-stride in R-V V reverse_fmul

2023-10-03 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sat Sep 30 
13:08:49 2023 +0300| [446b0090cbb66ee614dcf6ca79c78dc8eb7f0e37] | committer: 
Rémi Denis-Courmont

lavu/float_dsp: avoid reg-stride in R-V V reverse_fmul

This revectors the inner loop to reverse vectors element in vectors,
thus eliminating the negative register stride. Note that RVV does not
have a vector reverse instruction, so this uses a gather.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=446b0090cbb66ee614dcf6ca79c78dc8eb7f0e37
---

 libavutil/riscv/float_dsp_rvv.S | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/libavutil/riscv/float_dsp_rvv.S b/libavutil/riscv/float_dsp_rvv.S
index 7cfc890bc2..7e9e84d526 100644
--- a/libavutil/riscv/float_dsp_rvv.S
+++ b/libavutil/riscv/float_dsp_rvv.S
@@ -125,20 +125,25 @@ func ff_vector_fmul_add_rvv, zve32f
 ret
 endfunc
 
+// TODO factor vrsub, separate last iteration?
 // (a0) = (a1) * reverse(a2) [0..a3-1]
 func ff_vector_fmul_reverse_rvv, zve32f
+vsetvli  t0, zero, e16, m4, ta, ma
 sh2add   a2, a3, a2
-li   t2, -4 // byte stride
-addi a2, a2, -4
+vid.vv0
+vadd.vi  v0, v0, 1
 1:
-vsetvli  t0, a3, e32, m8, ta, ma
+vsetvli  t0, a3, e16, m4, ta, ma
 slli t1, t0, 2
-vle32.v  v16, (a1)
+vrsub.vx v4, v0, t0 // v4[i] = [VL-1, VL-2... 1, 0]
+sub  a2, a2, t1
+vsetvli  zero, zero, e32, m8, ta, ma
+vle32.v  v8, (a2)
 sub  a3, a3, t0
-vlse32.v v24, (a2), t2
+vle32.v  v16, (a1)
 add  a1, a1, t1
+vrgatherei16.vv v24, v8, v4 // v24 = reverse(v8)
 vfmul.vv v16, v16, v24
-sub  a2, a2, t1
 vse32.v  v16, (a0)
 add  a0, a0, t1
 bnez a3, 1b

___
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: unroll RISC-V V uyvytoyuv422

2023-10-03 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Fri Sep 29 
23:42:33 2023 +0300| [6269c4a4406bb355cbb2e209d92b4d719c963f24] | committer: 
Rémi Denis-Courmont

swscale/rgb2rgb: unroll RISC-V V uyvytoyuv422

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6269c4a4406bb355cbb2e209d92b4d719c963f24
---

 libswscale/riscv/rgb2rgb_rvv.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libswscale/riscv/rgb2rgb_rvv.S b/libswscale/riscv/rgb2rgb_rvv.S
index 3200370224..ff02eba9bf 100644
--- a/libswscale/riscv/rgb2rgb_rvv.S
+++ b/libswscale/riscv/rgb2rgb_rvv.S
@@ -112,14 +112,14 @@ endfunc
 mv  t2, a2
 addia5, a5, -1
 2:
-vsetvlit5, t4, e8, m1, ta, ma
+vsetvlit5, t4, e8, m2, ta, ma
 vlseg2e16.v v16, (t3)
 subt4, t4, t5
 vnsrl.wi   v24, v16, \y_shift // Y0
 sh2add t3, t5, t3
-vnsrl.wi   v25, v18, \y_shift // Y1
+vnsrl.wi   v26, v20, \y_shift // Y1
 vnsrl.wi   v28, v16, 8 - \y_shift // U
-vnsrl.wi   v30, v18, 8 - \y_shift // V
+vnsrl.wi   v30, v20, 8 - \y_shift // V
 vsseg2e8.v v24, (t0)
 sh1add t0, t5, t0
 vse8.v v28, (t1)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/concatdec: Check in/outpoint for overflow

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Sep 30 19:11:34 2023 +0200| [dedc78b4b5bdab869f3038798334639d617d2309] | 
committer: Michael Niedermayer

avformat/concatdec: Check in/outpoint for overflow

Fixes: signed integer overflow: 9154241445400 - -915424149454600 cannot 
be represented in type 'long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-4739147999084544

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dedc78b4b5bdab869f3038798334639d617d2309
---

 libavformat/concatdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 5d4f67d0ac..114b6c6564 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -667,7 +667,9 @@ static int concat_read_header(AVFormatContext *avf)
 else
 time = cat->files[i].start_time;
 if (cat->files[i].user_duration == AV_NOPTS_VALUE) {
-if (cat->files[i].inpoint == AV_NOPTS_VALUE || 
cat->files[i].outpoint == AV_NOPTS_VALUE)
+if (cat->files[i].inpoint == AV_NOPTS_VALUE || 
cat->files[i].outpoint == AV_NOPTS_VALUE ||
+cat->files[i].outpoint - (uint64_t)cat->files[i].inpoint != 
av_sat_sub64(cat->files[i].outpoint, cat->files[i].inpoint)
+)
 break;
 cat->files[i].user_duration = cat->files[i].outpoint - 
cat->files[i].inpoint;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/sbgdec: Check for period overflow

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Sep 30 21:18:14 2023 +0200| [a9137110eda130ba07a2a43bdedff2421efbb7a9] | 
committer: Michael Niedermayer

avformat/sbgdec: Check for period overflow

Fixes: signed integer overflow: 448124699617300 - -47785768200 
cannot be represented in type 'long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-5063670588899328

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a9137110eda130ba07a2a43bdedff2421efbb7a9
---

 libavformat/sbgdec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c
index c1995759a8..73b5be9007 100644
--- a/libavformat/sbgdec.c
+++ b/libavformat/sbgdec.c
@@ -1273,7 +1273,10 @@ static int generate_intervals(void *log, struct 
sbg_script *s, int sample_rate,
 /* SBaGen handles the time before and after the extremal events,
and the corresponding transitions, as if the sequence were cyclic
with a 24-hours period. */
-period = s->events[s->nb_events - 1].ts - s->events[0].ts;
+period = s->events[s->nb_events - 1].ts - (uint64_t)s->events[0].ts;
+if (period < 0)
+return AVERROR_INVALIDDATA;
+
 period = (period + (DAY_TS - 1)) / DAY_TS * DAY_TS;
 period = FFMAX(period, DAY_TS);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/westwood_vqa: Check chunk size

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Sep 22 20:08:52 2022 +0200| [5c0df3da0b7288a43a3b783117064cfcbc8037a5] | 
committer: Michael Niedermayer

avformat/westwood_vqa: Check chunk size

the type is also changed to int as it is interpreted as int in av_get_packet()

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 
'int'
Fixes: 
50993/clusterfuzz-testcase-minimized-ffmpeg_dem_WSVQA_fuzzer-6593408795279360
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_WSVQA_fuzzer-4613908817903616

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Anton Khirnov 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c0df3da0b7288a43a3b783117064cfcbc8037a5
---

 libavformat/westwood_vqa.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavformat/westwood_vqa.c b/libavformat/westwood_vqa.c
index e3d2e2668c..03b2d9e03c 100644
--- a/libavformat/westwood_vqa.c
+++ b/libavformat/westwood_vqa.c
@@ -178,13 +178,15 @@ static int wsvqa_read_packet(AVFormatContext *s,
 int ret = -1;
 uint8_t preamble[VQA_PREAMBLE_SIZE];
 uint32_t chunk_type;
-uint32_t chunk_size;
-int skip_byte;
+int chunk_size;
+unsigned skip_byte;
 
 while (avio_read(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) {
 chunk_type = AV_RB32(&preamble[0]);
 chunk_size = AV_RB32(&preamble[4]);
 
+if (chunk_size < 0)
+return AVERROR_INVALIDDATA;
 skip_byte = chunk_size & 0x01;
 
 if (chunk_type == VQFL_TAG) {
@@ -193,9 +195,9 @@ static int wsvqa_read_packet(AVFormatContext *s,
  * so it can be combined with the next VQFR packet. This way each 
packet
  * includes a whole frame as expected. */
 wsvqa->vqfl_chunk_pos = avio_tell(pb);
-wsvqa->vqfl_chunk_size = (int)(chunk_size);
-if (wsvqa->vqfl_chunk_size < 0 || wsvqa->vqfl_chunk_size > 3 * (1 
<< 20))
+if (chunk_size > 3 * (1 << 20))
 return AVERROR_INVALIDDATA;
+wsvqa->vqfl_chunk_size = chunk_size;
 /* We need a big seekback buffer because there can be SNxx, VIEW 
and ZBUF
  * chunks (<512 KiB total) in the stream before we read VQFR (<256 
KiB) and
  * seek back here. */

___
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/lcldec: Make PNG filter addressing match the code afterwards

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Jun  1 00:50:15 2023 +0200| [d11b8bd0c610c212d2a28767f94dc07a8ec473cf] | 
committer: Michael Niedermayer

avcodec/lcldec: Make PNG filter addressing match the code afterwards

Also update check accordingly

Fixes: tickets/10237/mszh_306_306_yuv422_nocompress.avi
Fixes: tickets/10237/mszh_306_306_yuv411_nocompress.avi

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d11b8bd0c610c212d2a28767f94dc07a8ec473cf
---

 libavcodec/lcldec.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index 11e28683ba..b4304618e4 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -231,16 +231,19 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 break;
 case COMP_MSZH_NOCOMP: {
 int bppx2;
+int aligned_width = width;
 switch (c->imgtype) {
 case IMGTYPE_YUV111:
 case IMGTYPE_RGB24:
 bppx2 = 6;
 break;
 case IMGTYPE_YUV422:
+aligned_width &= ~3;
 case IMGTYPE_YUV211:
 bppx2 = 4;
 break;
 case IMGTYPE_YUV411:
+aligned_width &= ~3;
 case IMGTYPE_YUV420:
 bppx2 = 3;
 break;
@@ -248,7 +251,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 bppx2 = 0; // will error out below
 break;
 }
-if (len < ((width * height * bppx2) >> 1))
+if (len < ((aligned_width * height * bppx2) >> 1))
 return AVERROR_INVALIDDATA;
 break;
 }
@@ -314,8 +317,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 }
 break;
 case IMGTYPE_YUV422:
+pixel_ptr = 0;
 for (row = 0; row < height; row++) {
-pixel_ptr = row * width * 2;
 yq = uq = vq =0;
 for (col = 0; col < width/4; col++) {
 encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
@@ -331,8 +334,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 }
 break;
 case IMGTYPE_YUV411:
+pixel_ptr = 0;
 for (row = 0; row < height; row++) {
-pixel_ptr = row * width / 2 * 3;
 yq = uq = vq =0;
 for (col = 0; col < width/4; col++) {
 encoded[pixel_ptr] = yq -= encoded[pixel_ptr];

___
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/flacdec: Fix overflow in "33bit" decorrelate

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Sep 19 01:20:47 2023 +0200| [35e6960a6be42ec27de6a3f070071ab7e2e3f27d] | 
committer: Michael Niedermayer

avcodec/flacdec: Fix overflow in "33bit" decorrelate

Fixes: signed integer overflow: 538976288 - -9223372036854775808 cannot be 
represented in type 'long'
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-6275845531238400

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=35e6960a6be42ec27de6a3f070071ab7e2e3f27d
---

 libavcodec/flacdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 524a046949..0569f019b3 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -706,10 +706,10 @@ static void decorrelate_33bps(int ch_mode, int32_t 
**decoded, int64_t *decoded_3
 int i;
 if (ch_mode == FLAC_CHMODE_LEFT_SIDE ) {
 for (i = 0; i < len; i++)
-   decoded[1][i] = decoded[0][i] - decoded_33bps[i];
+   decoded[1][i] = decoded[0][i] - (uint64_t)decoded_33bps[i];
 } else if (ch_mode == FLAC_CHMODE_RIGHT_SIDE ) {
 for (i = 0; i < len; i++)
-   decoded[0][i] = decoded[1][i] + decoded_33bps[i];
+   decoded[0][i] = decoded[1][i] + (uint64_t)decoded_33bps[i];
 } else if (ch_mode == FLAC_CHMODE_MID_SIDE ) {
 for (i = 0; i < len; i++) {
 uint64_t a = decoded[0][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] avformat/avs: Check if return code is representable

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Sep 20 01:32:56 2023 +0200| [52d666edec73c834c60811e330f86a7cf1d916da] | 
committer: Michael Niedermayer

avformat/avs: Check if return code is representable

Fixes: leak
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-6738814988320768

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=52d666edec73c834c60811e330f86a7cf1d916da
---

 libavformat/avs.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/avs.c b/libavformat/avs.c
index ab47980a11..19f0373157 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -140,6 +140,10 @@ static int avs_read_audio_packet(AVFormatContext * s, 
AVPacket * pkt)
 return 0;/* this indicate EOS */
 if (ret < 0)
 return ret;
+if (size != (int)size) {
+av_packet_unref(pkt);
+return AVERROR(EDOM);
+}
 
 pkt->stream_index = avs->st_audio->index;
 pkt->flags |= AV_PKT_FLAG_KEY;

___
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] tools/target_dec_fuzzer: Adjust threshold for MVHA

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Sep 14 00:08:46 2023 +0200| [6359b2ce038ef596f1e81b4c1238512d6d5df920] | 
committer: Michael Niedermayer

tools/target_dec_fuzzer: Adjust threshold for MVHA

Fixes: Timeout
Fixes: 
62120/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MVHA_fuzzer-5647877768347648

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6359b2ce038ef596f1e81b4c1238512d6d5df920
---

 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index d889774701..3ee4094883 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -261,6 +261,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_MSZH:maxpixels  /= 128;   break;
 case AV_CODEC_ID_MTS2:maxpixels  /= 4096;  break;
 case AV_CODEC_ID_MVC2:maxpixels  /= 128;   break;
+case AV_CODEC_ID_MVHA:maxpixels  /= 16384; break;
 case AV_CODEC_ID_MVDV:maxpixels  /= 1024;  break;
 case AV_CODEC_ID_MWSC:maxpixels  /= 256;   break;
 case AV_CODEC_ID_MXPEG:   maxpixels  /= 128;   break;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/aacdec_template: Better avoidance of signed integer overflow in imdct_and_windowing_eld()

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Sep 14 01:21:29 2023 +0200| [7f4fed52165cbc1b2fcc9663fc053516ae77c760] | 
committer: Michael Niedermayer

avcodec/aacdec_template: Better avoidance of signed integer overflow in 
imdct_and_windowing_eld()

Fixes: 
62171/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5644657180409856
Fixes: signed integer overflow: 2 * 1079352273 cannot be represented in type 
'int'

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7f4fed52165cbc1b2fcc9663fc053516ae77c760
---

 libavcodec/aacdec_template.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 51a4cb2b66..954399f86b 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -2856,8 +2856,8 @@ static void imdct_and_windowing_eld(AACContext *ac, 
SingleChannelElement *sce)
 ac->mdct512_fn(ac->mdct512, buf, in, sizeof(INTFLOAT));
 
 for (i = 0; i < n; i+=2) {
-buf[i + 0] = -(int)(USE_FIXED + 1U)*buf[i + 0];
-buf[i + 1] =  (int)(USE_FIXED + 1U)*buf[i + 1];
+buf[i + 0] = -(UINTFLOAT)(USE_FIXED + 1)*buf[i + 0];
+buf[i + 1] =  (UINTFLOAT)(USE_FIXED + 1)*buf[i + 1];
 }
 // Like with the regular IMDCT at this point we still have the middle half
 // of a transform but with even symmetry on the left and odd symmetry on

___
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/flacdec: Fix integer overflow in "33bit" DECODER_SUBFRAME_FIXED_WIDE()

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Sep 19 01:24:37 2023 +0200| [112a077d06585e5cf5efcff76c15a1760b0bb455] | 
committer: Michael Niedermayer

avcodec/flacdec: Fix integer overflow in "33bit" DECODER_SUBFRAME_FIXED_WIDE()

Fixes: signed integer overflow: 4 * 2307917133220067266 cannot be represented 
in type 'long'
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-6307690022043648

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=112a077d06585e5cf5efcff76c15a1760b0bb455
---

 libavcodec/flacdec.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 0569f019b3..ed2de14d0a 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -366,19 +366,19 @@ static int decode_subframe_fixed(FLACContext *s, int32_t 
*decoded,
 break;\
 case 1:   \
 for (int i = pred_order; i < blocksize; i++)  \
-decoded[i] = (int64_t)residual[i] + (int64_t)decoded[i-1];\
+decoded[i] = (uint64_t)residual[i] + (uint64_t)decoded[i-1];\
 break;\
 case 2:   \
 for (int i = pred_order; i < blocksize; i++)  \
-decoded[i] = (int64_t)residual[i] + 2*(int64_t)decoded[i-1] - 
(int64_t)decoded[i-2];  \
+decoded[i] = (uint64_t)residual[i] + 2*(uint64_t)decoded[i-1] - 
(uint64_t)decoded[i-2];  \
 break;\
 case 3:   \
 for (int i = pred_order; i < blocksize; i++)  \
-decoded[i] = (int64_t)residual[i] + 3*(int64_t)decoded[i-1] - 
3*(int64_t)decoded[i-2] + (int64_t)decoded[i-3];   \
+decoded[i] = (uint64_t)residual[i] + 3*(uint64_t)decoded[i-1] - 
3*(uint64_t)decoded[i-2] + (uint64_t)decoded[i-3];   \
 break;\
 case 4:   \
 for (int i = pred_order; i < blocksize; i++)  \
-decoded[i] = (int64_t)residual[i] + 4*(int64_t)decoded[i-1] - 
6*(int64_t)decoded[i-2] + 4*(int64_t)decoded[i-3] - (int64_t)decoded[i-4];   \
+decoded[i] = (uint64_t)residual[i] + 4*(uint64_t)decoded[i-1] - 
6*(uint64_t)decoded[i-2] + 4*(uint64_t)decoded[i-3] - (uint64_t)decoded[i-4];   
\
 break;\
 default:  \
 av_log(s->avctx, AV_LOG_ERROR, "illegal pred order %d\n", pred_order); 
  \

___
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/utvideodec: move allocation to the end of init

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Sep 20 01:07:58 2023 +0200| [53948d6200479d25cf0d82c1e7f7cf50eebdc6ff] | 
committer: Michael Niedermayer

avcodec/utvideodec: move allocation to the end of init

Fixes: mem leak
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_UTVIDEO_fuzzer-804266926080

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=53948d6200479d25cf0d82c1e7f7cf50eebdc6ff
---

 libavcodec/utvideodec.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 16f51e4b47..ce5d00f7af 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -1012,10 +1012,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
 return AVERROR_INVALIDDATA;
 }
 
-c->buffer = av_calloc(avctx->width + 8, c->pro?2:1);
-if (!c->buffer)
-return AVERROR(ENOMEM);
-
 av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &h_shift, &v_shift);
 if ((avctx->width  & ((1width + 8, c->pro?2:1);
+if (!c->buffer)
+return AVERROR(ENOMEM);
+
 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] avcodec/wavarc: Fix integer overflwo in do_stereo()

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Sep 21 00:13:27 2023 +0200| [f3c986200d7f4ec934c480b09aa8a13554da032d] | 
committer: Michael Niedermayer

avcodec/wavarc: Fix integer overflwo in do_stereo()

Fixes: signed integer overflow: 148676193 - -2006512262 cannot be represented 
in type 'int'
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-5963163952349184

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3c986200d7f4ec934c480b09aa8a13554da032d
---

 libavcodec/wavarc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wavarc.c b/libavcodec/wavarc.c
index 2e32b46ebd..6941ba9ab5 100644
--- a/libavcodec/wavarc.c
+++ b/libavcodec/wavarc.c
@@ -154,11 +154,11 @@ static void do_stereo(WavArcContext *s, int ch, int 
correlated, int len)
 } else {
 if (correlated) {
 for (int n = 0; n < nb_samples; n++)
-s->samples[1][n + len] += s->samples[0][n + len];
+s->samples[1][n + len] += (unsigned)s->samples[0][n + len];
 }
 for (int n = 0; n < len; n++) {
 s->pred[0][n] = s->samples[1][nb_samples + n];
-s->pred[1][n] = s->pred[0][n] - s->samples[0][nb_samples + n];
+s->pred[1][n] = s->pred[0][n] - (unsigned)s->samples[0][nb_samples 
+ 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/wavarc: Allocate AV_INPUT_BUFFER_PADDING_SIZE

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Sep 21 00:29:24 2023 +0200| [dbcf285abdc7921b065491862be048bdd0c9289d] | 
committer: Michael Niedermayer

avcodec/wavarc: Allocate AV_INPUT_BUFFER_PADDING_SIZE

Fixes: overread
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-5963163952349184
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6048030137909248

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dbcf285abdc7921b065491862be048bdd0c9289d
---

 libavcodec/wavarc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/wavarc.c b/libavcodec/wavarc.c
index 6941ba9ab5..d12b826852 100644
--- a/libavcodec/wavarc.c
+++ b/libavcodec/wavarc.c
@@ -111,7 +111,7 @@ static av_cold int wavarc_init(AVCodecContext *avctx)
 }
 
 s->max_framesize = s->nb_samples * 16;
-s->bitstream = av_calloc(s->max_framesize, sizeof(*s->bitstream));
+s->bitstream = av_calloc(s->max_framesize + AV_INPUT_BUFFER_PADDING_SIZE, 
sizeof(*s->bitstream));
 if (!s->bitstream)
 return AVERROR(ENOMEM);
 

___
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] avutil/tx_template: Fix some signed integer overflows in DECL_FFT5()

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri 
Sep 15 00:32:19 2023 +0200| [c42a89309ae5e5bf856a6a28f9294562a8b89c48] | 
committer: Michael Niedermayer

avutil/tx_template: Fix some signed integer overflows in DECL_FFT5()

Fixes: signed integer overflow: -1364715454 + -1468954671 cannot be represented 
in type 'int'
Fixes: 
62093/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5538774254485504

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c42a89309ae5e5bf856a6a28f9294562a8b89c48
---

 libavutil/tx_template.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavutil/tx_template.c b/libavutil/tx_template.c
index 6e3b3dad33..8dc3d2519c 100644
--- a/libavutil/tx_template.c
+++ b/libavutil/tx_template.c
@@ -222,8 +222,8 @@ static av_always_inline void NAME(TXComplex *out, TXComplex 
*in,\
 BF(t[3].im, t[2].re, in[2].re, in[3].re);   \
 BF(t[3].re, t[2].im, in[2].im, in[3].im);   \
 \
-out[D0*stride].re = dc.re + t[0].re + t[2].re;  \
-out[D0*stride].im = dc.im + t[0].im + t[2].im;  \
+out[D0*stride].re = dc.re + (TXUSample)t[0].re + t[2].re;\
+out[D0*stride].im = dc.im + (TXUSample)t[0].im + t[2].im;\
 \
 SMUL(t[4].re, t[0].re, tab[0], tab[2], t[2].re, t[0].re);   \
 SMUL(t[4].im, t[0].im, tab[0], tab[2], t[2].im, t[0].im);   \
@@ -235,14 +235,14 @@ static av_always_inline void NAME(TXComplex *out, 
TXComplex *in,\
 BF(z0[2].re, z0[1].re, t[4].re, t[5].re);   \
 BF(z0[2].im, z0[1].im, t[4].im, t[5].im);   \
 \
-out[D1*stride].re = dc.re + z0[3].re;   \
-out[D1*stride].im = dc.im + z0[0].im;   \
-out[D2*stride].re = dc.re + z0[2].re;   \
-out[D2*stride].im = dc.im + z0[1].im;   \
-out[D3*stride].re = dc.re + z0[1].re;   \
-out[D3*stride].im = dc.im + z0[2].im;   \
-out[D4*stride].re = dc.re + z0[0].re;   \
-out[D4*stride].im = dc.im + z0[3].im;   \
+out[D1*stride].re = dc.re + (TXUSample)z0[3].re; \
+out[D1*stride].im = dc.im + (TXUSample)z0[0].im; \
+out[D2*stride].re = dc.re + (TXUSample)z0[2].re; \
+out[D2*stride].im = dc.im + (TXUSample)z0[1].im; \
+out[D3*stride].re = dc.re + (TXUSample)z0[1].re; \
+out[D3*stride].im = dc.im + (TXUSample)z0[2].im; \
+out[D4*stride].re = dc.re + (TXUSample)z0[0].re; \
+out[D4*stride].im = dc.im + (TXUSample)z0[3].im; \
 }
 
 DECL_FFT5(fft5, 0,  1,  2,  3,  4)

___
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] tools/target_dec_fuzzer: Adjust wmapro threshold

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Sep 16 22:58:07 2023 +0200| [bb9f8a1cb7d7b5e3742fe2212c144efea258f3d0] | 
committer: Michael Niedermayer

tools/target_dec_fuzzer: Adjust wmapro threshold

Fixes: Timeout
Fixes: 
62266/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAPRO_fuzzer-5125460729921536

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bb9f8a1cb7d7b5e3742fe2212c144efea258f3d0
---

 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 3ee4094883..798fc0b3f2 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -310,6 +310,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_WMV3:maxpixels  /= 1024;  break;
 case AV_CODEC_ID_WS_VQA:  maxpixels  /= 16384; break;
 case AV_CODEC_ID_WMALOSSLESS: maxsamples /= 1024;  break;
+case AV_CODEC_ID_WMAPRO:  maxsamples /= 16384; break;
 case AV_CODEC_ID_YLC: maxpixels  /= 1024;  break;
 case AV_CODEC_ID_ZEROCODEC:   maxpixels  /= 128;   break;
 case AV_CODEC_ID_ZLIB:maxpixels  /= 4096;  break;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/escape124: Do not return random numbers

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Sep 17 00:21:52 2023 +0200| [fe6d46490f5ea9155fe0601b6246960ae17317fc] | 
committer: Michael Niedermayer

avcodec/escape124: Do not return random numbers

Fixes: out of array access
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ESCAPE124_fuzzer-6035022714634240
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ESCAPE124_fuzzer-6422176201572352

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fe6d46490f5ea9155fe0601b6246960ae17317fc
---

 libavcodec/escape124.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index cd62f8d1f0..357320ef94 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -234,7 +234,7 @@ static int escape124_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 if ((ret = av_frame_ref(frame, s->frame)) < 0)
 return ret;
 
-return frame_size;
+return 0;
 }
 
 for (i = 0; i < 3; i++) {
@@ -367,7 +367,7 @@ static int escape124_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 
 *got_frame = 1;
 
-return frame_size;
+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] avcodec/wavarc: Check k in decode_5elp()

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Sep 21 01:10:11 2023 +0200| [9cef555bc52e26e674b0c3988bb20a08315e76e1] | 
committer: Michael Niedermayer

avcodec/wavarc: Check k in decode_5elp()

regression since 18b2ecc24778140c2bc798ed64842dc8feb6dc3a

Fixes: assertion failure
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6280165808013312

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9cef555bc52e26e674b0c3988bb20a08315e76e1
---

 libavcodec/wavarc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/wavarc.c b/libavcodec/wavarc.c
index d12b826852..09ed4d473a 100644
--- a/libavcodec/wavarc.c
+++ b/libavcodec/wavarc.c
@@ -539,6 +539,8 @@ static int decode_5elp(AVCodecContext *avctx,
 if (block_type >= 0 && block_type <= 7) {
 k = 1 + (avctx->sample_fmt == AV_SAMPLE_FMT_S16P);
 k = get_urice(gb, k) + 1;
+if (k >= 32)
+return AVERROR_INVALIDDATA;
 }
 
 if (block_type <=  2 || block_type ==  6 || block_type == 13 ||

___
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/apedec: Fix an integer overflow in predictor_update_filter()

2023-10-03 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Sep 16 23:36:29 2023 +0200| [515c0247a3062ca4639e457c81d2f58c504e9e8f] | 
committer: Michael Niedermayer

avcodec/apedec: Fix an integer overflow in predictor_update_filter()

Fixes: signed integer overflow: -2147483506 + -801380 cannot be represented in 
type 'int'
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-6578985923117056

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=515c0247a3062ca4639e457c81d2f58c504e9e8f
---

 libavcodec/apedec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 62cb397490..8bfbb75b41 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1220,7 +1220,7 @@ static av_always_inline int 
predictor_update_filter(APEPredictor64 *p,
 if (interim_mode < 1) {
 predictionA = (int32_t)predictionA;
 predictionB = (int32_t)predictionB;
-p->lastA[filter] = decoded + ((int32_t)(predictionA + (predictionB >> 
1)) >> 10);
+p->lastA[filter] = (int32_t)(decoded + 
(unsigned)((int32_t)(predictionA + (predictionB >> 1)) >> 10));
 } else {
 p->lastA[filter] = decoded + ((int64_t)((uint64_t)predictionA + 
(predictionB >> 1)) >> 10);
 }

___
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] lavu/float_dsp: avoid reg-stride in R-V V fmul_window

2023-10-03 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Fri Sep 29 
20:31:36 2023 +0300| [9240035c0e0c81d59a8175e84ca8b2b8595ee343] | committer: 
Rémi Denis-Courmont

lavu/float_dsp: avoid reg-stride in R-V V fmul_window

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9240035c0e0c81d59a8175e84ca8b2b8595ee343
---

 libavutil/riscv/float_dsp_rvv.S | 45 +++--
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/libavutil/riscv/float_dsp_rvv.S b/libavutil/riscv/float_dsp_rvv.S
index 7e9e84d526..91b70bf148 100644
--- a/libavutil/riscv/float_dsp_rvv.S
+++ b/libavutil/riscv/float_dsp_rvv.S
@@ -75,32 +75,37 @@ endfunc
 
 func ff_vector_fmul_window_rvv, zve32f
 // a0: dst, a1: src0, a2: src1, a3: window, a4: length
-addi   t0, a4, -1
-addt1, t0, a4
-sh2add a2, t0, a2
-sh2add t0, t1, a0
-sh2add t3, t1, a3
-li t1, -4 // byte stride
+vsetvlit0, zero, e16, m4, ta, ma
+sh2add a2, a4, a2
+vid.v  v0
+sh3add t3, a4, a3
+vadd.viv0, v0, 1
+sh3add t0, a4, a0
 1:
-vsetvlit2, a4, e32, m4, ta, ma
-vle32.vv16, (a1)
+vsetvlit2, a4, e16, m2, ta, ma
 slli   t4, t2, 2
-vlse32.v   v20, (a2), t1
+vrsub.vx   v2, v0, t2
+subt3, t3, t4
+vsetvlizero, zero, e32, m4, ta, ma
+suba2, a2, t4
+vle32.vv8, (t3)
+subt0, t0, t4
+vle32.vv4, (a2)
 suba4, a4, t2
-vle32.vv24, (a3)
+vrgatherei16.vv v28, v8, v2
+vle32.vv16, (a1)
 adda1, a1, t4
-vlse32.v   v28, (t3), t1
-suba2, a2, t4
-vfmul.vv   v0, v16, v28
+vrgatherei16.vv v20, v4, v2
+vle32.vv24, (a3)
 adda3, a3, t4
-vfmul.vv   v8, v16, v24
-subt3, t3, t4
-vfnmsac.vv v0, v20, v24
-vfmacc.vv  v8, v20, v28
-vse32.vv0, (a0)
+vfmul.vv   v12, v16, v28
+vfmul.vv   v16, v16, v24
+vfnmsac.vv v12, v20, v24
+vfmacc.vv  v16, v20, v28
+vrgatherei16.vv v8, v16, v2
+vse32.vv12, (a0)
 adda0, a0, t4
-vsse32.v   v8, (t0), t1
-subt0, t0, t4
+vse32.vv8, (t0)
 bnez   a4, 1b
 
 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".