Commit b041d8a7 authored by Yunqing Wang's avatar Yunqing Wang

Modify lightfield encoding example

Modified the lightfield encoding example to accommodate HW implementation
requirements. Fixed the encoding scheme, generated a bitstream of a list
of references followed by the surrounding large scale tile coded frames.
All large scale tile coded frames use the same uncompressed frame header
and the same set of frame contexts. This example also wrote out the frame
header and frame contexts while encoding a large scale tile frame and
setting EXT_TILE_DEBUG to 1.

Change-Id: I7cc19099195d0a20335d5c6bfb9f493f1bf3a7b2
parent b6e23bc4
......@@ -90,3 +90,20 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
fclose(mvs);
}
void av1_print_uncompressed_frame_header(const uint8_t *data, int size,
const char *filename) {
FILE *hdrFile = fopen(filename, "w");
fwrite(data, size, sizeof(uint8_t), hdrFile);
fclose(hdrFile);
}
void av1_print_frame_contexts(const FRAME_CONTEXT *fc, const char *filename) {
FILE *fcFile = fopen(filename, "w");
const uint16_t *fcp = (uint16_t *)fc;
const unsigned int n_contexts = sizeof(FRAME_CONTEXT) / sizeof(uint16_t);
unsigned int i;
for (i = 0; i < n_contexts; ++i) fprintf(fcFile, "%d ", *fcp++);
fclose(fcFile);
}
......@@ -4808,6 +4808,21 @@ void av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dst, size_t *size) {
}
data += uncompressed_hdr_size + compressed_hdr_size;
#define EXT_TILE_DEBUG 0
#if EXT_TILE_DEBUG
{
char fn[20] = "./fh";
fn[4] = cm->current_video_frame / 100 + '0';
fn[5] = (cm->current_video_frame % 100) / 10 + '0';
fn[6] = (cm->current_video_frame % 10) + '0';
fn[7] = '\0';
av1_print_uncompressed_frame_header(
data - uncompressed_hdr_size - compressed_hdr_size,
uncompressed_hdr_size, fn);
}
#endif // EXT_TILE_DEBUG
#undef EXT_TILE_DEBUG
// Write the encoded tile data
data_size = write_tiles(cpi, data, &max_tile_size, &max_tile_col_size);
} else {
......
......@@ -6664,6 +6664,21 @@ int av1_get_compressed_data(AV1_COMP *cpi, unsigned int *frame_flags,
}
#endif // CONFIG_EXT_TILE
#if CONFIG_EXT_TILE
#define EXT_TILE_DEBUG 0
#if EXT_TILE_DEBUG
if (cm->large_scale_tile && oxcf->pass == 2) {
char fn[20] = "./fc";
fn[4] = cm->current_video_frame / 100 + '0';
fn[5] = (cm->current_video_frame % 100) / 10 + '0';
fn[6] = (cm->current_video_frame % 10) + '0';
fn[7] = '\0';
av1_print_frame_contexts(cm->fc, fn);
}
#endif // EXT_TILE_DEBUG
#undef EXT_TILE_DEBUG
#endif // CONFIG_EXT_TILE
// No frame encoded, or frame was dropped, release scaled references.
if ((*size == 0) && (frame_is_intra_only(cm) == 0)) {
release_scaled_references(cpi);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment