From: Kitae Kim Date: Thu, 31 Jul 2014 09:24:30 +0000 (+0900) Subject: brillcodec: remove useless memory copy. X-Git-Tag: TizenStudio_2.0_p3.0~398^2~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67d5b4d2e2fc3f4b15d76faaa7deccf156289e20;p=sdk%2Femulator%2Fqemu.git 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 --- diff --git a/tizen/src/hw/pci/maru_brill_codec.c b/tizen/src/hw/pci/maru_brill_codec.c index 2055c07..e188cd9 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]; } }