From a1a3f65434e0097fcc598134cce033bf828c5701 Mon Sep 17 00:00:00 2001 From: Lina Sun Date: Sun, 29 Sep 2024 08:04:42 +0000 Subject: [PATCH] Remove dumping code related to macro MFX_DEBUG_DUMP_FRAME Will add dumping code in another way, input & output buffer dump for encoder & decoder will all be able to be configured by set property. Tracked-On: OAM-124732 Signed-off-by: Lina Sun --- c2_buffers/src/mfx_c2_frame_in.cpp | 6 -- .../include/mfx_c2_decoder_component.h | 6 -- .../src/mfx_c2_decoder_component.cpp | 69 ------------------- c2_utils/include/mfx_debug.h | 1 - 4 files changed, 82 deletions(-) diff --git a/c2_buffers/src/mfx_c2_frame_in.cpp b/c2_buffers/src/mfx_c2_frame_in.cpp index 8f80cd8e..9b150581 100755 --- a/c2_buffers/src/mfx_c2_frame_in.cpp +++ b/c2_buffers/src/mfx_c2_frame_in.cpp @@ -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({}),"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); diff --git a/c2_components/include/mfx_c2_decoder_component.h b/c2_components/include/mfx_c2_decoder_component.h index f9d6fdbf..f9b26273 100755 --- a/c2_components/include/mfx_c2_decoder_component.h +++ b/c2_components/include/mfx_c2_decoder_component.h @@ -252,12 +252,6 @@ 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 - /* -----------------------C2Parameters--------------------------- */ std::shared_ptr m_name; std::shared_ptr m_kind; diff --git a/c2_components/src/mfx_c2_decoder_component.cpp b/c2_components/src/mfx_c2_decoder_component.cpp index 11df780d..140846db 100755 --- a/c2_components/src/mfx_c2_decoder_component.cpp +++ b/c2_components/src/mfx_c2_decoder_component.cpp @@ -2266,42 +2266,6 @@ void MfxC2DecoderComponent::Drain(std::unique_ptr&& work) } } -#if MFX_DEBUG_DUMP_FRAME == MFX_DEBUG_YES -bool MfxC2DecoderComponent::NeedDumpBuffer() { - MFX_DEBUG_TRACE_FUNC; - const char* key = "mediacodec2.dump.buffer"; - char* value = new char[20]; - int len = property_get(key, value, "0"); - -#include -#include - - std::stringstream strValue; - strValue << value; - - unsigned int m_frame_number = 0; - strValue >> m_frame_number; - - m_count_lock.lock(); - if (m_count) { - delete[] value; - m_count_lock.unlock(); - return true; - } else { - delete[] value; - if (len > 0 && m_frame_number > 0) { - m_count = m_frame_number; - MFX_DEBUG_TRACE_PRINTF("--------triggered to dump %d buffers---------", m_frame_number); - property_set(key, "0"); - m_count_lock.unlock(); - return true; - } - m_count_lock.unlock(); - return false; - } -} -#endif - void MfxC2DecoderComponent::WaitWork(MfxC2FrameOut&& frame_out, mfxSyncPoint sync_point) { MFX_DEBUG_TRACE_FUNC; @@ -2460,39 +2424,6 @@ void MfxC2DecoderComponent::WaitWork(MfxC2FrameOut&& frame_out, mfxSyncPoint syn } m_updatingC2Configures.clear(); -#if MFX_DEBUG_DUMP_FRAME == MFX_DEBUG_YES - static FILE* m_f = 0; - if (NeedDumpBuffer()) { - const C2GraphicView& output_view = block->map().get(); - m_count_lock.lock(); - if (m_count) { - const uint8_t* srcY = output_view.data()[C2PlanarLayout::PLANE_Y]; - const uint8_t* srcU = output_view.data()[C2PlanarLayout::PLANE_U]; - const uint8_t* srcV = output_view.data()[C2PlanarLayout::PLANE_V]; - if (!m_f) { - m_f = fopen("/data/local/traces/decoder_frame.yuv", "w+"); - MFX_DEBUG_TRACE_STREAM("/data/local/traces/decoder_frame.yuv: create:" << m_f); - } - if (m_f) { - size_t copied_Y = 0, copied_U = 0; - copied_Y = fwrite(srcY, mfx_surface->Data.PitchLow * m_mfxVideoParams.mfx.FrameInfo.CropH, 1, m_f); - copied_U = fwrite(srcU, mfx_surface->Data.PitchLow * m_mfxVideoParams.mfx.FrameInfo.CropH / 2, 1, m_f); - MFX_DEBUG_TRACE_PRINTF("############# dumping #%d decoded buffer in size: %dx%d, Y:%zu, U:%zu #################", - m_count, mfx_surface->Data.PitchLow, m_mfxVideoParams.mfx.FrameInfo.CropH, copied_Y, copied_U); - if (copied_Y > 0 || copied_U > 0) - m_count--; - } - } - m_count_lock.unlock(); - } - m_count_lock.lock(); - if (m_count == 0 && m_f) { - fclose(m_f); - MFX_DEBUG_TRACE_MSG("dump file is closed"); - m_f = NULL; - } - m_count_lock.unlock(); -#endif worklet->output.buffers.push_back(out_buffer); block = nullptr; } diff --git a/c2_utils/include/mfx_debug.h b/c2_utils/include/mfx_debug.h index c4ecda8e..e41b8385 100755 --- a/c2_utils/include/mfx_debug.h +++ b/c2_utils/include/mfx_debug.h @@ -26,7 +26,6 @@ #define MFX_DEBUG MFX_DEBUG_NO // enables DEBUG output #define MFX_PERF MFX_DEBUG_NO // enables PERF output, doesn't depends on MFX_DEBUG #define MFX_ATRACE MFX_DEBUG_NO // enables systrace -#define MFX_DEBUG_DUMP_FRAME MFX_DEBUG_NO // enables write frame to file #define MFX_DEBUG_FILE MFX_DEBUG_NO // sends DEBUG and PERF output to file, otherwise to logcat