/*
 * Copyright 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <gtest/gtest.h>
#include <vector>

#include "ultrahdr/gainmapmetadata.h"

namespace ultrahdr {

class GainMapMetadataTest : public testing::Test {
 public:
  GainMapMetadataTest();
  ~GainMapMetadataTest();

 protected:
  virtual void SetUp();
  virtual void TearDown();
};

GainMapMetadataTest::GainMapMetadataTest() {}

GainMapMetadataTest::~GainMapMetadataTest() {}

void GainMapMetadataTest::SetUp() {}

void GainMapMetadataTest::TearDown() {}

const std::string kIso = "urn:iso:std:iso:ts:21496:-1";

TEST_F(GainMapMetadataTest, encodeMetadataThenDecode) {
  uhdr_gainmap_metadata_ext_t expected("1.0");
  expected.max_content_boost = 100.5f;
  expected.min_content_boost = 1.5f;
  expected.gamma = 1.0f;
  expected.offset_sdr = 0.0f;
  expected.offset_hdr = 0.0f;
  expected.hdr_capacity_min = 1.0f;
  expected.hdr_capacity_max = expected.max_content_boost;

  uhdr_gainmap_metadata_frac metadata;
  uhdr_gainmap_metadata_frac::gainmapMetadataFloatToFraction(&expected, &metadata);
  //  metadata.dump();

  std::vector<uint8_t> data;
  uhdr_gainmap_metadata_frac::encodeGainmapMetadata(&metadata, data);

  uhdr_gainmap_metadata_frac decodedMetadata;
  uhdr_gainmap_metadata_frac::decodeGainmapMetadata(data, &decodedMetadata);

  uhdr_gainmap_metadata_ext_t decodedUHdrMetadata;
  uhdr_gainmap_metadata_frac::gainmapMetadataFractionToFloat(&decodedMetadata,
                                                             &decodedUHdrMetadata);

  EXPECT_FLOAT_EQ(expected.max_content_boost, decodedUHdrMetadata.max_content_boost);
  EXPECT_FLOAT_EQ(expected.min_content_boost, decodedUHdrMetadata.min_content_boost);
  EXPECT_FLOAT_EQ(expected.gamma, decodedUHdrMetadata.gamma);
  EXPECT_FLOAT_EQ(expected.offset_sdr, decodedUHdrMetadata.offset_sdr);
  EXPECT_FLOAT_EQ(expected.offset_hdr, decodedUHdrMetadata.offset_hdr);
  EXPECT_FLOAT_EQ(expected.hdr_capacity_min, decodedUHdrMetadata.hdr_capacity_min);
  EXPECT_FLOAT_EQ(expected.hdr_capacity_max, decodedUHdrMetadata.hdr_capacity_max);
}
}  // namespace ultrahdr
