fix dump logic 04/85404/1
authorNAMJEONGYOON <just.nam@samsung.com>
Thu, 25 Aug 2016 03:47:21 +0000 (12:47 +0900)
committerNAMJEONGYOON <just.nam@samsung.com>
Thu, 25 Aug 2016 03:47:21 +0000 (12:47 +0900)
Change-Id: I6d19b85a6e89e23ad0dcd9232295acae993501e9

src/mm_evas_renderer.c

index 266a78f1e2362da09f5ce19cea6879bfcec551d1..c08ea9677589a7a7a88a8340d0c9b79d78f71372 100644 (file)
@@ -114,7 +114,7 @@ enum {
 static int g_cnt_in = 0;
 static int g_cnt_out = 0;
 //static void __print_idx(mm_evas_info *evas_info);
-static int __dump_pkt(media_packet_h pkt);
+static int __dump_pkt(media_packet_h pkt, int width, int height);
 static int __dump_surf(tbm_surface_h tbm_surf);
 #endif
 /* internal */
@@ -354,23 +354,54 @@ static void __print_idx(mm_evas_info *evas_info)
        return;
 }
 #endif
-static int __dump_pkt(media_packet_h pkt)
+static int __dump_pkt(media_packet_h pkt, int width, int height)
 {
        void *data;
        uint64_t size;
        char filename[128] = {0};
        FILE *fp = NULL;
+       int i = 0;
+       int stride_width, stride_height;
 
        sprintf(filename, "/tmp/DUMP_IN_IMG_%2.2d.dump", g_cnt_in);
        fp = fopen(filename, "wb");
        if (fp == NULL)
                return 1;
 
-       media_packet_get_buffer_data_ptr(pkt, &data);
+       media_packet_get_video_plane_data_ptr(pkt, 0, &data);
+       media_packet_get_video_stride_width(pkt, 0, &stride_width);
+       media_packet_get_video_stride_height(pkt, 0, &stride_height);
        media_packet_get_buffer_size(pkt, &size);
-       LOGI("DUMP_IN_IMG_%2.2d : buffer size(%d) data(%p)", g_cnt_in, (int)size, data);
+       LOGI("[0]stride : %d, %d", stride_width, stride_height);
 
-       fwrite(data, (int)size, 1, fp);
+       for (i = 0; i < height; i++) {
+               fwrite(data, width, 1, fp);
+               data += stride_width;
+       }
+#if 0 //hw format(NV12)
+       media_packet_get_video_plane_data_ptr(pkt, 1, &data);
+       media_packet_get_video_stride_width(pkt, 1, &stride_width);
+       for (i = 0; i < height/2; i++) {
+               ret = fwrite(data, width, 1, fp);
+               data += stride_width;
+       }
+#else
+       media_packet_get_video_plane_data_ptr(pkt, 1, &data);
+       media_packet_get_video_stride_width(pkt, 1, &stride_width);
+       for (i = 0; i < height/2; i++) {
+               fwrite(data, width/2, 1, fp);
+               data += stride_width;
+       }
+       LOGI("[1]stride : %d, %d", stride_width, stride_height);
+       media_packet_get_video_plane_data_ptr(pkt, 2, &data);
+       media_packet_get_video_stride_width(pkt, 2, &stride_width);
+       for (i = 0; i < height/2; i++) {
+               fwrite(data, width/2, 1, fp);
+               data += stride_width;
+       }
+       LOGI("[2]stride : %d, %d", stride_width, stride_height);
+#endif
+       LOGI("DUMP_IN_IMG_%2.2d : buffer size(%d) data(%p)", g_cnt_in, (int)size, data);
        fclose(fp);
 
        return 0;
@@ -381,14 +412,19 @@ static int __dump_surf(tbm_surface_h tbm_surf)
        char filename[128] = {0};
        tbm_surface_info_s info = {0};
 
-       sprintf(filename, "DUMP_OUT_IMG_%2.2d.yuv", g_cnt_out);
+       sprintf(filename, "DUMP_OUT_IMG_%2.2d", g_cnt_out);
        if (tbm_surface_get_info(tbm_surf, &info)) {
                LOGE("get_info is failed");
                return 1;
        }
+
        tbm_surface_internal_dump_start("/tmp", info.width, info.height, 1);
        tbm_surface_internal_dump_buffer(tbm_surf, filename);
        tbm_surface_internal_dump_end();
+
+       LOGI("[0]stride : %d, offset : %d", (int)info.planes[0].stride, (int)info.planes[0].offset);
+       LOGI("[1]stride : %d, offset : %d", (int)info.planes[1].stride, (int)info.planes[1].offset);
+       LOGI("[2]stride : %d, offset : %d", (int)info.planes[2].stride, (int)info.planes[2].offset);
        LOGI("DUMP_OUT_IMG_%2.2d : buffer size(%d) surf(%p) %d*%d", g_cnt_out, (int)info.size, tbm_surf, info.width, info.height);
 
        return 0;
@@ -1132,7 +1168,7 @@ void mm_evas_renderer_write(media_packet_h packet, void *data)
 #ifdef _INTERNAL_DEBUG_
                int ret2 = 0;
                if ((g_cnt_in%10 == 0) && (g_cnt_in < 500))
-                       ret2 = __dump_pkt(packet);
+                       ret2 = __dump_pkt(packet, handle->w, handle->h);
 
                if (ret2)
                        LOGW("__dump_pkt() is failed");