Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dump functions for encoder/decoder #192

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions c2_buffers/src/mfx_c2_frame_in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,6 @@ c2_status_t MfxC2FrameIn::MfxC2LoadSurfaceInSW(C2ConstGraphicBlock& c_graph_bloc
}
}

#if MFX_DEBUG_DUMP_FRAME == MFX_DEBUG_YES
static int frameIndex = 0;
static YUVWriter writer("/data/local/tmp",std::vector<std::string>({}),"encoder_frame.log");
writer.Write(m_yuvData.get(), stride, height, frameIndex++);
#endif

mfx_sts = InitMfxFrameSW(buf_pack.ordinal.timestamp.peeku(), buf_pack.ordinal.frameIndex.peeku(),
m_yuvData.get(), m_yuvData.get()+y_plane_size, width, height, stride, MFX_FOURCC_NV12, m_mfxFrameInfo,
m_pMfxFrameSurface);
Expand Down
1 change: 0 additions & 1 deletion c2_components/include/mfx_c2_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class MfxC2Component : public C2ComponentInterface,
struct CreateConfig
{
int flags{0};
bool dump_output{false};
uint32_t concurrent_instances{0};
bool low_power_mode{false};
};
Expand Down
17 changes: 12 additions & 5 deletions c2_components/include/mfx_c2_decoder_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "mfx_frame_pool_allocator.h"
#include "mfx_gralloc_instance.h"
#include "mfx_c2_setters.h"
#include "mfx_c2_utils.h"
#include <cutils/properties.h>

class MfxC2DecoderComponent : public MfxC2Component
Expand Down Expand Up @@ -252,11 +253,17 @@ class MfxC2DecoderComponent : public MfxC2Component
MFXVideoVPP* m_vpp;
bool m_vppConversion = false;

#if MFX_DEBUG_DUMP_FRAME == MFX_DEBUG_YES
int m_count = 0;
std::mutex m_count_lock;
bool NeedDumpBuffer();
#endif
std::unique_ptr<BinaryWriter> m_outputWriter;
std::unique_ptr<BinaryWriter> m_inputWriter;

std::mutex m_dump_output_lock;
std::mutex m_dump_input_lock;

uint32_t m_dump_count = 0;
// decoder output dump file number, during decoding one bitstream, if
// dump output multiple times, the first dumped file named xxx_0.yuv,
// second dumped file named xxx_1.yuv ...
uint32_t m_file_num = 0;

/* -----------------------C2Parameters--------------------------- */
std::shared_ptr<C2ComponentNameSetting> m_name;
Expand Down
12 changes: 10 additions & 2 deletions c2_components/include/mfx_c2_encoder_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "mfx_c2_utils.h"
#include "mfx_c2_vpp_wrapp.h"
#include "mfx_c2_setters.h"
#include <cutils/properties.h>

// Assumes all calls are done from one (working) thread, no sync is needed.
// m_ctrlOnce accumulates subsequent changes for one next frame.
Expand Down Expand Up @@ -202,8 +203,6 @@ class MfxC2EncoderComponent : public MfxC2Component

std::shared_ptr<C2BlockPool> m_c2Allocator;

std::unique_ptr<BinaryWriter> m_outputWriter;

bool m_bHeaderSent{false};

mfxFrameSurface1 *m_encSrfPool;
Expand All @@ -220,6 +219,15 @@ class MfxC2EncoderComponent : public MfxC2Component
// Input frame info with width or height not 16byte aligned
mfxFrameInfo m_mfxInputInfo;

std::unique_ptr<BinaryWriter> m_outputWriter;
std::unique_ptr<BinaryWriter> m_inputWriter;

std::mutex m_dump_output_lock;
std::mutex m_dump_input_lock;

uint32_t m_dump_count = 0;
uint32_t m_dump_frames_number = 0; //total frames to dump

/* -----------------------C2Parameters--------------------------- */
std::mutex m_c2ParameterMutex;
std::shared_ptr<C2ComponentNameSetting> m_name;
Expand Down
Loading