Change mv_t to int32_t because of possible overflow in large videos

This commit is contained in:
Marko Viitanen 2022-07-20 10:00:15 +03:00
parent 721346542f
commit b7b7c22e44
6 changed files with 14 additions and 14 deletions

View file

@ -126,7 +126,7 @@
typedef int16_t coeff_t; typedef int16_t coeff_t;
typedef int16_t mv_t; typedef int32_t mv_t;
//#define VERBOSE 1 //#define VERBOSE 1
//#define UVG_DEBUG_PRINT_CABAC 1 //#define UVG_DEBUG_PRINT_CABAC 1

View file

@ -1492,7 +1492,7 @@ static void search_pu_inter_bipred(inter_search_info_t *info,
bipred_pu->inter.mv_ref[0] = merge_cand[i].ref[0]; bipred_pu->inter.mv_ref[0] = merge_cand[i].ref[0];
bipred_pu->inter.mv_ref[1] = merge_cand[j].ref[1]; bipred_pu->inter.mv_ref[1] = merge_cand[j].ref[1];
int16_t(*mv)[2] = bipred_pu->inter.mv; mv_t(*mv)[2] = bipred_pu->inter.mv;
mv[0][0] = merge_cand[i].mv[0][0]; mv[0][0] = merge_cand[i].mv[0][0];
mv[0][1] = merge_cand[i].mv[0][1]; mv[0][1] = merge_cand[i].mv[0][1];
mv[1][0] = merge_cand[j].mv[1][0]; mv[1][0] = merge_cand[j].mv[1][0];
@ -1967,7 +1967,7 @@ static void search_pu_inter(encoder_state_t * const state,
bipred_pu->inter.mv_ref[0] = best_unipred[0]->inter.mv_ref[0]; bipred_pu->inter.mv_ref[0] = best_unipred[0]->inter.mv_ref[0];
bipred_pu->inter.mv_ref[1] = best_unipred[1]->inter.mv_ref[1]; bipred_pu->inter.mv_ref[1] = best_unipred[1]->inter.mv_ref[1];
int16_t (*mv)[2] = bipred_pu->inter.mv; mv_t (*mv)[2] = bipred_pu->inter.mv;
mv[0][0] = best_unipred[0]->inter.mv[0][0]; mv[0][0] = best_unipred[0]->inter.mv[0][0];
mv[0][1] = best_unipred[0]->inter.mv[0][1]; mv[0][1] = best_unipred[0]->inter.mv[0][1];
mv[1][0] = best_unipred[1]->inter.mv[1][0]; mv[1][0] = best_unipred[1]->inter.mv[1][0];

View file

@ -1224,7 +1224,7 @@ static void uvg_sample_octpel_chroma_hi_avx2(const encoder_control_t *const enco
int16_t dst_stride, int16_t dst_stride,
int8_t hor_flag, int8_t hor_flag,
int8_t ver_flag, int8_t ver_flag,
const int16_t mv[2]) const mv_t mv[2])
{ {
// TODO: Optimizations for rest of the blocks (for example 2x8). // TODO: Optimizations for rest of the blocks (for example 2x8).
if (width % 4 != 0) { if (width % 4 != 0) {

View file

@ -140,7 +140,7 @@ void uvg_sample_quarterpel_luma_generic(const encoder_control_t * const encoder,
int16_t dst_stride, int16_t dst_stride,
int8_t hor_flag, int8_t hor_flag,
int8_t ver_flag, int8_t ver_flag,
const int16_t mv[2]) const mv_t mv[2])
{ {
//TODO: horizontal and vertical only filtering //TODO: horizontal and vertical only filtering
int32_t x, y; int32_t x, y;
@ -177,7 +177,7 @@ void uvg_sample_quarterpel_luma_generic(const encoder_control_t * const encoder,
} }
} }
void uvg_sample_quarterpel_luma_hi_generic(const encoder_control_t * const encoder, uvg_pixel *src, int16_t src_stride, int width, int height, int16_t *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]) void uvg_sample_quarterpel_luma_hi_generic(const encoder_control_t * const encoder, uvg_pixel *src, int16_t src_stride, int width, int height, int16_t *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const mv_t mv[2])
{ {
//TODO: horizontal and vertical only filtering //TODO: horizontal and vertical only filtering
int32_t x, y; int32_t x, y;
@ -687,7 +687,7 @@ void uvg_sample_octpel_chroma_generic(const encoder_control_t * const encoder,
int16_t dst_stride, int16_t dst_stride,
int8_t hor_flag, int8_t hor_flag,
int8_t ver_flag, int8_t ver_flag,
const int16_t mv[2]) const mv_t mv[2])
{ {
//TODO: horizontal and vertical only filtering //TODO: horizontal and vertical only filtering
int32_t x, y; int32_t x, y;
@ -724,7 +724,7 @@ void uvg_sample_octpel_chroma_generic(const encoder_control_t * const encoder,
} }
} }
void uvg_sample_octpel_chroma_hi_generic(const encoder_control_t * const encoder, uvg_pixel *src, int16_t src_stride, int width, int height, int16_t *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]) void uvg_sample_octpel_chroma_hi_generic(const encoder_control_t * const encoder, uvg_pixel *src, int16_t src_stride, int width, int height, int16_t *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const mv_t mv[2])
{ {
//TODO: horizontal and vertical only filtering //TODO: horizontal and vertical only filtering
int32_t x, y; int32_t x, y;

View file

@ -43,10 +43,10 @@
#include "uvg266.h" #include "uvg266.h"
int uvg_strategy_register_ipol_generic(void* opaque, uint8_t bitdepth); int uvg_strategy_register_ipol_generic(void* opaque, uint8_t bitdepth);
void uvg_sample_quarterpel_luma_generic(const encoder_control_t * const encoder, uvg_pixel *src, int16_t src_stride, int width, int height, uvg_pixel *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]); void uvg_sample_quarterpel_luma_generic(const encoder_control_t * const encoder, uvg_pixel *src, int16_t src_stride, int width, int height, uvg_pixel *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const mv_t mv[2]);
void uvg_sample_quarterpel_luma_hi_generic(const encoder_control_t * const encoder, uvg_pixel *src, int16_t src_stride, int width, int height, int16_t *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]); void uvg_sample_quarterpel_luma_hi_generic(const encoder_control_t * const encoder, uvg_pixel *src, int16_t src_stride, int width, int height, int16_t *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const mv_t mv[2]);
void uvg_sample_octpel_chroma_generic(const encoder_control_t * const encoder, uvg_pixel *src, int16_t src_stride, int width, int height, uvg_pixel *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]); void uvg_sample_octpel_chroma_generic(const encoder_control_t * const encoder, uvg_pixel *src, int16_t src_stride, int width, int height, uvg_pixel *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const mv_t mv[2]);
void uvg_sample_octpel_chroma_hi_generic(const encoder_control_t * const encoder, uvg_pixel *src, int16_t src_stride, int width, int height, int16_t *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]); void uvg_sample_octpel_chroma_hi_generic(const encoder_control_t * const encoder, uvg_pixel *src, int16_t src_stride, int width, int height, int16_t *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const mv_t mv[2]);
#endif //STRATEGIES_IPOL_GENERIC_H_ #endif //STRATEGIES_IPOL_GENERIC_H_

View file

@ -109,7 +109,7 @@ typedef void(uvg_sample_14bit_quarterpel_luma_func)(const encoder_control_t * co
int16_t dst_stride, int16_t dst_stride,
int8_t hor_flag, int8_t hor_flag,
int8_t ver_flag, int8_t ver_flag,
const int16_t mv[2]); const mv_t mv[2]);
typedef void(uvg_sample_14bit_octpel_chroma_func)(const encoder_control_t *const encoder, typedef void(uvg_sample_14bit_octpel_chroma_func)(const encoder_control_t *const encoder,
uvg_pixel *src, uvg_pixel *src,
@ -120,7 +120,7 @@ typedef void(uvg_sample_14bit_octpel_chroma_func)(const encoder_control_t *const
int16_t dst_stride, int16_t dst_stride,
int8_t hor_flag, int8_t hor_flag,
int8_t ver_flag, int8_t ver_flag,
const int16_t mv[2]); const mv_t mv[2]);
// Declare function pointers. // Declare function pointers.
extern ipol_blocks_func * uvg_filter_hpel_blocks_hor_ver_luma; extern ipol_blocks_func * uvg_filter_hpel_blocks_hor_ver_luma;