chromium/chrome/browser/ui/views/media_preview/camera_preview/video_format_comparison.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/views/media_preview/camera_preview/video_format_comparison.h"

#include <algorithm>

#include "media/capture/video_capture_types.h"
#include "ui/gfx/geometry/size.h"

namespace video_format_comparison {

namespace {

constexpr float kAspectRatioFitnessWeight =;
constexpr float kWidthFitnessWeight =;
constexpr float kFrameRateFitnessWeight =;
constexpr float kPunishmentDiscount =;

// Return fitness value for aspect ratio in the range [0, 1].
// The closer the aspect ratio value to `kDefaultAspectRatio`, the higher the
// fitness value returned.
float GetAspectRatioFitness(const media::VideoCaptureFormat& format) {}

// Return fitness value in the range [0, 1].
// The closer `value` is to `target`, the higher the fitness value returned. But
// we still favor values that are above `target` rather than values that are
// below it. For example, a `value of 60` has higher fitness than a `value of
// 24` when `target is 30`.
float GetFitnessValue(const float value, const float target) {}

// Return the format fitness value. The higher the value returned the more fit
// `format` is. Lowest value is 0.
float GetFormatFitness(const media::VideoCaptureFormat& format,
                       const int view_width,
                       const float target_frame_rate) {}

}  // namespace

float GetFrameAspectRatio(const gfx::Size& frame_size) {}

media::VideoCaptureFormat GetClosestVideoFormat(
    const std::vector<media::VideoCaptureFormat>& formats,
    const int view_width,
    const float target_frame_rate) {}

}  // namespace video_format_comparison