From 6dbae4826800ae015ec7b1595bd1d9751e6872d2 Mon Sep 17 00:00:00 2001 From: Ari Koivula Date: Mon, 10 Feb 2014 16:45:08 +0200 Subject: [PATCH] Remove debug module. - It hasn't been very useful lately and I don't want to maintain it. --- build/VS2010/HEVC_encoder.vcxproj | 2 - build/VS2010/HEVC_encoder.vcxproj.filters | 6 - src/Makefile | 2 +- src/debug.c | 161 ---------------------- src/debug.h | 38 ----- 5 files changed, 1 insertion(+), 208 deletions(-) delete mode 100644 src/debug.c delete mode 100644 src/debug.h diff --git a/build/VS2010/HEVC_encoder.vcxproj b/build/VS2010/HEVC_encoder.vcxproj index 9d952221..bb185b91 100644 --- a/build/VS2010/HEVC_encoder.vcxproj +++ b/build/VS2010/HEVC_encoder.vcxproj @@ -100,7 +100,6 @@ - @@ -119,7 +118,6 @@ - diff --git a/build/VS2010/HEVC_encoder.vcxproj.filters b/build/VS2010/HEVC_encoder.vcxproj.filters index f0a24c4d..76fdfa48 100644 --- a/build/VS2010/HEVC_encoder.vcxproj.filters +++ b/build/VS2010/HEVC_encoder.vcxproj.filters @@ -60,9 +60,6 @@ Source Files - - Source Files - Source Files @@ -113,9 +110,6 @@ Header Files - - Header Files - Header Files diff --git a/src/Makefile b/src/Makefile index ad839d54..c63ff38a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -50,7 +50,7 @@ LDFLAGS += -lm LD = gcc YASM = yasm ASMOBJS = cpu.o -OBJS = interface_main.o encmain.o bitstream.o cabac.o config.o context.o debug.o encoder.o filter.o inter.o intra.o nal.o picture.o rdo.o sao.o search.o transform.o extras/getopt.o +OBJS = interface_main.o encmain.o bitstream.o cabac.o config.o context.o encoder.o filter.o inter.o intra.o nal.o picture.o rdo.o sao.o search.o transform.o extras/getopt.o PROG = ./kvazaar PROGS = $(PROG) diff --git a/src/debug.c b/src/debug.c deleted file mode 100644 index 0a66feca..00000000 --- a/src/debug.c +++ /dev/null @@ -1,161 +0,0 @@ -/***************************************************************************** - * This file is part of Kvazaar HEVC encoder. - * - * Copyright (C) 2013-2014 Tampere University of Technology and others (see - * COPYING file). - * - * Kvazaar is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - * Kvazaar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kvazaar. If not, see . - ****************************************************************************/ - -/* - * \file - */ - -#include "debug.h" - -#include - - -/** - * Return a FILE* to a file that can be used with render_cu_file and close_cu_file. - */ -FILE * open_cu_file(char *filename) { - FILE *fp = fopen(filename, "w"); - fprintf(fp, "\r\n" - "\r\n" - ""); - return fp; -} - -/** - * Close the FILE* returned by open_cu_file. - */ -void close_cu_file(FILE *fp) { - fprintf(fp, ""); - fclose(fp); -} - -void yuv2rgb(pixel yuv[3], pixel rgb[3]) -{ - int y = yuv[0]; - int u = yuv[1]; - int v = yuv[2]; - - int r = (int)(1.164 * y + 1.596 * (v - 128)); - int g = (int)(1.165 * y - 0.392 * (u - 128) - 0.813 * (v - 128)); - int b = (int)(1.164 * y + 2.017 * (u - 128)); - - rgb[0] = CLIP(0, 255, r); - rgb[1] = CLIP(0, 255, g); - rgb[2] = CLIP(0, 255, b); -} - -/** - * Print information about the Coding Unit (CU) into the FILE* provided by open_cu_file. - */ -unsigned render_cu_file(encoder_control *encoder, picture *pic, - unsigned depth, uint16_t xCtb, uint16_t yCtb, FILE *fp) -{ - cu_info *cu = &pic->cu_array[depth][xCtb + yCtb * (pic->width_in_lcu<cu_array[MAX_DEPTH][xCtb + yCtb * (pic->width_in_lcu<QP]); - unsigned sum = 0; - unsigned best_cost = -1; - char type = cu->type == CU_INTRA ? 'I' : 'P'; - int x = xCtb * CU_MIN_SIZE_PIXELS; - int y = yCtb * CU_MIN_SIZE_PIXELS; - unsigned luma = y * pic->width + x; - unsigned chroma = (y >> 1) * (pic->width >> 1) + (x >> 1); - pixel yuv[3] = { 0, 0, 0 }; - pixel rgb[3] = { 0, 0, 0 }; - - if (x >= pic->width || y >= pic->height) { - // Don't output anything for CU's completely outside the botders. - return 0; - } - - { - const picture *pic = encoder->in.cur_pic; - yuv[0] = pic->y_data[luma]; - yuv[1] = pic->u_data[chroma]; - yuv[2] = pic->v_data[chroma]; - yuv2rgb(yuv, rgb); - } - - // Enclose everything in a table with the assumption that this function is - // called from left to right and from top to down. - if (depth == 0) { - if (yCtb == 0 && xCtb == 0) { - fprintf(fp, "
"); - } else if (xCtb == 0) { - fprintf(fp, "
"); - } else if (xCtb == NO_SCU_IN_LCU(pic->width_in_lcu) - && yCtb == NO_SCU_IN_LCU(pic->height_in_lcu)) { - fprintf(fp, "
"); - } else { - fprintf(fp, ""); - } - } - - fprintf(fp, - "\n\n", - depth, rgb[0], rgb[1], rgb[2], - depth, xCtb, yCtb, (cu->type == CU_INTRA ? 'I' : 'P'), (cu->part_size == SIZE_NxN ? "NxN" : "2Nx2N"), - cu->inter.cost, cu->inter.mv[0], cu->inter.mv[1], - cu->intra[0].cost, cu->intra[0].mode); - - - if(depth != MAX_INTER_SEARCH_DEPTH) - { - /* Split blocks and remember to change x and y block positions */ - uint8_t change = 1<<(MAX_DEPTH-1-depth); - - fprintf(fp, ""); - - fprintf(fp, ""); - - fprintf(fp, "", - sum, sum + lambda_cost); - if (sum + lambda_cost < cu->inter.cost) { - best_cost = sum + lambda_cost; - } else { - best_cost = cu->inter.cost; - } - } else { - best_cost = cu->inter.cost; - } - - if (depth == 0) { - fprintf(fp, - "\n" - "", - final_cu->depth, (final_cu->type == CU_INTRA ? 'I' : 'P'), - final_cu->inter.cost, final_cu->inter.mv[0], final_cu->inter.mv[1]); - } - - fprintf(fp, "
" - "%u (%u, %u), %c, %s, " - "c=%u, mv=(%d, %d), intra_cost=%d, intra_mode=%d" - "
"); - sum += render_cu_file(encoder, pic, depth + 1, xCtb, yCtb, fp); - fprintf(fp, ""); - sum += render_cu_file(encoder, pic, depth + 1, xCtb + change, yCtb, fp); - fprintf(fp, "
"); - sum += render_cu_file(encoder, pic, depth + 1, xCtb, yCtb + change, fp); - fprintf(fp, ""); - sum += render_cu_file(encoder, pic, depth + 1, xCtb + change, yCtb + change, fp); - fprintf(fp, "
sum=%u, sum+lambda=%u
" - "best depth=%u, %c, " - "c=%u, mv=(%d, %d)
"); - return best_cost; -} diff --git a/src/debug.h b/src/debug.h deleted file mode 100644 index 147e47b9..00000000 --- a/src/debug.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef DEBUG_H_ -#define DEBUG_H_ -/***************************************************************************** - * This file is part of Kvazaar HEVC encoder. - * - * Copyright (C) 2013-2014 Tampere University of Technology and others (see - * COPYING file). - * - * Kvazaar is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - * Kvazaar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kvazaar. If not, see . - ****************************************************************************/ - -/* - * \file - * \brief Tools for visualizing and debugging the encoder. - */ - -#include "global.h" - -#include - -#include "encoder.h" - - -FILE * open_cu_file(char *filename); -void close_cu_file(FILE *fp); -unsigned render_cu_file(encoder_control *encoder, picture *pic, unsigned depth, uint16_t x_cu, uint16_t y_cu, FILE *fp); - -#endif