23 Commits

Author SHA1 Message Date
Evan Shrubsole
d9dd939d66 Move safe_minmax.h to webrtc namespace
Bug: webrtc:42232595
Change-Id: Ia3d96dfe1b1c25b6cc21bbd99d24ded7461924cd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378061
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43942}
2025-02-20 05:12:52 -08:00
Emil Vardar
ba0d9713ba Prevent missing corruption header because of floating point errors.
Sometimes the blurred value gets to be a little above 255 because of
floating point errors. This prevents the header from being sent, losing
1 second of information. This can easily be prevented with the changes
in this CL.

Bug: webrtc:358039777
Change-Id: Ibad1c8f41272260e28fe58557c623e52a6af8294
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376740
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Emil Vardar (xWF) <vardar@google.com>
Cr-Commit-Position: refs/heads/main@{#43906}
2025-02-17 10:21:11 -08:00
Erik Språng
5fc7489aa0 Fix corruption score not being calculated on higher spatial layers.
This is a re-upload of
https://webrtc-review.googlesource.com/c/src/+/369020

Bug: webrtc:358039777
Change-Id: I7456940965084d0ce55b29b3b9bc98162cfff948
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/369862
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43478}
2024-12-02 14:46:45 +00:00
Erik Språng
e5f6f1fab4 Add optional corruption filter settings to EncodedImage.
This is a prerequisite for enabling implementation-specific filter
settings for automatic corruption detection.

Bug: webrtc:358039777
Change-Id: I363c592aa35164f690dd4ad1204e90afc0277d8b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/368940
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43443}
2024-11-22 12:10:31 +00:00
Erik Språng
9aeed0c5f4 Avoid potential deadlock due to queue in corruption detection.
In particular, some platforms have a limited pool of frames in the
capturer stack, so we need to avoid stashing raw frames in the frame
instrumentation generator that may be dropped by limiting the size of
the queue and avoid putting anything in there until we know we will
send it to the encoder.

Bug: webrtc:358039777
Change-Id: I054ae53dd5e6ac6a22da39c5049f47788561e77a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/368641
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43432}
2024-11-20 22:50:41 +00:00
Emil Vardar
4c171e84c3 Prevent upscaling when calculating sample values.
Bug: webrtc:358039777
Change-Id: I33edc12f312d0d37eac0c39a913313a1aa6f1de5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/366942
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Emil Vardar (xWF) <vardar@google.com>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43394}
2024-11-13 14:57:14 +00:00
Emil Vardar
a5676c17b3 Change scale factor to 0.5
The tests shows that using a scale factor around 0.5 gives the best precision and F1 score.

Bug: webrtc:358039777
Change-Id: I22557eb9e6318ecaa726b56d3ccb2125fdf65f7e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/367681
Reviewed-by: Fanny Linderborg <linderborg@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Emil Vardar (xWF) <vardar@google.com>
Cr-Commit-Position: refs/heads/main@{#43366}
2024-11-07 10:32:41 +00:00
Emil Vardar
346cf7c4e5 Add support for frame pair corruption score calculation.
With this changes users can calculate the corruption score on two frames e.g. in test scenarios where one has access to the input and output file.

Bug: webrtc:358039777
Change-Id: Id864010115aa040284ec09b42d0279ccb45960b9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364161
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Fanny Linderborg <linderborg@webrtc.org>
Commit-Queue: Emil Vardar (xWF) <vardar@google.com>
Cr-Commit-Position: refs/heads/main@{#43222}
2024-10-11 09:28:56 +00:00
Fanny Linderborg
b63c05d1cc Remove unused misspelled function
Bug: webrtc:358039777
Change-Id: I5573a8ab40a42663cfc2d24576b90e1100972e7b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363942
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43165}
2024-10-03 13:55:44 +00:00
Fanny Linderborg
55398a7612 Add helper for comparing FrameInstrumentationData with a VideoFrame
Bug: webrtc:358039777
Change-Id: Ibe597160658dbc66aba427f4e30dade4d6fe56e2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363701
Auto-Submit: Fanny Linderborg <linderborg@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43134}
2024-10-02 05:38:48 +00:00
Fanny Linderborg
052cc9d92a Fix misspelled function
Bug: webrtc:358039777
Change-Id: I640256a33c6a2f998042555607e053aa0b09e626
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363803
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43091}
2024-09-27 07:19:52 +00:00
Fanny Linderborg
a61a25a0b1 Correct format for TODO comments
Bug: webrtc:358039777
Change-Id: Iad5f8867bcbca883b16617819ea24a965160d23e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363802
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43089}
2024-09-27 07:17:40 +00:00
Emil Vardar
965f134b2b Number of samples need to be more than 0 when calculating corruption score.
Bug: webrtc:358039777
Change-Id: I28597185731ba3d9485103f7c24813f2bdd7110a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363120
Reviewed-by: Fanny Linderborg <linderborg@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Emil Vardar (xWF) <vardar@google.com>
Cr-Commit-Position: refs/heads/main@{#43075}
2024-09-24 13:09:44 +00:00
Fanny Linderborg
5a294aeea3 Allow the standard deviation for GetSampleValuesForFrame to be 0
Setting the standard deviation to 0 is valid and should be interpreted
as directly using the sample value at the coordinates without weighting.
This is made explicit in the documentation for the Corruption Detection
extension:
http://www.webrtc.org/experiments/rtp-hdrext/corruption-detection

Also, change stddev to std_dev in halton_frame_sampler files.

Bug: webrtc:358039777
Change-Id: Id5aa4110194f7f2b2fe9914c94304c90afd64198
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363300
Auto-Submit: Fanny Linderborg <linderborg@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43070}
2024-09-23 15:17:58 +00:00
Emil Vardar
4a201de10d Add support for corruption classification.
This class calculates the corruption score based on the given samples from two frames.

