Remove debug module.

- It hasn't been very useful lately and I don't want to maintain it.
This commit is contained in:
Ari Koivula 2014-02-10 16:45:08 +02:00
parent bc3b80b9e4
commit 6dbae48268
5 changed files with 1 additions and 208 deletions

View file

@ -100,7 +100,6 @@
<ClCompile Include="..\..\src\cabac.c" />
<ClCompile Include="..\..\src\config.c" />
<ClCompile Include="..\..\src\context.c" />
<ClCompile Include="..\..\src\debug.c" />
<ClCompile Include="..\..\src\encmain.c" />
<ClCompile Include="..\..\src\encoder.c" />
<ClCompile Include="..\..\src\extras\getopt.c" />
@ -119,7 +118,6 @@
<ClInclude Include="..\..\src\cabac.h" />
<ClInclude Include="..\..\src\config.h" />
<ClInclude Include="..\..\src\context.h" />
<ClInclude Include="..\..\src\debug.h" />
<ClInclude Include="..\..\src\encoder.h" />
<ClInclude Include="..\..\src\extras\getopt.h" />
<ClInclude Include="..\..\src\filter.h" />

View file

@ -60,9 +60,6 @@
<ClCompile Include="..\..\src\inter.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\debug.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\sao.c">
<Filter>Source Files</Filter>
</ClCompile>
@ -113,9 +110,6 @@
<ClInclude Include="..\..\src\inter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\debug.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\sao.h">
<Filter>Header Files</Filter>
</ClInclude>

View file

@ -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)

View file

@ -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 <http://www.gnu.org/licenses/>.
****************************************************************************/
/*
* \file
*/
#include "debug.h"
#include <stdio.h>
/**
* 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, "<?xml version='1.0' encoding='UTF-8' ?>\r\n"
"<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>\r\n"
"<head><link rel='stylesheet' type='text/css' href='cu_style.css' /></head><body>");
return fp;
}
/**
* Close the FILE* returned by open_cu_file.
*/
void close_cu_file(FILE *fp) {
fprintf(fp, "</body></html>");
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<<MAX_DEPTH)];
cu_info *final_cu = &pic->cu_array[MAX_DEPTH][xCtb + yCtb * (pic->width_in_lcu<<MAX_DEPTH)];
unsigned lambda_cost = (unsigned)(4.5 * g_lambda_cost[encoder->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, "<table><tr><td>");
} else if (xCtb == 0) {
fprintf(fp, "</td></tr><tr><td>");
} else if (xCtb == NO_SCU_IN_LCU(pic->width_in_lcu)
&& yCtb == NO_SCU_IN_LCU(pic->height_in_lcu)) {
fprintf(fp, "</td></tr></table>");
} else {
fprintf(fp, "</td><td>");
}
}
fprintf(fp,
"\n<table class='d%u' bgcolor='#%02x%02x%02x'><tr><td colspan='2'>"
"%u (%u, %u), %c, %s, "
"c=%u, mv=(%d, %d), intra_cost=%d, intra_mode=%d"
"</td></tr>\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, "<tr><td>");
sum += render_cu_file(encoder, pic, depth + 1, xCtb, yCtb, fp);
fprintf(fp, "</td><td>");
sum += render_cu_file(encoder, pic, depth + 1, xCtb + change, yCtb, fp);
fprintf(fp, "</td></tr>");
fprintf(fp, "<tr><td>");
sum += render_cu_file(encoder, pic, depth + 1, xCtb, yCtb + change, fp);
fprintf(fp, "</td><td>");
sum += render_cu_file(encoder, pic, depth + 1, xCtb + change, yCtb + change, fp);
fprintf(fp, "</td></tr>");
fprintf(fp, "<tr><td colspan='2'>sum=%u, sum+lambda=%u</td></tr>",
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,
"<tr><td colspan='2'>"
"best depth=%u, %c, "
"c=%u, mv=(%d, %d)</td></tr>\n"
"</td></tr>",
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, "</table>");
return best_cost;
}

View file

@ -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 <http://www.gnu.org/licenses/>.
****************************************************************************/
/*
* \file
* \brief Tools for visualizing and debugging the encoder.
*/
#include "global.h"
#include <stdio.h>
#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