mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-23 18:14:06 +00:00
[debug] Add debug.c/.h and initial version of YUView CSV format printers
This commit is contained in:
parent
78d4d1a404
commit
5cbc655954
|
@ -266,6 +266,7 @@
|
|||
<ClCompile Include="..\..\src\strategies\avx2\alf-avx2.c">
|
||||
<Filter>Optimization\strategies\avx2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\debug.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\bitstream.h">
|
||||
|
@ -497,6 +498,7 @@
|
|||
<ClInclude Include="..\..\src\strategies\avx2\alf-avx2.h">
|
||||
<Filter>Optimization\strategies\avx2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\debug.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<YASM Include="..\..\src\extras\x86inc.asm">
|
||||
|
@ -509,4 +511,7 @@
|
|||
<Filter>Optimization\strategies\x86_asm</Filter>
|
||||
</YASM>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ClassDiagram.cd" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -57,6 +57,8 @@ libkvazaar_la_SOURCES = \
|
|||
context.h \
|
||||
cu.c \
|
||||
cu.h \
|
||||
debug.c \
|
||||
debug.h \
|
||||
encoder.c \
|
||||
encoder.h \
|
||||
encoderstate.c \
|
||||
|
|
239
src/debug.c
Normal file
239
src/debug.c
Normal file
|
@ -0,0 +1,239 @@
|
|||
/*****************************************************************************
|
||||
* This file is part of uvg266 VVC encoder.
|
||||
*
|
||||
* Copyright (c) 2021, Tampere University, ITU/ISO/IEC, project contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the Tampere University or ITU/ISO/IEC nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Functions for debugging purposes.
|
||||
*/
|
||||
|
||||
#include "encoderstate.h"
|
||||
#include "global.h"
|
||||
|
||||
#ifdef KVZ_DEBUG_PRINT_YUVIEW_CSV
|
||||
|
||||
FILE* yuview_output;
|
||||
|
||||
void kvz_dbg_yuview_init(const encoder_control_t* const encoder, char* filename, char* sequence) {
|
||||
|
||||
char buf[100];
|
||||
snprintf(buf, 100, "%s.csv", filename);
|
||||
|
||||
yuview_output = fopen(buf, "wb");
|
||||
|
||||
fprintf(yuview_output, "%% syntax-version v1.22\r\n");
|
||||
fprintf(yuview_output, "%% %%width and height of Chroma TUs are scaled to luma resolution\r\n");
|
||||
fprintf(yuview_output, "%% seq-specs %s layer2 %d %d %d\r\n", sequence, encoder->in.width, encoder->in.height, (int)encoder->cfg.framerate);
|
||||
fprintf(yuview_output, "%% type 0 PCM map\r\n");
|
||||
fprintf(yuview_output, "%% mapColor 0 0 0 0 120\r\n");
|
||||
fprintf(yuview_output, "%% type 1 IntraDirLuma range\r\n");
|
||||
fprintf(yuview_output, "%% defaultRange 0 35 Autumn\r\n");
|
||||
fprintf(yuview_output, "%% type 2 IntraDirChroma range\r\n");
|
||||
fprintf(yuview_output, "%% defaultRange 0 36 Autumn\r\n");
|
||||
fprintf(yuview_output, "%% type 3 RefIdxSkipL0 range\r\n");
|
||||
fprintf(yuview_output, "%% range 0 4 0 65 75 154 160 255 255 255\r\n");
|
||||
fprintf(yuview_output, "%% type 4 RefIdxSkipL1 range\r\n");
|
||||
fprintf(yuview_output, "%% range 0 4 53 128 0 66 160 255 255 255\r\n");
|
||||
fprintf(yuview_output, "%% type 5 RefIdxMergeL0 range\r\n");
|
||||
fprintf(yuview_output, "%% range 0 4 75 154 160 255 0 65 255 255\r\n");
|
||||
fprintf(yuview_output, "%% type 6 RefIdxMergeL1 range\r\n");
|
||||
fprintf(yuview_output, "%% range 0 4 0 65 160 255 56 132 255 255\r\n");
|
||||
fprintf(yuview_output, "%% type 7 RefIdxInterL0 range\r\n");
|
||||
fprintf(yuview_output, "%% range 0 4 160 255 113 199 0 65 255 255\r\n");
|
||||
fprintf(yuview_output, "%% type 8 RefIdxInterL1 range\r\n");
|
||||
fprintf(yuview_output, "%% range 0 4 146 239 160 255 0 65 255 255\r\n");
|
||||
fprintf(yuview_output, "%% type 9 MVSkipL0 vector\r\n");
|
||||
fprintf(yuview_output, "%% vectorColor 0 0 0 255\r\n");
|
||||
fprintf(yuview_output, "%% scaleFactor 4\r\n");
|
||||
fprintf(yuview_output, "%% type 10 MVSkipL1 vector\r\n");
|
||||
fprintf(yuview_output, "%% vectorColor 255 255 255 255\r\n");
|
||||
fprintf(yuview_output, "%% scaleFactor 4\r\n");
|
||||
fprintf(yuview_output, "%% type 11 MVMergeL0 vector\r\n");
|
||||
fprintf(yuview_output, "%% vectorColor 0 0 0 255\r\n");
|
||||
fprintf(yuview_output, "%% scaleFactor 4\r\n");
|
||||
fprintf(yuview_output, "%% type 12 MVMergeL1 vector\r\n");
|
||||
fprintf(yuview_output, "%% vectorColor 255 255 255 255\r\n");
|
||||
fprintf(yuview_output, "%% scaleFactor 4\r\n");
|
||||
fprintf(yuview_output, "%% type 13 MVInterL0 vector\r\n");
|
||||
fprintf(yuview_output, "%% vectorColor 0 0 0 255\r\n");
|
||||
fprintf(yuview_output, "%% scaleFactor 4\r\n");
|
||||
fprintf(yuview_output, "%% type 14 MVInterL1 vector\r\n");
|
||||
fprintf(yuview_output, "%% vectorColor 255 255 255 255\r\n");
|
||||
fprintf(yuview_output, "%% scaleFactor 4\r\n");
|
||||
fprintf(yuview_output, "%% type 15 NumSigCoeffY range\r\n");
|
||||
fprintf(yuview_output, "%% range 0 1024 0 255 0 255 0 255 255 255\r\n");
|
||||
fprintf(yuview_output, "%% scaleToBlockSize 1\r\n");
|
||||
fprintf(yuview_output, "%% type 16 NumSigCoeffU range\r\n");
|
||||
fprintf(yuview_output, "%% range 0 1024 0 255 0 255 0 255 255 255\r\n");
|
||||
fprintf(yuview_output, "%% scaleToBlockSize 1\r\n");
|
||||
fprintf(yuview_output, "%% type 17 NumSigCoeffV range\r\n");
|
||||
fprintf(yuview_output, "%% range 0 1024 0 255 0 255 0 255 255 255\r\n");
|
||||
fprintf(yuview_output, "%% scaleToBlockSize 1\r\n");
|
||||
|
||||
}
|
||||
|
||||
void kvz_dbg_yuview_add_vector(const encoder_state_t* const state, int x, int y, int width, int height, int type, int x_vec, int y_vec) {
|
||||
fprintf(yuview_output, "%d %d %d %d %d %d %d %d\r\n", state->tile->frame->poc, x, y, width, height, type, x_vec, y_vec);
|
||||
}
|
||||
|
||||
void kvz_dbg_yuview_add(const encoder_state_t* const state, int x, int y, int width, int height, int type, int val) {
|
||||
fprintf(yuview_output, "%d %d %d %d %d %d %d\r\n", state->tile->frame->poc, x, y, width, height, type, val);
|
||||
}
|
||||
|
||||
void kvz_dbg_yuview_cleanup() {
|
||||
fclose(yuview_output);
|
||||
yuview_output = NULL;
|
||||
}
|
||||
|
||||
#endif //KVZ_DEBUG_PRINT_YUVIEW_CSV
|
||||
|
||||
#ifdef KVZ_DEBUG_PRINT_THREADING_INFO
|
||||
void kvz_dbg_encoder_state_dump_graphviz(const encoder_state_t* const state) {
|
||||
int i;
|
||||
|
||||
if (!state->parent) {
|
||||
const encoder_control_t* const encoder = state->encoder_control;
|
||||
int y, x;
|
||||
//Empty lines (easier to copy-paste)
|
||||
printf("\n\n\n\n\n");
|
||||
//Some styling...
|
||||
printf("digraph EncoderStates {\n");
|
||||
printf(" fontname = \"Bitstream Vera Sans\"\n");
|
||||
printf(" fontsize = 8\n\n");
|
||||
printf(" node [\n");
|
||||
printf(" fontname = \"Bitstream Vera Sans\"\n");
|
||||
printf(" fontsize = 8\n");
|
||||
printf(" shape = \"record\"\n");
|
||||
printf(" ]\n\n");
|
||||
printf(" edge [\n");
|
||||
printf(" arrowtail = \"empty\"\n");
|
||||
printf(" ]\n\n");
|
||||
|
||||
printf(" \"Map\" [\n");
|
||||
printf(" shape=plaintext\n");
|
||||
printf(" label = <<table cellborder=\"1\" cellspacing=\"0\" border=\"0\">");
|
||||
printf("<tr><td colspan=\"%d\" height=\"20\" valign=\"bottom\"><b>RS Map</b></td></tr>", encoder->in.width_in_lcu);
|
||||
for (y = 0; y < encoder->in.height_in_lcu; ++y) {
|
||||
printf("<tr>");
|
||||
for (x = 0; x < encoder->in.width_in_lcu; ++x) {
|
||||
const int lcu_id_rs = y * encoder->in.width_in_lcu + x;
|
||||
|
||||
printf("<td>%d</td>", lcu_id_rs);
|
||||
}
|
||||
printf("</tr>");
|
||||
}
|
||||
printf("<tr><td colspan=\"%d\" height=\"20\" valign=\"bottom\"><b>TS Map</b></td></tr>", encoder->in.width_in_lcu);
|
||||
for (y = 0; y < encoder->in.height_in_lcu; ++y) {
|
||||
printf("<tr>");
|
||||
for (x = 0; x < encoder->in.width_in_lcu; ++x) {
|
||||
const int lcu_id_rs = y * encoder->in.width_in_lcu + x;
|
||||
const int lcu_id_ts = encoder->tiles_ctb_addr_rs_to_ts[lcu_id_rs];
|
||||
|
||||
printf("<td>%d</td>", lcu_id_ts);
|
||||
}
|
||||
printf("</tr>");
|
||||
}
|
||||
printf("<tr><td colspan=\"%d\" height=\"20\" valign=\"bottom\"><b>Tile map</b></td></tr>", encoder->in.width_in_lcu);
|
||||
for (y = 0; y < encoder->in.height_in_lcu; ++y) {
|
||||
printf("<tr>");
|
||||
for (x = 0; x < encoder->in.width_in_lcu; ++x) {
|
||||
const int lcu_id_rs = y * encoder->in.width_in_lcu + x;
|
||||
const int lcu_id_ts = encoder->tiles_ctb_addr_rs_to_ts[lcu_id_rs];
|
||||
|
||||
printf("<td>%d</td>", encoder->tiles_tile_id[lcu_id_ts]);
|
||||
}
|
||||
printf("</tr>");
|
||||
}
|
||||
printf("<tr><td colspan=\"%d\" height=\"20\" valign=\"bottom\"><b>Slice map</b></td></tr>", encoder->in.width_in_lcu);
|
||||
for (y = 0; y < encoder->in.height_in_lcu; ++y) {
|
||||
printf("<tr>");
|
||||
for (x = 0; x < encoder->in.width_in_lcu; ++x) {
|
||||
const int lcu_id_rs = y * encoder->in.width_in_lcu + x;
|
||||
const int lcu_id_ts = encoder->tiles_ctb_addr_rs_to_ts[lcu_id_rs];
|
||||
int slice_id = 0;
|
||||
|
||||
//Not efficient, but who cares
|
||||
for (i = 0; i < encoder->slice_count; ++i) {
|
||||
if (encoder->slice_addresses_in_ts[i] <= lcu_id_ts) {
|
||||
slice_id = i;
|
||||
}
|
||||
}
|
||||
|
||||
printf("<td>%d</td>", slice_id);
|
||||
}
|
||||
printf("</tr>");
|
||||
}
|
||||
printf("</table>>\n ]\n");
|
||||
}
|
||||
|
||||
printf(" \"%p\" [\n", state);
|
||||
printf(" label = \"{encoder_state|");
|
||||
printf("+ type=%c\\l", state->type);
|
||||
if (!state->parent || state->frame != state->parent->global) {
|
||||
printf("|+ global\\l");
|
||||
}
|
||||
if (!state->parent || state->tile != state->parent->tile) {
|
||||
printf("|+ tile\\l");
|
||||
printf(" - id = %d\\l", state->tile->id);
|
||||
printf(" - lcu_offset_x = %d\\l", state->tile->lcu_offset_x);
|
||||
printf(" - lcu_offset_y = %d\\l", state->tile->lcu_offset_y);
|
||||
printf(" - lcu_offset_in_ts = %d\\l", state->tile->lcu_offset_in_ts);
|
||||
}
|
||||
if (!state->parent || state->slice != state->parent->slice) {
|
||||
printf("|+ slice\\l");
|
||||
printf(" - id = %d\\l", state->slice->id);
|
||||
printf(" - start_in_ts = %d\\l", state->slice->start_in_ts);
|
||||
printf(" - end_in_ts = %d\\l", state->slice->end_in_ts);
|
||||
printf(" - start_in_rs = %d\\l", state->slice->start_in_rs);
|
||||
printf(" - end_in_rs = %d\\l", state->slice->end_in_rs);
|
||||
}
|
||||
if (!state->parent || state->wfrow != state->parent->wfrow) {
|
||||
printf("|+ wfrow\\l");
|
||||
printf(" - lcu_offset_y = %d\\l", state->wfrow->lcu_offset_y);
|
||||
}
|
||||
printf("}\"\n");
|
||||
printf(" ]\n");
|
||||
|
||||
if (state->parent) {
|
||||
printf(" \"%p\" -> \"%p\"\n", state->parent, state);
|
||||
}
|
||||
|
||||
for (i = 0; state->children[i].encoder_control; ++i) {
|
||||
encoder_state_dump_graphviz(&state->children[i]);
|
||||
}
|
||||
|
||||
if (!state->parent) {
|
||||
printf("}\n");
|
||||
//Empty lines (easier to copy-paste)
|
||||
printf("\n\n\n\n\n");
|
||||
}
|
||||
}
|
||||
#endif //KVZ_DEBUG_PRINT_THREADING_INFO
|
76
src/debug.h
Normal file
76
src/debug.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*****************************************************************************
|
||||
* This file is part of uvg266 VVC encoder.
|
||||
*
|
||||
* Copyright (c) 2021, Tampere University, ITU/ISO/IEC, project contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the Tampere University or ITU/ISO/IEC nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
|
||||
#ifdef KVZ_DEBUG_PRINT_YUVIEW_CSV
|
||||
|
||||
enum {
|
||||
DBG_YUVIEW_INTRADIR_LUMA = 1,
|
||||
DBG_YUVIEW_INTRADIR_CHROMA = 2,
|
||||
DBG_YUVIEW_REFIDX_SKIP_L0 = 3,
|
||||
DBG_YUVIEW_REFIDX_SKIP_L1 = 4,
|
||||
DBG_YUVIEW_REFIDX_MERGE_L0 = 5,
|
||||
DBG_YUVIEW_REFIDX_MERGE_L1 = 6,
|
||||
DBG_YUVIEW_REFIDX_INTER_L0 = 7,
|
||||
DBG_YUVIEW_REFIDX_INTER_L1 = 8,
|
||||
DBG_YUVIEW_MVSKIP_L0 = 9,
|
||||
DBG_YUVIEW_MVSKIP_L1 = 10,
|
||||
DBG_YUVIEW_MVMERGE_L0 = 11,
|
||||
DBG_YUVIEW_MVMERGE_L1 = 12,
|
||||
DBG_YUVIEW_MVINTER_L0 = 13,
|
||||
DBG_YUVIEW_MVINTER_L1 = 14,
|
||||
DBG_YUVIEW_NUM_SIG_COEFF_Y = 15,
|
||||
DBG_YUVIEW_NUM_SIG_COEFF_U = 16,
|
||||
DBG_YUVIEW_NUM_SIG_COEFF_V = 17,
|
||||
};
|
||||
|
||||
typedef struct encoder_state_t encoder_state_t;
|
||||
typedef struct encoder_control_t encoder_control_t;
|
||||
|
||||
void kvz_dbg_yuview_init(const encoder_control_t* const encoder, char* filename, char* sequence);
|
||||
void kvz_dbg_yuview_add_vector(const encoder_state_t* const state, int x, int y, int width, int height, int type, int x_vec, int y_vec);
|
||||
void kvz_dbg_yuview_add(const encoder_state_t* const state, int x, int y, int width, int height, int type, int val);
|
||||
void kvz_dbg_yuview_cleanup();
|
||||
|
||||
#define DBG_YUVIEW_INIT(_encoder, _filename, _sequence) kvz_dbg_yuview_init(_encoder, _filename, _sequence);
|
||||
#define DBG_YUVIEW_MV(_type, _x, _y, _width, _height, _x_vec, _y_vec) kvz_dbg_yuview_add_vector(state, _type, _x, _y, _width, _height, _x_vec, _y_vec);
|
||||
#define DBG_YUVIEW_CLEANUP() kvz_dbg_yuview_cleanup();
|
||||
#else
|
||||
#define DBG_YUVIEW_INIT(_filename, _sequence)
|
||||
#define DBG_YUVIEW_MV(_type, _x, _y, _width, _height, _x_vec, _y_vec)
|
||||
#define DBG_YUVIEW_CLEANUP()
|
||||
#endif //KVZ_DEBUG_PRINT_YUVIEW_CSV
|
||||
|
||||
#ifdef KVZ_DEBUG_PRINT_THREADING_INFO
|
||||
void kvz_dbg_encoder_state_dump_graphviz(const encoder_state_t* const state)
|
||||
#endif //KVZ_DEBUG_PRINT_THREADING_INFO
|
|
@ -55,6 +55,7 @@
|
|||
|
||||
#include "checkpoint.h"
|
||||
#include "cli.h"
|
||||
#include "debug.h"
|
||||
#include "encoder.h"
|
||||
#include "kvazaar.h"
|
||||
#include "kvazaar_internal.h"
|
||||
|
@ -549,6 +550,10 @@ int main(int argc, char *argv[])
|
|||
goto exit_failure;
|
||||
}
|
||||
|
||||
#ifdef KVZ_DEBUG_PRINT_YUVIEW_CSV
|
||||
if (opts->debug != NULL) DBG_YUVIEW_INIT(encoder, opts->debug, opts->input);
|
||||
#endif
|
||||
|
||||
//Now, do the real stuff
|
||||
{
|
||||
|
||||
|
@ -819,6 +824,7 @@ done:
|
|||
if (output) fclose(output);
|
||||
if (recout) fclose(recout);
|
||||
|
||||
DBG_YUVIEW_CLEANUP();
|
||||
CHECKPOINTS_FINALIZE();
|
||||
|
||||
return retval;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "cabac.h"
|
||||
#include "context.h"
|
||||
#include "cu.h"
|
||||
#include "debug.h"
|
||||
#include "encoder.h"
|
||||
#include "global.h"
|
||||
#include "imagelist.h"
|
||||
|
@ -625,6 +626,10 @@ static bool encode_inter_prediction_unit(encoder_state_t * const state,
|
|||
if (symbol == 0) break;
|
||||
}
|
||||
}
|
||||
#ifdef KVZ_DEBUG_PRINT_YUVIEW_CSV
|
||||
if (cur_cu->inter.mv_dir & 1) DBG_YUVIEW_MV(DBG_YUVIEW_MVMERGE_L0, x, y, width, height, cur_cu->inter.mv[0][0] >> INTERNAL_MV_PREC, cur_cu->inter.mv[0][1] >> INTERNAL_MV_PREC);
|
||||
if (cur_cu->inter.mv_dir & 2) DBG_YUVIEW_MV(DBG_YUVIEW_MVMERGE_L1, x, y, width, height, cur_cu->inter.mv[1][0] >> INTERNAL_MV_PREC, cur_cu->inter.mv[1][1] >> INTERNAL_MV_PREC);
|
||||
#endif
|
||||
} else {
|
||||
if (state->frame->slicetype == KVZ_SLICE_B) {
|
||||
// Code Inter Dir
|
||||
|
@ -646,7 +651,7 @@ static bool encode_inter_prediction_unit(encoder_state_t * const state,
|
|||
if (!(cur_cu->inter.mv_dir & (1 << ref_list_idx))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
DBG_YUVIEW_MV(ref_list_idx ? DBG_YUVIEW_MVINTER_L0 : DBG_YUVIEW_MVINTER_L1, x, y, width, height, cur_cu->inter.mv[ref_list_idx][0] >> INTERNAL_MV_PREC, cur_cu->inter.mv[ref_list_idx][1] >> INTERNAL_MV_PREC);
|
||||
// size of the current reference index list (L0/L1)
|
||||
uint8_t ref_LX_size = state->frame->ref_LX_size[ref_list_idx];
|
||||
|
||||
|
@ -1315,6 +1320,11 @@ void kvz_encode_coding_tree(encoder_state_t * const state,
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef KVZ_DEBUG_PRINT_YUVIEW_CSV
|
||||
if (cur_cu->inter.mv_dir & 1) DBG_YUVIEW_MV(DBG_YUVIEW_MVSKIP_L0, abs_x, abs_y, cu_width, cu_width, cur_cu->inter.mv[0][0] >> INTERNAL_MV_PREC, cur_cu->inter.mv[0][1] >> INTERNAL_MV_PREC);
|
||||
if (cur_cu->inter.mv_dir & 2) DBG_YUVIEW_MV(DBG_YUVIEW_MVSKIP_L1, abs_x, abs_y, cu_width, cu_width, cur_cu->inter.mv[1][0] >> INTERNAL_MV_PREC, cur_cu->inter.mv[1][1] >> INTERNAL_MV_PREC);
|
||||
#endif
|
||||
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "bitstream.h"
|
||||
#include "cabac.h"
|
||||
#include "cu.h"
|
||||
#include "debug.h"
|
||||
#include "encoder.h"
|
||||
#include "encoder_state-geometry.h"
|
||||
#include "encoderstate.h"
|
||||
|
@ -231,129 +232,6 @@ static int encoder_state_config_wfrow_init(encoder_state_t * const state,
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef KVZ_DEBUG_PRINT_THREADING_INFO
|
||||
static void encoder_state_dump_graphviz(const encoder_state_t * const state) {
|
||||
int i;
|
||||
|
||||
if (!state->parent) {
|
||||
const encoder_control_t * const encoder = state->encoder_control;
|
||||
int y,x;
|
||||
//Empty lines (easier to copy-paste)
|
||||
printf("\n\n\n\n\n");
|
||||
//Some styling...
|
||||
printf("digraph EncoderStates {\n");
|
||||
printf(" fontname = \"Bitstream Vera Sans\"\n");
|
||||
printf(" fontsize = 8\n\n");
|
||||
printf(" node [\n");
|
||||
printf(" fontname = \"Bitstream Vera Sans\"\n");
|
||||
printf(" fontsize = 8\n");
|
||||
printf(" shape = \"record\"\n");
|
||||
printf(" ]\n\n");
|
||||
printf(" edge [\n");
|
||||
printf(" arrowtail = \"empty\"\n");
|
||||
printf(" ]\n\n");
|
||||
|
||||
printf(" \"Map\" [\n");
|
||||
printf(" shape=plaintext\n");
|
||||
printf(" label = <<table cellborder=\"1\" cellspacing=\"0\" border=\"0\">");
|
||||
printf("<tr><td colspan=\"%d\" height=\"20\" valign=\"bottom\"><b>RS Map</b></td></tr>", encoder->in.width_in_lcu);
|
||||
for (y = 0; y < encoder->in.height_in_lcu; ++y) {
|
||||
printf("<tr>");
|
||||
for (x = 0; x < encoder->in.width_in_lcu; ++x) {
|
||||
const int lcu_id_rs = y * encoder->in.width_in_lcu + x;
|
||||
|
||||
printf("<td>%d</td>", lcu_id_rs);
|
||||
}
|
||||
printf("</tr>");
|
||||
}
|
||||
printf("<tr><td colspan=\"%d\" height=\"20\" valign=\"bottom\"><b>TS Map</b></td></tr>", encoder->in.width_in_lcu);
|
||||
for (y = 0; y < encoder->in.height_in_lcu; ++y) {
|
||||
printf("<tr>");
|
||||
for (x = 0; x < encoder->in.width_in_lcu; ++x) {
|
||||
const int lcu_id_rs = y * encoder->in.width_in_lcu + x;
|
||||
const int lcu_id_ts = encoder->tiles_ctb_addr_rs_to_ts[lcu_id_rs];
|
||||
|
||||
printf("<td>%d</td>", lcu_id_ts);
|
||||
}
|
||||
printf("</tr>");
|
||||
}
|
||||
printf("<tr><td colspan=\"%d\" height=\"20\" valign=\"bottom\"><b>Tile map</b></td></tr>", encoder->in.width_in_lcu);
|
||||
for (y = 0; y < encoder->in.height_in_lcu; ++y) {
|
||||
printf("<tr>");
|
||||
for (x = 0; x < encoder->in.width_in_lcu; ++x) {
|
||||
const int lcu_id_rs = y * encoder->in.width_in_lcu + x;
|
||||
const int lcu_id_ts = encoder->tiles_ctb_addr_rs_to_ts[lcu_id_rs];
|
||||
|
||||
printf("<td>%d</td>", encoder->tiles_tile_id[lcu_id_ts]);
|
||||
}
|
||||
printf("</tr>");
|
||||
}
|
||||
printf("<tr><td colspan=\"%d\" height=\"20\" valign=\"bottom\"><b>Slice map</b></td></tr>", encoder->in.width_in_lcu);
|
||||
for (y = 0; y < encoder->in.height_in_lcu; ++y) {
|
||||
printf("<tr>");
|
||||
for (x = 0; x < encoder->in.width_in_lcu; ++x) {
|
||||
const int lcu_id_rs = y * encoder->in.width_in_lcu + x;
|
||||
const int lcu_id_ts = encoder->tiles_ctb_addr_rs_to_ts[lcu_id_rs];
|
||||
int slice_id = 0;
|
||||
|
||||
//Not efficient, but who cares
|
||||
for (i=0; i < encoder->slice_count; ++i) {
|
||||
if (encoder->slice_addresses_in_ts[i] <= lcu_id_ts) {
|
||||
slice_id = i;
|
||||
}
|
||||
}
|
||||
|
||||
printf("<td>%d</td>", slice_id);
|
||||
}
|
||||
printf("</tr>");
|
||||
}
|
||||
printf("</table>>\n ]\n");
|
||||
}
|
||||
|
||||
printf(" \"%p\" [\n", state);
|
||||
printf(" label = \"{encoder_state|");
|
||||
printf("+ type=%c\\l", state->type);
|
||||
if (!state->parent || state->frame != state->parent->global) {
|
||||
printf("|+ global\\l");
|
||||
}
|
||||
if (!state->parent || state->tile != state->parent->tile) {
|
||||
printf("|+ tile\\l");
|
||||
printf(" - id = %d\\l", state->tile->id);
|
||||
printf(" - lcu_offset_x = %d\\l", state->tile->lcu_offset_x);
|
||||
printf(" - lcu_offset_y = %d\\l", state->tile->lcu_offset_y);
|
||||
printf(" - lcu_offset_in_ts = %d\\l", state->tile->lcu_offset_in_ts);
|
||||
}
|
||||
if (!state->parent || state->slice != state->parent->slice) {
|
||||
printf("|+ slice\\l");
|
||||
printf(" - id = %d\\l", state->slice->id);
|
||||
printf(" - start_in_ts = %d\\l", state->slice->start_in_ts);
|
||||
printf(" - end_in_ts = %d\\l", state->slice->end_in_ts);
|
||||
printf(" - start_in_rs = %d\\l", state->slice->start_in_rs);
|
||||
printf(" - end_in_rs = %d\\l", state->slice->end_in_rs);
|
||||
}
|
||||
if (!state->parent || state->wfrow != state->parent->wfrow) {
|
||||
printf("|+ wfrow\\l");
|
||||
printf(" - lcu_offset_y = %d\\l", state->wfrow->lcu_offset_y);
|
||||
}
|
||||
printf("}\"\n");
|
||||
printf(" ]\n");
|
||||
|
||||
if (state->parent) {
|
||||
printf(" \"%p\" -> \"%p\"\n", state->parent, state);
|
||||
}
|
||||
|
||||
for (i = 0; state->children[i].encoder_control; ++i) {
|
||||
encoder_state_dump_graphviz(&state->children[i]);
|
||||
}
|
||||
|
||||
if (!state->parent) {
|
||||
printf("}\n");
|
||||
//Empty lines (easier to copy-paste)
|
||||
printf("\n\n\n\n\n");
|
||||
}
|
||||
}
|
||||
#endif //KVZ_DEBUG_PRINT_THREADING_INFO
|
||||
|
||||
/**
|
||||
* \brief Initializer for main thread related things
|
||||
mostly arrays that are only needed one per frame
|
||||
|
@ -800,7 +678,7 @@ int kvz_encoder_state_init(encoder_state_t * const child_state, encoder_state_t
|
|||
}
|
||||
|
||||
#ifdef KVZ_DEBUG_PRINT_THREADING_INFO
|
||||
if (!parent_state) encoder_state_dump_graphviz(child_state);
|
||||
if (!parent_state) kvz_dbg_encoder_state_dump_graphviz(child_state);
|
||||
#endif //KVZ_DEBUG_PRINT_THREADING_INFO
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -62,9 +62,6 @@
|
|||
#include <string.h>
|
||||
|
||||
|
||||
// VVC related definitions
|
||||
#define ENABLE_WPP_PARALLELISM 0
|
||||
|
||||
//LMCS
|
||||
#define PIC_CODE_CW_BINS 16
|
||||
#define PIC_ANALYZE_CW_BINS 32
|
||||
|
@ -133,6 +130,8 @@ typedef int16_t mv_t;
|
|||
//#define KVZ_DEBUG_PRINT_CABAC 1
|
||||
//#define KVZ_DEBUG 1
|
||||
|
||||
//#define KVZ_DEBUG_PRINT_YUVIEW_CSV 1
|
||||
|
||||
/* CONFIG VARIABLES */
|
||||
|
||||
//spec: references to variables defined in Rec. ITU-T H.265 (04/2013)
|
||||
|
|
|
@ -129,18 +129,6 @@ void kvz_encode_coeff_nxn_generic(encoder_state_t * const state,
|
|||
int32_t cg_pos_y = cg_blk_pos / (MIN((uint8_t)32, width) >> (log2_cg_size / 2));
|
||||
int32_t cg_pos_x = cg_blk_pos - (cg_pos_y * (MIN((uint8_t)32, width) >> (log2_cg_size / 2)));
|
||||
|
||||
|
||||
/*if (type == 0 && width <= 32) {
|
||||
if ((width == 32 && (cg_pos_x >= (16 >> clipped_log2_size))) || (width == 32 && (cg_pos_y >= (16 >> clipped_log2_size)))) {
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// !!! residual_coding_subblock() !!!
|
||||
|
||||
// Encode significant coeff group flag when not the last or the first
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#ifndef THREADQUEUE_H_
|
||||
#define THREADQUEUE_H_
|
||||
/*****************************************************************************
|
||||
* This file is part of uvg266 VVC encoder.
|
||||
*
|
||||
|
@ -31,6 +29,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* \ingroup Threading
|
||||
|
@ -59,5 +58,3 @@ void kvz_threadqueue_free_job(threadqueue_job_t **job_ptr);
|
|||
int kvz_threadqueue_waitfor(threadqueue_queue_t * threadqueue, threadqueue_job_t * job);
|
||||
int kvz_threadqueue_stop(threadqueue_queue_t * threadqueue);
|
||||
void kvz_threadqueue_free(threadqueue_queue_t * threadqueue);
|
||||
|
||||
#endif // THREADQUEUE_H_
|
||||
|
|
Loading…
Reference in a new issue