Bug: webrtc:358039777
Change-Id: Ib036f91ec16609e827137cc35d342a2c49764737
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/362801
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Fanny Linderborg <linderborg@webrtc.org>
Commit-Queue: Emil Vardar (xWF) <vardar@google.com>
Cr-Commit-Position: refs/heads/main@{#43043}
2024-09-18 13:38:41 +00:00
Fanny Linderborg
f045dbd67c Modify sequence index on key frames
For key frames: increase the sequence index until the last 7 bits are
all zeroes. If this results in an overflow, wraparound to 0.

Also:
* Allow setting and getting the sequence index
* Allow getting LayerId

Bug: webrtc:358039777
Change-Id: Ibe16689a3d1eb5706d4fce5c9220770046f26896
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/362540
Reviewed-by: Erik Språng <sprang@webrtc.org>
Auto-Submit: Fanny Linderborg <linderborg@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43042}
2024-09-18 09:29:47 +00:00
Fanny Linderborg
6e072e6bfb Rename is_key_frame to communicate_upper_bits in FrameInstrumentation*Data
This is to make it clear that this field indicate whether the upper bits
of the sequence number should be communicated. However, the current
implementation only sets the field if it is a key frame.

Bug: webrtc:358039777
Change-Id: Ic2c8b6d91499e4e5cf25b8ce9591d326d7044fb0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361402
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42924}
2024-09-03 10:42:18 +00:00
Fanny Linderborg
5eb8588a65 Move FrameInstrumentation*Data structs to common_video
This enables usage in, e.g., `modules/rtp_rtcp`.

R=sprang@webrtc.org

Bug: webrtc:358039777
Change-Id: I0f8aafb75938d07f338bbf7acc4ff7c15a8b0baa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361285
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42920}
2024-09-03 07:20:06 +00:00
Florent Castelli
8037fc6ffa Migrate absl::optional to std::optional
Bug: webrtc:342905193
No-Try: True
Change-Id: Icc968be43b8830038ea9a1f5f604307220457807
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361021
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42911}
2024-09-02 12:16:47 +00:00
Fanny Linderborg
a6186b2485 Add helper that generate filter data given a captured and an encoded frame
R=sprang@webrtc.org

Bug: b/358039777
Change-Id: I48400db23b836d45f03cfa151aa1a9f1b8f00b2a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/359940
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42807}
2024-08-19 13:04:30 +00:00
Fanny Linderborg
668e905513 Add support for determining which pixels to sample
Bug: b/358039777
Change-Id: If08f9fa46df4071674605a9feb95b73e71e9a291
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/359245
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42800}
2024-08-19 09:43:31 +00:00
Fanny Linderborg
4fffeabba3 Add generic mapping functions for automatic corruption detection
The functions will be used to map a frame's QP to its optimal standard
deviation for the Gaussian kernel for the filter applied in the
automatic corruption detection algorithm.

Bug: b/358039777
Change-Id: Idb3b8cfdbd4a405151c660df87205e3949f9b085
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/359380
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42777}
2024-08-14 07:31:02 +00:00
Fanny Linderborg
c2a82417e9 Add support for the Halton sequence
Bug: b/358039777
Change-Id: Id191d584e22cf82384a5d16ed355f41c0bb32b7b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358981
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42764}
2024-08-12 15:13:34 +00:00