Commit 0a6b1a9f authored by Diego Biurrun's avatar Diego Biurrun

Replace int_fast integer types with their sized standard posix counterparts.

The _fast integer types provide no realworld benefits, but may introduce
portability issues and are just plain ugly.
parent be898457
......@@ -233,15 +233,16 @@ extern const struct dec_2dvlc ff_cavs_chroma_dec[5];
extern const uint8_t ff_cavs_chroma_qp[64];
extern const uint8_t ff_cavs_scan3x3[4];
extern const uint8_t ff_cavs_partition_flags[30];
extern const int_fast8_t ff_left_modifier_l[8];
extern const int_fast8_t ff_top_modifier_l[8];
extern const int_fast8_t ff_left_modifier_c[7];
extern const int_fast8_t ff_top_modifier_c[7];
extern const int8_t ff_left_modifier_l[8];
extern const int8_t ff_top_modifier_l[8];
extern const int8_t ff_left_modifier_c[7];
extern const int8_t ff_top_modifier_c[7];
extern const cavs_vector ff_cavs_intra_mv;
extern const cavs_vector ff_cavs_un_mv;
extern const cavs_vector ff_cavs_dir_mv;
static inline void modify_pred(const int_fast8_t *mod_table, int *mode) {
static inline void modify_pred(const int8_t *mod_table, int *mode)
{
*mode = mod_table[*mode];
if(*mode < 0) {
av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n");
......
......@@ -497,9 +497,9 @@ static const uint8_t tc_tab[64] = {
5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9
};
const int_fast8_t ff_left_modifier_l[8] = { 0,-1, 6,-1,-1, 7, 6, 7};
const int_fast8_t ff_top_modifier_l[8] = {-1, 1, 5,-1,-1, 5, 7, 7};
const int_fast8_t ff_left_modifier_c[7] = { 5,-1, 2,-1, 6, 5, 6};
const int_fast8_t ff_top_modifier_c[7] = { 4, 1,-1,-1, 4, 6, 6};
const int8_t ff_left_modifier_l[8] = { 0, -1, 6, -1, -1, 7, 6, 7 };
const int8_t ff_top_modifier_l[8] = { -1, 1, 5, -1, -1, 5, 7, 7 };
const int8_t ff_left_modifier_c[7] = { 5, -1, 2, -1, 6, 5, 6 };
const int8_t ff_top_modifier_c[7] = { 4, 1, -1, -1, 4, 6, 6 };
#endif /* AVCODEC_CAVSDATA_H */
......@@ -250,7 +250,7 @@ typedef struct FFV1Context{
uint8_t (*initial_states[MAX_QUANT_TABLES])[32];
int run_index;
int colorspace;
int_fast16_t *sample_buffer;
int16_t *sample_buffer;
int gob_count;
int quant_table_count;
......@@ -279,7 +279,8 @@ static av_always_inline int fold(int diff, int bits){
return diff;
}
static inline int predict(int_fast16_t *src, int_fast16_t *last){
static inline int predict(int16_t *src, int16_t *last)
{
const int LT= last[-1];
const int T= last[ 0];
const int L = src[-1];
......@@ -287,7 +288,9 @@ static inline int predict(int_fast16_t *src, int_fast16_t *last){
return mid_pred(L, L + T - LT, T);
}
static inline int get_context(PlaneContext *p, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){
static inline int get_context(PlaneContext *p, int16_t *src,
int16_t *last, int16_t *last2)
{
const int LT= last[-1];
const int T= last[ 0];
const int RT= last[ 1];
......@@ -506,7 +509,10 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state, int
}
#if CONFIG_FFV1_ENCODER
static av_always_inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){
static av_always_inline int encode_line(FFV1Context *s, int w,
int16_t *sample[2],
int plane_index, int bits)
{
PlaneContext * const p= &s->plane[plane_index];
RangeCoder * const c= &s->c;
int x;
......@@ -591,7 +597,7 @@ static av_always_inline int encode_line(FFV1Context *s, int w, int_fast16_t *sam
static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){
int x,y,i;
const int ring_size= s->avctx->context_model ? 3 : 2;
int_fast16_t *sample[3];
int16_t *sample[3];
s->run_index=0;
memset(s->sample_buffer, 0, ring_size*(w+6)*sizeof(*s->sample_buffer));
......@@ -621,7 +627,7 @@ static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
static void encode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
int x, y, p, i;
const int ring_size= s->avctx->context_model ? 3 : 2;
int_fast16_t *sample[3][3];
int16_t *sample[3][3];
s->run_index=0;
memset(s->sample_buffer, 0, ring_size*3*(w+6)*sizeof(*s->sample_buffer));
......@@ -1305,7 +1311,10 @@ static av_cold int common_end(AVCodecContext *avctx){
return 0;
}
static av_always_inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){
static av_always_inline void decode_line(FFV1Context *s, int w,
int16_t *sample[2],
int plane_index, int bits)
{
PlaneContext * const p= &s->plane[plane_index];
RangeCoder * const c= &s->c;
int x;
......@@ -1365,7 +1374,7 @@ static av_always_inline void decode_line(FFV1Context *s, int w, int_fast16_t *sa
static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){
int x, y;
int_fast16_t *sample[2];
int16_t *sample[2];
sample[0]=s->sample_buffer +3;
sample[1]=s->sample_buffer+w+6+3;
......@@ -1374,7 +1383,7 @@ static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
memset(s->sample_buffer, 0, 2*(w+6)*sizeof(*s->sample_buffer));
for(y=0; y<h; y++){
int_fast16_t *temp= sample[0]; //FIXME try a normal buffer
int16_t *temp = sample[0]; //FIXME try a normal buffer
sample[0]= sample[1];
sample[1]= temp;
......@@ -1400,7 +1409,7 @@ static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
static void decode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
int x, y, p;
int_fast16_t *sample[3][2];
int16_t *sample[3][2];
for(x=0; x<3; x++){
sample[x][0] = s->sample_buffer + x*2 *(w+6) + 3;
sample[x][1] = s->sample_buffer + (x*2+1)*(w+6) + 3;
......@@ -1412,7 +1421,7 @@ static void decode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int st
for(y=0; y<h; y++){
for(p=0; p<3; p++){
int_fast16_t *temp= sample[p][0]; //FIXME try a normal buffer
int16_t *temp = sample[p][0]; //FIXME try a normal buffer
sample[p][0]= sample[p][1];
sample[p][1]= temp;
......
......@@ -53,9 +53,7 @@ unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n)
// reasonable to check redundantly.
int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
{
uint_fast32_t exit_at_level[33] = {
404, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
uint32_t exit_at_level[33] = { 404 };
unsigned i, j, p, code;
......@@ -106,7 +104,7 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
#ifdef V_DEBUG
av_log(NULL, AV_LOG_INFO, " %d. code len %d code %d - ", p, bits[p], codes[p]);
init_get_bits(&gb, (uint_fast8_t *)&codes[p], bits[p]);
init_get_bits(&gb, (uint8_t *)&codes[p], bits[p]);
for (i = 0; i < bits[p]; ++i)
av_log(NULL, AV_LOG_INFO, "%s", get_bits1(&gb) ? "1" : "0");
av_log(NULL, AV_LOG_INFO, "\n");
......@@ -206,7 +204,7 @@ static void render_line(int x0, int y0, int x1, int y1, float *buf)
}
void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
uint_fast16_t *y_list, int *flag,
uint16_t *y_list, int *flag,
int multiplier, float *out, int samples)
{
int lx, ly, i;
......
......@@ -30,17 +30,17 @@ extern const uint8_t ff_vorbis_encoding_channel_layout_offsets[8][8];
extern const int64_t ff_vorbis_channel_layouts[9];
typedef struct {
uint_fast16_t x;
uint_fast16_t sort;
uint_fast16_t low;
uint_fast16_t high;
uint16_t x;
uint16_t sort;
uint16_t low;
uint16_t high;
} vorbis_floor1_entry;
void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values);
unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n); // x^(1/n)
int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num);
void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
uint_fast16_t * y_list, int * flag,
uint16_t *y_list, int *flag,
int multiplier, float * out, int samples);
void vorbis_inverse_coupling(float *mag, float *ang, int blocksize);
......
This diff is collapsed.
......@@ -674,7 +674,7 @@ static float get_floor_average(vorbis_enc_floor * fc, float *coeffs, int i)
}
static void floor_fit(vorbis_enc_context *venc, vorbis_enc_floor *fc,
float *coeffs, uint_fast16_t *posts, int samples)
float *coeffs, uint16_t *posts, int samples)
{
int range = 255 / fc->multiplier + 1;
int i;
......@@ -706,7 +706,7 @@ static int render_point(int x0, int y0, int x1, int y1, int x)
}
static void floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc,
PutBitContext *pb, uint_fast16_t *posts,
PutBitContext *pb, uint16_t *posts,
float *floor, int samples)
{
int range = 255 / fc->multiplier + 1;
......@@ -1010,7 +1010,7 @@ static int vorbis_encode_frame(AVCodecContext *avccontext,
for (i = 0; i < venc->channels; i++) {
vorbis_enc_floor *fc = &venc->floors[mapping->floor[mapping->mux[i]]];
uint_fast16_t posts[MAX_FLOOR_VALUES];
uint16_t posts[MAX_FLOOR_VALUES];
floor_fit(venc, fc, &venc->coeffs[i * samples], posts, samples);
floor_encode(venc, fc, &pb, posts, &venc->floor[i * samples], samples);
}
......
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