blob: ea7a48a9c80e2931b4b32aeba24ae5a0f69e16de [file] [log] [blame]
Suyog Pawar4602c372023-08-17 11:09:23 +05301/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#include <android-base/properties.h>
17#include <Codec2CommonUtils.h>
18#include <Codec2Mapper.h>
19#include <dav1d/dav1d.h>
20
21#define DUMP_FILE_PATH "/data/local/tmp/dump"
22#define INPUT_DATA_DUMP_EXT "av1"
23#define INPUT_SIZE_DUMP_EXT "size"
24#define OUTPUT_YUV_DUMP_EXT "yuv"
25
26namespace android {
27constexpr size_t kFileNameLength = 256;
28
29class C2SoftDav1dDump {
30 public:
31 void initDumping();
32 void destroyDumping();
33 void dumpInput(uint8_t* ptr, int new_size);
34 template <typename T>
35 void dumpOutput(const T* srcY, const T* srcU, const T* srcV, size_t srcYStride,
36 size_t srcUStride, size_t srcVStride, int width, int height);
37 void writeDav1dOutYuvFile(const Dav1dPicture& p);
38
39 private:
40 int mFramesToDump = 0;
41 int mFirstFrameToDump = 0;
42 int mOutputCount = 0;
43
44 char mInDataFileName[kFileNameLength];
45 char mInSizeFileName[kFileNameLength];
46 char mDav1dOutYuvFileName[kFileNameLength];
47
48 FILE* mInDataFile = nullptr;
49 FILE* mInSizeFile = nullptr;
50 FILE* mDav1dOutYuvFile = nullptr;
51};
52} // namespace android