Skip to content

Commit

Permalink
Merge changes Icfc59932,I3d1ca618,Id3966912,I56f74981,Ia9a5dc5e, ... …
Browse files Browse the repository at this point in the history
…into main

* changes:
  vpx_encoder.h: make flag constants unsigned
  vp8,VP8_COMP: normalize segment_encode_breakout type
  webmdec,WebmInputContext: make timestamp_ns signed
  highbd_quantize_intrin_sse2: quiet int sanitizer warnings
  load_unaligned_u32: use an int w/_mm_cvtsi32_si128
  variance_sse2.c: add some missing casts
  • Loading branch information
jzern authored and Gerrit Code Review committed Aug 18, 2022
2 parents 37dcf75 + 9db0ec6 commit cf5ef2b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions test/encode_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ TEST(EncodeAPI, SetRoi) {
roi.roi_map = roi_map;
// VP8 only. This value isn't range checked.
roi.static_threshold[1] = 1000;
roi.static_threshold[2] = INT_MIN;
roi.static_threshold[3] = INT_MAX;
roi.static_threshold[2] = UINT_MAX / 2 + 1;
roi.static_threshold[3] = UINT_MAX;

for (const auto delta : { -63, -1, 0, 1, 63 }) {
for (int i = 0; i < 8; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion vp8/encoder/onyx_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ typedef struct VP8_COMP {

unsigned char *segmentation_map;
signed char segment_feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS];
int segment_encode_breakout[MAX_MB_SEGMENTS];
unsigned int segment_encode_breakout[MAX_MB_SEGMENTS];

unsigned char *active_map;
unsigned int active_map_enabled;
Expand Down
12 changes: 6 additions & 6 deletions vpx/vpx_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ typedef int64_t vpx_codec_pts_t;
* support frame types that are codec specific (MPEG-1 D-frames for example)
*/
typedef uint32_t vpx_codec_frame_flags_t;
#define VPX_FRAME_IS_KEY 0x1 /**< frame is the start of a GOP */
#define VPX_FRAME_IS_KEY 0x1u /**< frame is the start of a GOP */
/*!\brief frame can be dropped without affecting the stream (no future frame
* depends on this one) */
#define VPX_FRAME_IS_DROPPABLE 0x2
#define VPX_FRAME_IS_DROPPABLE 0x2u
/*!\brief frame should be decoded but will not be shown */
#define VPX_FRAME_IS_INVISIBLE 0x4
#define VPX_FRAME_IS_INVISIBLE 0x4u
/*!\brief this is a fragment of the encoded frame */
#define VPX_FRAME_IS_FRAGMENT 0x8
#define VPX_FRAME_IS_FRAGMENT 0x8u

/*!\brief Error Resilient flags
*
Expand All @@ -132,12 +132,12 @@ typedef uint32_t vpx_codec_frame_flags_t;
*/
typedef uint32_t vpx_codec_er_flags_t;
/*!\brief Improve resiliency against losses of whole frames */
#define VPX_ERROR_RESILIENT_DEFAULT 0x1
#define VPX_ERROR_RESILIENT_DEFAULT 0x1u
/*!\brief The frame partitions are independently decodable by the bool decoder,
* meaning that partitions can be decoded even though earlier partitions have
* been lost. Note that intra prediction is still done over the partition
* boundary. */
#define VPX_ERROR_RESILIENT_PARTITIONS 0x2
#define VPX_ERROR_RESILIENT_PARTITIONS 0x2u

/*!\brief Encoder output packet variants
*
Expand Down
5 changes: 3 additions & 2 deletions vpx_dsp/x86/highbd_quantize_intrin_sse2.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ void vpx_highbd_quantize_b_sse2(const tran_low_t *coeff_ptr, intptr_t count,
const int64_t tmp4 = ((tmp3 * quant_ptr[k != 0]) >> 16) + tmp3;
const uint32_t abs_qcoeff =
(uint32_t)((tmp4 * quant_shift_ptr[k != 0]) >> 16);
qcoeff_ptr[k] = (int)(abs_qcoeff ^ coeff_sign[j]) - coeff_sign[j];
qcoeff_ptr[k] =
(int)(abs_qcoeff ^ (uint32_t)coeff_sign[j]) - coeff_sign[j];
dqcoeff_ptr[k] = qcoeff_ptr[k] * dequant_ptr[k != 0];
if (abs_qcoeff) eob_i = iscan[k] > eob_i ? iscan[k] : eob_i;
}
Expand Down Expand Up @@ -143,7 +144,7 @@ void vpx_highbd_quantize_b_32x32_sse2(
const int64_t tmp2 = ((tmp1 * quant_ptr[rc != 0]) >> 16) + tmp1;
const uint32_t abs_qcoeff =
(uint32_t)((tmp2 * quant_shift_ptr[rc != 0]) >> 15);
qcoeff_ptr[rc] = (int)(abs_qcoeff ^ coeff_sign) - coeff_sign;
qcoeff_ptr[rc] = (int)(abs_qcoeff ^ (uint32_t)coeff_sign) - coeff_sign;
dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0] / 2;
if (abs_qcoeff) eob = iscan[idx_arr[i]] > eob ? iscan[idx_arr[i]] : eob;
}
Expand Down
2 changes: 1 addition & 1 deletion vpx_dsp/x86/mem_sse2.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static INLINE int32_t loadu_int32(const void *src) {
}

static INLINE __m128i load_unaligned_u32(const void *a) {
uint32_t val;
int val;
memcpy(&val, a, sizeof(val));
return _mm_cvtsi32_si128(val);
}
Expand Down
10 changes: 5 additions & 5 deletions vpx_dsp/x86/variance_sse2.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static INLINE void variance_final_512_pel_sse2(__m128i vsse, __m128i vsum,
vsum = _mm_add_epi16(vsum, _mm_srli_si128(vsum, 8));
vsum = _mm_unpacklo_epi16(vsum, vsum);
vsum = _mm_srai_epi32(vsum, 16);
*sum = add32x4_sse2(vsum);
*sum = (int)add32x4_sse2(vsum);
}

static INLINE __m128i sum_to_32bit_sse2(const __m128i sum) {
Expand All @@ -97,7 +97,7 @@ static INLINE __m128i sum_to_32bit_sse2(const __m128i sum) {
// Can handle 1024 pixels' diff sum (such as 32x32)
static INLINE int sum_final_sse2(const __m128i sum) {
const __m128i t = sum_to_32bit_sse2(sum);
return add32x4_sse2(t);
return (int)add32x4_sse2(t);
}

static INLINE void variance4_sse2(const uint8_t *src_ptr, const int src_stride,
Expand Down Expand Up @@ -349,7 +349,7 @@ unsigned int vpx_variance32x64_sse2(const uint8_t *src_ptr, int src_stride,
vsum = _mm_add_epi32(vsum, sum_to_32bit_sse2(vsum16));
}
*sse = add32x4_sse2(vsse);
sum = add32x4_sse2(vsum);
sum = (int)add32x4_sse2(vsum);
return *sse - (unsigned int)(((int64_t)sum * sum) >> 11);
}

Expand All @@ -369,7 +369,7 @@ unsigned int vpx_variance64x32_sse2(const uint8_t *src_ptr, int src_stride,
vsum = _mm_add_epi32(vsum, sum_to_32bit_sse2(vsum16));
}
*sse = add32x4_sse2(vsse);
sum = add32x4_sse2(vsum);
sum = (int)add32x4_sse2(vsum);
return *sse - (unsigned int)(((int64_t)sum * sum) >> 11);
}

Expand All @@ -389,7 +389,7 @@ unsigned int vpx_variance64x64_sse2(const uint8_t *src_ptr, int src_stride,
vsum = _mm_add_epi32(vsum, sum_to_32bit_sse2(vsum16));
}
*sse = add32x4_sse2(vsse);
sum = add32x4_sse2(vsum);
sum = (int)add32x4_sse2(vsum);
return *sse - (unsigned int)(((int64_t)sum * sum) >> 12);
}

Expand Down
2 changes: 1 addition & 1 deletion webmdec.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct WebmInputContext {
const void *block;
int block_frame_index;
int video_track_index;
uint64_t timestamp_ns;
int64_t timestamp_ns;
int is_key_frame;
int reached_eos;
};
Expand Down

0 comments on commit cf5ef2b

Please sign in to comment.