From 66b271261101c498f7428c1bd87c84598991c2bf Mon Sep 17 00:00:00 2001 From: Kitae Kim Date: Thu, 31 Jul 2014 18:24:30 +0900 Subject: [PATCH] brillcodec: remove useless memory copy. Unnecessary memcpy operations occur while decoding video. It causes performance degradation in emulator. Change-Id: I7d5fb346ed56d0835f43ccc63a0937080e3712e1 Signed-off-by: Kitae Kim --- tizen/src/hw/pci/maru_brill_codec.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tizen/src/hw/pci/maru_brill_codec.c b/tizen/src/hw/pci/maru_brill_codec.c index 2055c078d5..e188cd9854 100644 --- a/tizen/src/hw/pci/maru_brill_codec.c +++ b/tizen/src/hw/pci/maru_brill_codec.c @@ -692,7 +692,7 @@ static int maru_brill_codec_get_picture_size(AVPicture *picture, uint8_t *ptr, if (!encode && !ptr) { TRACE("allocate a buffer for a decoded picture.\n"); - ptr = av_mallocz(fsize); + ptr = g_malloc(fsize); if (!ptr) { ERR("[%d] failed to allocate memory.\n", __LINE__); return -1; @@ -1373,7 +1373,7 @@ static bool codec_decode_video(MaruBrillCodecState *s, int ctx_id, void *data_bu tempbuf = g_malloc(tempbuf_size); if (!tempbuf) { ERR("failed to allocate decoded audio buffer\n"); - // FIXME: how to handle this case? + tempbuf_size = 0; } else { struct video_data video; @@ -1399,7 +1399,7 @@ static bool codec_picture_copy (MaruBrillCodecState *s, int ctx_id, void *elem) AVCodecContext *avctx = NULL; AVPicture *src = NULL; AVPicture dst; - uint8_t *out_buffer = NULL, *tempbuf = NULL; + uint8_t *tempbuf = NULL; int pict_size = 0; bool ret = true; @@ -1433,14 +1433,7 @@ static bool codec_picture_copy (MaruBrillCodecState *s, int ctx_id, void *elem) av_picture_copy(&dst, src, avctx->pix_fmt, avctx->width, avctx->height); - tempbuf = g_malloc0(pict_size); - if (!tempbuf) { - ERR("failed to allocate a picture buffer. size: %d\n", pict_size); - } else { - out_buffer = dst.data[0]; - memcpy(tempbuf, out_buffer, pict_size); - } - av_free(out_buffer); + tempbuf = dst.data[0]; } } -- 2.34.1