chromium/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter.h"

#include <functional>
#include <memory>
#include <queue>
#include <string>
#include <tuple>
#include <unordered_set>
#include <utility>
#include <vector>

#include "base/command_line.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/ranges/algorithm.h"
#include "base/values.h"
#include "ui/events/ozone/evdev/event_device_info.h"
#include "ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_model.h"
#include "ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_util.h"
#include "ui/events/ozone/features.h"

namespace ui {
namespace {
// Returns the Euclidean distance between two points.
float EuclideanDistance(const gfx::PointF& a, const gfx::PointF& b) {}

bool IsEarlyStageSample(
    const PalmFilterStroke& stroke,
    const NeuralStylusPalmDetectionFilterModelConfig& config) {}

bool HasDecidedStroke(
    const PalmFilterStroke& stroke,
    const NeuralStylusPalmDetectionFilterModelConfig& config) {}

bool IsVeryShortStroke(
    const PalmFilterStroke& stroke,
    const NeuralStylusPalmDetectionFilterModelConfig& config) {}

/**
 * The provided stroke must be a neighbor stroke rather than a stroke currently
 * being evaluated. The parameter 'neighbor_min_sample_count' might be different
 * from the config, depending on the specific usage in the caller.
 */
bool HasInsufficientDataAsNeighbor(
    const PalmFilterStroke& neighbor_stroke,
    size_t neighbor_min_sample_count,
    const NeuralStylusPalmDetectionFilterModelConfig& config) {}

}  // namespace

NeuralStylusPalmDetectionFilter::NeuralStylusPalmDetectionFilter(
    const EventDeviceInfo& devinfo,
    std::unique_ptr<NeuralStylusPalmDetectionFilterModel> palm_model,
    SharedPalmDetectionFilterState* shared_palm_state)
    :{}

NeuralStylusPalmDetectionFilter::~NeuralStylusPalmDetectionFilter() {}

void NeuralStylusPalmDetectionFilter::FindBiggestNeighborsWithin(
    int neighbor_count,
    unsigned long neighbor_min_sample_count,
    float max_distance,
    const PalmFilterStroke& stroke,
    std::vector<std::pair<float, int>>* biggest_strokes) const {}

void NeuralStylusPalmDetectionFilter::FindNearestNeighborsWithin(
    int neighbor_count,
    unsigned long neighbor_min_sample_count,
    float max_distance,
    const PalmFilterStroke& stroke,
    std::vector<std::pair<float, int>>* nearest_strokes) const {}

void NeuralStylusPalmDetectionFilter::Filter(
    const std::vector<InProgressTouchEvdev>& touches,
    base::TimeTicks time,
    std::bitset<kNumTouchEvdevSlots>* slots_to_hold,
    std::bitset<kNumTouchEvdevSlots>* slots_to_suppress) {}

bool NeuralStylusPalmDetectionFilter::ShouldDecideStroke(
    const PalmFilterStroke& stroke) const {}

bool NeuralStylusPalmDetectionFilter::IsHeuristicPalmStroke(
    const PalmFilterStroke& stroke) const {}

bool NeuralStylusPalmDetectionFilter::DetectSpuriousStroke(
    const std::vector<float>& features,
    float threshold) const {}

std::vector<float> NeuralStylusPalmDetectionFilter::ExtractFeatures(
    int tracking_id) const {}

void NeuralStylusPalmDetectionFilter::AppendFeatures(
    const PalmFilterStroke& stroke,
    std::vector<float>* features) const {}

/**
 * The flow here is similar to 'AppendFeatures' above, but we rely on the
 * timing of the samples rather than on the explicit number / position of
 * samples.
 */
void NeuralStylusPalmDetectionFilter::AppendResampledFeatures(
    const PalmFilterStroke& stroke,
    std::vector<float>* features) const {}

void NeuralStylusPalmDetectionFilter::AppendFeaturesAsNeighbor(
    const PalmFilterStroke& stroke,
    float distance,
    std::vector<float>* features) const {}

const int NeuralStylusPalmDetectionFilter::kExtraFeaturesForNeighbor =;
const int NeuralStylusPalmDetectionFilter::kFeaturesPerSample =;

const char NeuralStylusPalmDetectionFilter::kFilterName[] =;
std::string NeuralStylusPalmDetectionFilter::FilterNameForTesting() const {}

bool NeuralStylusPalmDetectionFilter::
    CompatibleWithNeuralStylusPalmDetectionFilter(
        const EventDeviceInfo& devinfo) {}

bool NeuralStylusPalmDetectionFilter::
    CompatibleWithNeuralStylusPalmDetectionFilter(
        const EventDeviceInfo& devinfo,
        const std::string& ozone_params_switch_string) {}

void NeuralStylusPalmDetectionFilter::EraseOldStrokes(base::TimeTicks time) {}
}  // namespace ui