From 48c04088fe04142600e90f179c65c681a89e913e Mon Sep 17 00:00:00 2001 From: Kitae Kim Date: Tue, 27 Jan 2015 12:03:15 +0900 Subject: [PATCH] brillcodec: dump decoded frames Dump decoded frames to check if they are valid or not. Change-Id: I904ef58148e468d7e2c1985614522935ff615f55 Signed-off-by: Kitae Kim --- tizen/src/hw/pci/maru_brillcodec.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/tizen/src/hw/pci/maru_brillcodec.c b/tizen/src/hw/pci/maru_brillcodec.c index 0430274..6a513ed 100644 --- a/tizen/src/hw/pci/maru_brillcodec.c +++ b/tizen/src/hw/pci/maru_brillcodec.c @@ -41,8 +41,11 @@ /* define debug channel */ DECLARE_DEBUG_CHANNEL(brillcodec); -// device memory -#define CODEC_META_DATA_SIZE (256) +#ifdef DUMP_DECODE_FRAME +/* You can check whether decoded frames are valid or not via PYUV program */ +FILE *dump_file = NULL; +const char *dump_image = "dump_decode.raw"; +#endif // libav #define GEN_MASK(x) ((1 << (x)) - 1) @@ -831,6 +834,13 @@ static void default_get_picture(void *dst, void *src, enum AVPixelFormat pix_fmt } avpicture_layout((AVPicture *)frame, pix_fmt, frame->width, frame->height, dst, pict_size); + +#ifdef DUMP_DECODE_FRAME + if (dump_file) { + LOG_TRACE("dump decoded frame. picture size %d\n", pict_size); + fwrite(dst, 1, pict_size, dump_file); + } +#endif } // video decode data handler @@ -1891,8 +1901,15 @@ static bool init(MaruBrillCodecState *s, int ctx_id, void *data_buf) + sizeof(int); CONTEXT(s, ctx_id)->opened_context = true; - CONTEXT(s, ctx_id)->parser_ctx = - maru_brill_codec_parser_init(avctx); + CONTEXT(s, ctx_id)->parser_ctx = maru_brill_codec_parser_init(avctx); +#ifdef DUMP_DECODE_FRAME + if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { + dump_file = fopen(dump_image, "wb"); + if (!dump_file) { + LOG_INFO("failed to open a file\n"); + } + } +#endif } else { LOG_SEVERE("failed to find codec. ctx_id: %d\n", ctx_id); ret = -1; @@ -1951,6 +1968,15 @@ static bool deinit(MaruBrillCodecState *s, int ctx_id, void *data_buf) } LOG_INFO("close avcontext of %d\n", ctx_id); +#ifdef DUMP_DECODE_FRAME + if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { + if (dump_file) { + fclose(dump_file); + dump_file = NULL; + } + } +#endif + avcodec_close(avctx); if (CONTEXT(s, ctx_id)->is_hwaccel) { -- 2.7.4