diff options
Diffstat (limited to 'third_party/aom/examples')
-rw-r--r-- | third_party/aom/examples/analyzer.cc | 52 | ||||
-rw-r--r-- | third_party/aom/examples/inspect.c | 45 |
2 files changed, 80 insertions, 17 deletions
diff --git a/third_party/aom/examples/analyzer.cc b/third_party/aom/examples/analyzer.cc index 591aaf25e..ae0801964 100644 --- a/third_party/aom/examples/analyzer.cc +++ b/third_party/aom/examples/analyzer.cc @@ -233,13 +233,17 @@ void AnalyzerPanel::setShowPlane(bool show_plane, int mask) { void AnalyzerPanel::render() { aom_image_t *img = decoder.image; - int y_stride = img->stride[0]; - int cb_stride = img->stride[1]; - int cr_stride = img->stride[2]; + const int hbd = !!(img->fmt & AOM_IMG_FMT_HIGHBITDEPTH); + int y_stride = img->stride[0] >> hbd; + int cb_stride = img->stride[1] >> hbd; + int cr_stride = img->stride[2] >> hbd; int p_stride = 3 * getDisplayWidth(); unsigned char *y_row = img->planes[0]; unsigned char *cb_row = img->planes[1]; unsigned char *cr_row = img->planes[2]; + uint16_t *y_row16 = reinterpret_cast<uint16_t *>(y_row); + uint16_t *cb_row16 = reinterpret_cast<uint16_t *>(cb_row); + uint16_t *cr_row16 = reinterpret_cast<uint16_t *>(cr_row); unsigned char *p_row = pixels; int y_width_padding = decoder.getWidthPadding(); int cb_width_padding = y_width_padding >> 1; @@ -251,6 +255,9 @@ void AnalyzerPanel::render() { unsigned char *y = y_row - y_stride * y_height_padding; unsigned char *cb = cb_row - cb_stride * cb_height_padding; unsigned char *cr = cr_row - cr_stride * cr_height_padding; + uint16_t *y16 = y_row16 - y_stride * y_height_padding; + uint16_t *cb16 = cb_row16 - cb_stride * cb_height_padding; + uint16_t *cr16 = cr_row16 - cr_stride * cr_height_padding; unsigned char *p = p_row; for (int i = 0; i < decoder.getWidth(); i++) { int64_t yval; @@ -260,9 +267,15 @@ void AnalyzerPanel::render() { unsigned rval; unsigned gval; unsigned bval; - yval = *(y - y_width_padding); - cbval = *(cb - cb_width_padding); - crval = *(cr - cr_width_padding); + if (hbd) { + yval = *(y16 - y_width_padding); + cbval = *(cb16 - cb_width_padding); + crval = *(cr16 - cr_width_padding); + } else { + yval = *(y - y_width_padding); + cbval = *(cb - cb_width_padding); + crval = *(cr - cr_width_padding); + } pmask = plane_mask; if (pmask & OD_LUMA_MASK) { yval -= 16; @@ -296,16 +309,29 @@ void AnalyzerPanel::render() { } px_row += p_stride; } - int dc = ((y - y_row) & 1) | (1 - img->x_chroma_shift); - y++; - cb += dc; - cr += dc; + if (hbd) { + int dc = ((y16 - y_row16) & 1) | (1 - img->x_chroma_shift); + y16++; + cb16 += dc; + cr16 += dc; + } else { + int dc = ((y - y_row) & 1) | (1 - img->x_chroma_shift); + y++; + cb += dc; + cr += dc; + } p += zoom * 3; } int dc = -((j & 1) | (1 - img->y_chroma_shift)); - y_row += y_stride; - cb_row += dc & cb_stride; - cr_row += dc & cr_stride; + if (hbd) { + y_row16 += y_stride; + cb_row16 += dc & cb_stride; + cr_row16 += dc & cr_stride; + } else { + y_row += y_stride; + cb_row += dc & cb_stride; + cr_row += dc & cr_stride; + } p_row += zoom * p_stride; } } diff --git a/third_party/aom/examples/inspect.c b/third_party/aom/examples/inspect.c index 294e478af..e5c28711f 100644 --- a/third_party/aom/examples/inspect.c +++ b/third_party/aom/examples/inspect.c @@ -138,7 +138,7 @@ const map_entry refs_map[] = { ENUM(INTRA_FRAME), ENUM(LAST_FRAME), LAST_ENUM }; const map_entry block_size_map[] = { -#if CONFIG_CB4X4 +#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8 ENUM(BLOCK_2X2), ENUM(BLOCK_2X4), ENUM(BLOCK_4X2), #endif ENUM(BLOCK_4X4), ENUM(BLOCK_4X8), ENUM(BLOCK_8X4), @@ -219,6 +219,22 @@ const map_entry prediction_mode_map[] = { ENUM(DC_PRED), ENUM(INTRA_INVALID), LAST_ENUM }; +#if CONFIG_CFL +const map_entry uv_prediction_mode_map[] = { + ENUM(UV_DC_PRED), ENUM(UV_V_PRED), ENUM(UV_H_PRED), + ENUM(UV_D45_PRED), ENUM(UV_D135_PRED), ENUM(UV_D117_PRED), + ENUM(UV_D153_PRED), ENUM(UV_D207_PRED), ENUM(UV_D63_PRED), +#if CONFIG_ALT_INTRA + ENUM(UV_SMOOTH_PRED), +#if CONFIG_SMOOTH_HV + ENUM(UV_SMOOTH_V_PRED), ENUM(UV_SMOOTH_H_PRED), +#endif // CONFIG_SMOOTH_HV +#endif // CONFIG_ALT_INTRA + ENUM(UV_TM_PRED), ENUM(UV_MODE_INVALID), LAST_ENUM +}; +#else +#define uv_prediction_mode_map prediction_mode_map +#endif #define NO_SKIP 0 #define SKIP 1 @@ -254,6 +270,20 @@ int put_str(char *buffer, const char *str) { return i; } +int put_str_with_escape(char *buffer, const char *str) { + int i; + int j = 0; + for (i = 0; str[i] != '\0'; i++) { + if (str[i] < ' ') { + continue; + } else if (str[i] == '"' || str[i] == '\\') { + buffer[j++] = '\\'; + } + buffer[j++] = str[i]; + } + return j; +} + int put_num(char *buffer, char prefix, int num, char suffix) { int i = 0; char *buf = buffer; @@ -491,7 +521,7 @@ void inspect(void *pbi, void *data) { offsetof(insp_mi_data, mode)); } if (layers & UV_MODE_LAYER) { - buf += put_block_info(buf, prediction_mode_map, "uv_mode", + buf += put_block_info(buf, uv_prediction_mode_map, "uv_mode", offsetof(insp_mi_data, uv_mode)); } if (layers & SKIP_LAYER) { @@ -541,8 +571,9 @@ void inspect(void *pbi, void *data) { buf += put_str(buf, " \"config\": {"); buf += put_map(buf, config_map); buf += put_str(buf, "},\n"); - buf += snprintf(buf, MAX_BUFFER, " \"configString\": \"%s\"\n", - aom_codec_build_config()); + buf += put_str(buf, " \"configString\": \""); + buf += put_str_with_escape(buf, aom_codec_build_config()); + buf += put_str(buf, "\"\n"); decoded_frame_count++; buf += put_str(buf, "},\n"); *(buf++) = 0; @@ -603,6 +634,12 @@ EMSCRIPTEN_KEEPALIVE int get_bit_depth() { return img->bit_depth; } EMSCRIPTEN_KEEPALIVE +int get_bits_per_sample() { return img->bps; } + +EMSCRIPTEN_KEEPALIVE +int get_image_format() { return img->fmt; } + +EMSCRIPTEN_KEEPALIVE unsigned char *get_plane(int plane) { return img->planes[plane]; } EMSCRIPTEN_KEEPALIVE |