/** * \file * * \author Marko Viitanen ( fador@iki.fi ), * Tampere University of Technology, * Department of Pervasive Computing. * \author Ari Koivula ( ari@koivu.la ), * Tampere University of Technology, * Department of Pervasive Computing. */ #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, ""); return fp; } /** * Close the FILE* returned by open_cu_file. */ void close_cu_file(FILE *fp) { fprintf(fp, ""); fclose(fp); } /** * Print information about the Coding Unit (CU) into the FILE* provided by open_cu_file. */ unsigned render_cu_file(encoder_control *encoder, unsigned depth, uint16_t xCtb, uint16_t yCtb, FILE *fp) { cu_info *cu = &encoder->in.cur_pic->cu_array[depth][xCtb + yCtb * (encoder->in.width_in_lcu<QP]) << 4; unsigned sum = 0; unsigned best_cost = -1; char type = cu->type == CU_INTRA ? 'I' : 'P'; fprintf(fp, "\n\n", depth, depth, xCtb, yCtb, cu->split, (cu->type == CU_INTRA ? 'I' : 'P'), cu->inter.cost, cu->inter.mv[0], cu->inter.mv[1]); 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; } fprintf(fp, "
" "%u (%u, %u), %d, %c, " "c=%u, mv=(%d, %d)
"); sum += render_cu_file(encoder, depth + 1, xCtb, yCtb, fp); fprintf(fp, ""); sum += render_cu_file(encoder, depth + 1, xCtb + change, yCtb, fp); fprintf(fp, "
"); sum += render_cu_file(encoder, depth + 1, xCtb, yCtb + change, fp); fprintf(fp, ""); sum += render_cu_file(encoder, depth + 1, xCtb + change, yCtb + change, fp); fprintf(fp, "
sum=%u, sum+lambda=%u
"); return best_cost; }