| schroarith.h | | schroarith.h | |
| | | | |
| skipping to change at line 90 | | skipping to change at line 90 | |
| SCHRO_CTX_MV_REF2_V_VALUE, | | SCHRO_CTX_MV_REF2_V_VALUE, | |
| SCHRO_CTX_MV_REF2_V_SIGN, | | SCHRO_CTX_MV_REF2_V_SIGN, | |
| | | | |
| SCHRO_CTX_LAST | | SCHRO_CTX_LAST | |
| }; | | }; | |
| | | | |
| typedef struct _SchroArith SchroArith; | | typedef struct _SchroArith SchroArith; | |
| typedef struct _SchroArithContext SchroArithContext; | | typedef struct _SchroArithContext SchroArithContext; | |
| | | | |
| struct _SchroArithContext { | | struct _SchroArithContext { | |
|
| int next; | | unsigned int next; | |
| int stat_range; | | int stat_range; | |
| int n_bits; | | int n_bits; | |
| int n_symbols; | | int n_symbols; | |
| int ones; | | int ones; | |
| }; | | }; | |
| | | | |
| struct _SchroArith { | | struct _SchroArith { | |
|
| | | SchroBuffer *buffer; | |
| | | uint8_t *dataptr; | |
| | | uintptr_t offset; | |
| | | | |
| uint32_t range[2]; | | uint32_t range[2]; | |
| uint32_t code; | | uint32_t code; | |
| uint32_t range_size; | | uint32_t range_size; | |
|
| uint16_t probabilities[SCHRO_CTX_LAST]; | | | |
| uint8_t shift; | | | |
| uint16_t lut[512]; | | | |
| | | | |
| int cntr; | | int cntr; | |
|
| | | | |
| uint8_t *dataptr; | | | |
| int offset; | | | |
| int carry; | | int carry; | |
|
| SchroArithContext contexts[SCHRO_CTX_LAST]; | | | |
| | | | |
|
| SchroBuffer *buffer; | | uint16_t probabilities[SCHRO_CTX_LAST]; | |
| | | uint16_t lut[512]; | |
| | | SchroArithContext contexts[SCHRO_CTX_LAST]; | |
| }; | | }; | |
| | | | |
| SchroArith * schro_arith_new (void); | | SchroArith * schro_arith_new (void); | |
| void schro_arith_free (SchroArith *arith); | | void schro_arith_free (SchroArith *arith); | |
| void schro_arith_decode_init (SchroArith *arith, SchroBuffer *buffer); | | void schro_arith_decode_init (SchroArith *arith, SchroBuffer *buffer); | |
| void schro_arith_encode_init (SchroArith *arith, SchroBuffer *buffer); | | void schro_arith_encode_init (SchroArith *arith, SchroBuffer *buffer); | |
| void schro_arith_estimate_init (SchroArith *arith); | | void schro_arith_estimate_init (SchroArith *arith); | |
| void schro_arith_flush (SchroArith *arith); | | void schro_arith_flush (SchroArith *arith); | |
| void schro_arith_decode_flush (SchroArith *arith); | | void schro_arith_decode_flush (SchroArith *arith); | |
| | | | |
| void schro_arith_encode_bit (SchroArith *arith, int context, int value); | | void schro_arith_encode_bit (SchroArith *arith, int context, int value); | |
| void schro_arith_encode_uint (SchroArith *arith, int cont_context, | | void schro_arith_encode_uint (SchroArith *arith, int cont_context, | |
| int value_context, int value); | | int value_context, int value); | |
| void schro_arith_encode_sint (SchroArith *arith, int cont_context, | | void schro_arith_encode_sint (SchroArith *arith, int cont_context, | |
| int value_context, int sign_context, int value); | | int value_context, int sign_context, int value); | |
| | | | |
|
| int schro_arith_decode_bit (SchroArith *arith, int context); | | int schro_arith_decode_bit (SchroArith *arith, unsigned int context); | |
| int schro_arith_decode_uint (SchroArith *arith, int cont_context, | | int schro_arith_decode_uint (SchroArith *arith, unsigned int cont_context, | |
| int value_context); | | unsigned int value_context); | |
| int schro_arith_decode_sint (SchroArith *arith, int cont_context, | | int schro_arith_decode_sint (SchroArith *arith, unsigned int cont_context, | |
| int value_context, int sign_context); | | unsigned int value_context, unsigned int sign_context); | |
| | | | |
| void _schro_arith_encode_bit (SchroArith *arith, int context, int | | | |
| value) SCHRO_INTERNAL; | | | |
| void _schro_arith_encode_uint (SchroArith *arith, int cont_context, | | | |
| int value_context, int value) SCHRO_INTERNAL; | | | |
| void _schro_arith_encode_sint (SchroArith *arith, int cont_context, | | | |
| int value_context, int sign_context, int value) SCHRO_INTERNAL; | | | |
| | | | |
|
| int _schro_arith_decode_sint (SchroArith *arith, int cont_context, | | int _schro_arith_decode_sint (SchroArith *arith, unsigned int cont_context, | |
| int value_context, int sign_context) SCHRO_INTERNAL; | | unsigned int value_context, unsigned int sign_context) SCHRO_INTERNAL; | |
| | | | |
| void schro_arith_estimate_bit (SchroArith *arith, int i, int value); | | void schro_arith_estimate_bit (SchroArith *arith, int i, int value); | |
| void schro_arith_estimate_uint (SchroArith *arith, int cont_context, | | void schro_arith_estimate_uint (SchroArith *arith, int cont_context, | |
| int value_context, int value); | | int value_context, int value); | |
| void schro_arith_estimate_sint (SchroArith *arith, int cont_context, | | void schro_arith_estimate_sint (SchroArith *arith, int cont_context, | |
| int value_context, int sign_context, int value); | | int value_context, int sign_context, int value); | |
| | | | |
| #ifdef SCHRO_ARITH_DEFINE_INLINE | | #ifdef SCHRO_ARITH_DEFINE_INLINE | |
|
| static int | | static inline int | |
| _schro_arith_decode_bit (SchroArith *arith, int i) | | _schro_arith_decode_bit (SchroArith *arith, unsigned int i) | |
| { | | { | |
| unsigned int range_x_prob; | | unsigned int range_x_prob; | |
|
| int value; | | unsigned int value; | |
| int lut_index; | | unsigned int lut_index; | |
| | | register unsigned int range = arith->range[1]; | |
| | | register unsigned int code_minus_low = arith->code; | |
| | | | |
|
| range_x_prob = (arith->range[1] * arith->probabilities[i]) >> 16; | | while (range <= 0x40000000) { | |
| lut_index = arith->probabilities[i]>>8; | | | |
| | | range <<= 1; | |
| | | code_minus_low <<= 1; | |
| | | | |
| | | if (!--arith->cntr) { | |
| | | arith->offset++; | |
| | | if (arith->offset < arith->buffer->length) { | |
| | | code_minus_low |= arith->dataptr[arith->offset] << 8; | |
| | | } else { | |
| | | code_minus_low |= 0xff00; | |
| | | } | |
| | | | |
| | | arith->offset++; | |
| | | if (arith->offset < arith->buffer->length) { | |
| | | code_minus_low |= arith->dataptr[arith->offset]; | |
| | | } else { | |
| | | code_minus_low |= 0xff; | |
| | | } | |
| | | | |
| | | arith->cntr = 16; | |
| | | } | |
| | | } | |
| | | | |
| | | range_x_prob = ((range >> 16) * arith->probabilities[i]) & 0xFFFF0000; | |
| | | lut_index = arith->probabilities[i]>>7 & ~1; | |
| | | | |
| | | value = (code_minus_low >= range_x_prob); | |
| | | arith->probabilities[i] += arith->lut[lut_index | value]; | |
| | | | |
|
| value = (arith->code - arith->range[0] >= range_x_prob); | | | |
| arith->probabilities[i] += arith->lut[(value<<8) | lut_index]; | | | |
| if (value) { | | if (value) { | |
|
| arith->range[0] += range_x_prob; | | code_minus_low -= range_x_prob; | |
| | | range -= range_x_prob; | |
| | | } else { | |
| | | range = range_x_prob; | |
| | | } | |
| | | | |
| | | arith->range[1] = range; | |
| | | arith->code = code_minus_low; | |
| | | | |
| | | return value; | |
| | | } | |
| | | | |
| | | static inline int | |
| | | _schro_arith_decode_uint (SchroArith *arith, unsigned int cont_context, | |
| | | unsigned int value_context) | |
| | | { | |
| | | unsigned int bits=1; | |
| | | | |
| | | while(!_schro_arith_decode_bit (arith, cont_context)) { | |
| | | bits <<= 1; | |
| | | bits |= _schro_arith_decode_bit (arith, value_context); | |
| | | cont_context = arith->contexts[cont_context].next; | |
| | | } | |
| | | return bits - 1; | |
| | | } | |
| | | | |
| | | static inline void | |
| | | _schro_arith_encode_bit (SchroArith *arith, int i, int value) | |
| | | { | |
| | | unsigned int range; | |
| | | unsigned int probability0; | |
| | | unsigned int range_x_prob; | |
| | | | |
| | | probability0 = arith->probabilities[i]; | |
| | | range = arith->range[1]; | |
| | | range_x_prob = (range * probability0) >> 16; | |
| | | | |
| | | if (value) { | |
| | | arith->range[0] = arith->range[0] + range_x_prob; | |
| arith->range[1] -= range_x_prob; | | arith->range[1] -= range_x_prob; | |
|
| | | arith->probabilities[i] -= arith->lut[arith->probabilities[i]>>8]; | |
| } else { | | } else { | |
| arith->range[1] = range_x_prob; | | arith->range[1] = range_x_prob; | |
|
| | | arith->probabilities[i] += arith->lut[255-(arith->probabilities[i]>>8)]
; | |
| } | | } | |
| | | | |
| while (arith->range[1] <= 0x4000) { | | while (arith->range[1] <= 0x4000) { | |
| arith->range[0] <<= 1; | | arith->range[0] <<= 1; | |
| arith->range[1] <<= 1; | | arith->range[1] <<= 1; | |
|
| | | | |
| arith->code <<= 1; | | | |
| arith->code |= arith->shift >> (7-arith->cntr)&1; | | | |
| | | | |
| arith->cntr++; | | arith->cntr++; | |
| | | | |
| if (arith->cntr == 8) { | | if (arith->cntr == 8) { | |
|
| arith->offset++; | | if (arith->range[0] < (1<<24) && | |
| if (arith->offset < arith->buffer->length) { | | (arith->range[0] + arith->range[1]) >= (1<<24)) { | |
| arith->shift = arith->dataptr[arith->offset]; | | arith->carry++; | |
| } else { | | } else { | |
|
| arith->shift = 0xff; | | if (arith->range[0] >= (1<<24)) { | |
| | | arith->dataptr[arith->offset-1]++; | |
| | | while (arith->carry) { | |
| | | arith->dataptr[arith->offset] = 0x00; | |
| | | arith->carry--; | |
| | | arith->offset++; | |
| | | } | |
| | | } else { | |
| | | while (arith->carry) { | |
| | | arith->dataptr[arith->offset] = 0xff; | |
| | | arith->carry--; | |
| | | arith->offset++; | |
| | | } | |
| | | } | |
| | | arith->dataptr[arith->offset] = arith->range[0] >> 16; | |
| | | arith->offset++; | |
| } | | } | |
|
| arith->range[0] &= 0xffff; | | | |
| arith->code &= 0xffff; | | | |
| | | | |
|
| if (arith->code < arith->range[0]) { | | arith->range[0] &= 0xffff; | |
| arith->code |= (1<<16); | | | |
| } | | | |
| arith->cntr = 0; | | arith->cntr = 0; | |
| } | | } | |
| } | | } | |
|
| | | } | |
| | | | |
|
| return value; | | static inline int | |
| | | maxbit (unsigned int x) | |
| | | { | |
| | | #if 0 | |
| | | int i; | |
| | | for(i=0;x;i++){ | |
| | | x >>= 1; | |
| | | } | |
| | | return i; | |
| | | #else | |
| | | int i = 0; | |
| | | if (x == 0) return 0; | |
| | | if (x > 0x00ff) { | |
| | | i += 8; | |
| | | x >>= 8; | |
| | | } | |
| | | if (x > 0x000f) { | |
| | | i += 4; | |
| | | x >>= 4; | |
| | | } | |
| | | if (x > 0x0003) { | |
| | | i += 2; | |
| | | x >>= 2; | |
| | | } | |
| | | if (x > 0x0001) { | |
| | | i += 1; | |
| | | x >>= 1; | |
| | | } | |
| | | if (x > 0x0000) { | |
| | | i += 1; | |
| | | } | |
| | | return i; | |
| | | #endif | |
| } | | } | |
| | | | |
|
| static int | | static inline void | |
| _schro_arith_decode_uint (SchroArith *arith, int cont_context, | | _schro_arith_encode_uint (SchroArith *arith, int cont_context, | |
| int value_context) | | int value_context, int value) | |
| { | | { | |
|
| int bits; | | int i; | |
| int count=0; | | int n_bits; | |
| | | | |
|
| bits = 0; | | value++; | |
| while(!_schro_arith_decode_bit (arith, cont_context)) { | | n_bits = maxbit(value); | |
| bits <<= 1; | | for(i=0;i<n_bits - 1;i++){ | |
| bits |= _schro_arith_decode_bit (arith, value_context); | | _schro_arith_encode_bit (arith, cont_context, 0); | |
| | | _schro_arith_encode_bit (arith, value_context, | |
| | | (value>>(n_bits - 2 - i))&1); | |
| cont_context = arith->contexts[cont_context].next; | | cont_context = arith->contexts[cont_context].next; | |
|
| count++; | | } | |
| | | _schro_arith_encode_bit (arith, cont_context, 1); | |
| | | } | |
| | | | |
|
| /* FIXME being careful */ | | static inline void | |
| if (count == 30) break; | | _schro_arith_encode_sint (SchroArith *arith, int cont_context, | |
| | | int value_context, int sign_context, int value) | |
| | | { | |
| | | int sign; | |
| | | | |
| | | if (value < 0) { | |
| | | sign = 1; | |
| | | value = -value; | |
| | | } else { | |
| | | sign = 0; | |
| | | } | |
| | | _schro_arith_encode_uint (arith, cont_context, value_context, value); | |
| | | if (value) { | |
| | | _schro_arith_encode_bit (arith, sign_context, sign); | |
| } | | } | |
|
| return (1<<count) - 1 + bits; | | | |
| } | | } | |
|
| #endif | | | |
| | | #else /* SCHRO_ARITH_DEFINE_INLINE */ | |
| | | int _schro_arith_decode_bit (SchroArith *arith, unsigned int context); | |
| | | int _schro_arith_decode_uint (SchroArith *arith, unsigned int cont_context, | |
| | | unsigned int value_context); | |
| | | void _schro_arith_encode_bit (SchroArith *arith, int context, int | |
| | | value) SCHRO_INTERNAL; | |
| | | void _schro_arith_encode_uint (SchroArith *arith, int cont_context, | |
| | | int value_context, int value) SCHRO_INTERNAL; | |
| | | void _schro_arith_encode_sint (SchroArith *arith, int cont_context, | |
| | | int value_context, int sign_context, int value) SCHRO_INTERNAL; | |
| | | | |
| | | #endif /* SCHRO_ARITH_DEFINE_INLINE */ | |
| | | | |
| #endif | | #endif | |
| | | | |
| SCHRO_END_DECLS | | SCHRO_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 29 change blocks. |
| 61 lines changed or deleted | | 187 lines changed or added | |
|
| schrodecoder.h | | schrodecoder.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| | | | |
| #include <schroedinger/schrobuffer.h> | | #include <schroedinger/schrobuffer.h> | |
| #include <schroedinger/schroparams.h> | | #include <schroedinger/schroparams.h> | |
| #include <schroedinger/schroframe.h> | | #include <schroedinger/schroframe.h> | |
| #include <schroedinger/schromotion.h> | | #include <schroedinger/schromotion.h> | |
| #include <schroedinger/schrounpack.h> | | #include <schroedinger/schrounpack.h> | |
| #include <schroedinger/schrobitstream.h> | | #include <schroedinger/schrobitstream.h> | |
| #include <schroedinger/schroqueue.h> | | #include <schroedinger/schroqueue.h> | |
| #include <schroedinger/schroasync.h> | | #include <schroedinger/schroasync.h> | |
| #include <schroedinger/schroarith.h> | | #include <schroedinger/schroarith.h> | |
|
| | | #include <schroedinger/schrobufferlist.h> | |
| | | #include <schroedinger/schroparse.h> | |
| | | | |
| SCHRO_BEGIN_DECLS | | SCHRO_BEGIN_DECLS | |
| | | | |
| typedef struct _SchroDecoder SchroDecoder; | | typedef struct _SchroDecoder SchroDecoder; | |
|
| | | typedef struct _SchroDecoderInstance SchroDecoderInstance; | |
| typedef struct _SchroPicture SchroPicture; | | typedef struct _SchroPicture SchroPicture; | |
| | | | |
| #ifdef SCHRO_ENABLE_UNSTABLE_API | | #ifdef SCHRO_ENABLE_UNSTABLE_API | |
|
| struct _SchroDecoder { | | | |
| /*< private >*/ | | | |
| | | | |
|
| /* the list of reference pictures */ | | #ifndef SCHRO_OPENGL_TYPEDEF | |
| SchroQueue *reference_queue; | | #define SCHRO_OPENGL_TYPEDEF | |
| | | typedef struct _SchroOpenGL SchroOpenGL; | |
| | | #endif | |
| | | | |
|
| /* a list of frames provided by the app that we'll decode into */ | | struct _SchroDecoder { | |
| SchroQueue *output_queue; | | /*< private >*/ | |
| | | | |
| SchroMemoryDomain *cpu_domain; | | SchroMemoryDomain *cpu_domain; | |
| SchroMemoryDomain *cuda_domain; | | SchroMemoryDomain *cuda_domain; | |
|
| | | SchroMemoryDomain *opengl_domain; | |
| | | | |
| SchroAsync *async; | | SchroAsync *async; | |
|
| | | | |
| int use_cuda; | | int use_cuda; | |
|
| | | SchroOpenGL *opengl; | |
| | | int use_opengl; | |
| | | | |
|
| SchroBuffer *input_buffer; | | double skip_value; | |
| | | double skip_ratio; | |
| | | int earliest_frame; | |
| | | | |
|
| SchroPictureNumber next_frame_number; | | /* output pictures in coded order */ | |
| | | int coded_order; | |
| | | | |
|
| SchroPicture *picture; | | int error; | |
| | | char *error_message; | |
| | | | |
| | | SchroBufferList *input_buflist; | |
| | | SchroParseSyncState *sps; | |
| | | | |
| | | /* private data that is supplied with the input bitstream and | |
| | | * is to be associated with the next picture to occur */ | |
| | | SchroTag *next_picture_tag; | |
| | | | |
| | | SchroDecoderInstance *instance; | |
| | | }; | |
| | | | |
| | | struct _SchroDecoderInstance { | |
| | | /*< private >*/ | |
| | | | |
| | | /* the decoder this sequence instance belongs to */ | |
| | | SchroDecoder *decoder; | |
| | | | |
| | | /* the next sequence instance to supercede this | |
| | | * - New instances should be created whenever an EOS | |
| | | * is detected at the input to the decoder | |
| | | * - Old instances should be deleted whenever their | |
| | | * state would cause an EOS to be emitted */ | |
| | | SchroDecoderInstance *next; | |
| | | | |
| | | /* the list of reference pictures */ | |
| | | SchroQueue *reference_queue; | |
| | | | |
| | | /* a list of frames provided by the app that we'll decode into */ | |
| | | /* xxx: maybe this belongs in Decoder and not per instance */ | |
| | | SchroQueue *output_queue; | |
| | | | |
| | | /* the last picture number to be emitted by decoder_pull(). | |
| | | * used to determine if a stream jumps backwards */ | |
| | | SchroPictureNumber last_picture_number; | |
| | | int last_picture_number_valid; | |
| | | | |
| int major_version; | | int major_version; | |
| int minor_version; | | int minor_version; | |
| int profile; | | int profile; | |
| int level; | | int level; | |
| SchroVideoFormat video_format; | | SchroVideoFormat video_format; | |
|
| | | int compat_quant_offset; | |
| | | | |
|
| SchroQueue *frame_queue; | | SchroQueue *reorder_queue; | |
| SchroQueue *picture_queue; | | int reorder_queue_size; | |
| | | | |
|
| int queue_depth; | | | |
| int end_of_stream; | | int end_of_stream; | |
| int flushing; | | int flushing; | |
|
| int coded_order; | | | |
| | | | |
| SchroPictureNumber earliest_frame; | | | |
| | | | |
| SchroUnpack unpack; | | | |
| int parse_code; | | | |
| int next_parse_offset; | | | |
| int prev_parse_offset; | | | |
| | | | |
|
| | | int first_sequence_header; | |
| int have_sequence_header; | | int have_sequence_header; | |
| SchroBuffer *sequence_header_buffer; | | SchroBuffer *sequence_header_buffer; | |
| int have_frame_number; | | int have_frame_number; | |
| | | | |
|
| double skip_value; | | | |
| double skip_ratio; | | | |
| | | | |
| int error; | | | |
| char *error_message; | | | |
| | | | |
| int has_md5; | | int has_md5; | |
| uint8_t md5_checksum[32]; | | uint8_t md5_checksum[32]; | |
| }; | | }; | |
| | | | |
| struct _SchroPicture { | | struct _SchroPicture { | |
| int refcount; | | int refcount; | |
| | | | |
|
| SchroDecoder *decoder; | | SchroDecoderInstance *decoder_instance; | |
| | | | |
|
| unsigned int state; | | | |
| unsigned int needed_state; | | | |
| unsigned int working; | | | |
| int busy; | | int busy; | |
| int skip; | | int skip; | |
| int error; | | int error; | |
| | | | |
| SchroBuffer *input_buffer; | | SchroBuffer *input_buffer; | |
| SchroParams params; | | SchroParams params; | |
| SchroPictureNumber picture_number; | | SchroPictureNumber picture_number; | |
| SchroPictureNumber reference1; | | SchroPictureNumber reference1; | |
| SchroPictureNumber reference2; | | SchroPictureNumber reference2; | |
| SchroPictureNumber retired_picture_number; | | SchroPictureNumber retired_picture_number; | |
| SchroPicture *ref0; | | SchroPicture *ref0; | |
| SchroPicture *ref1; | | SchroPicture *ref1; | |
| SchroFrame *planar_output_frame; | | SchroFrame *planar_output_frame; | |
| | | | |
|
| int is_ref; | | SchroAsyncStage stages[9]; | |
| | | | |
|
| int16_t *tmpbuf; | | int is_ref; | |
| | | | |
| int zero_residual; | | int zero_residual; | |
| | | | |
| SchroFrame *transform_frame; | | SchroFrame *transform_frame; | |
| SchroFrame *frame; | | SchroFrame *frame; | |
| SchroFrame *mc_tmp_frame; | | SchroFrame *mc_tmp_frame; | |
| SchroMotion *motion; | | SchroMotion *motion; | |
| SchroFrame *output_picture; | | SchroFrame *output_picture; | |
| SchroUpsampledFrame *upsampled_frame; | | SchroUpsampledFrame *upsampled_frame; | |
| | | | |
| | | | |
| skipping to change at line 122 | | skipping to change at line 153 | |
| int subband_quant_index[3][SCHRO_LIMIT_SUBBANDS]; | | int subband_quant_index[3][SCHRO_LIMIT_SUBBANDS]; | |
| SchroBuffer *subband_buffer[3][SCHRO_LIMIT_SUBBANDS]; | | SchroBuffer *subband_buffer[3][SCHRO_LIMIT_SUBBANDS]; | |
| SchroFrameData subband_data[3][SCHRO_LIMIT_SUBBANDS]; | | SchroFrameData subband_data[3][SCHRO_LIMIT_SUBBANDS]; | |
| | | | |
| SchroBuffer *motion_buffers[9]; | | SchroBuffer *motion_buffers[9]; | |
| | | | |
| SchroBuffer *lowdelay_buffer; | | SchroBuffer *lowdelay_buffer; | |
| | | | |
| int has_md5; | | int has_md5; | |
| uint8_t md5_checksum[32]; | | uint8_t md5_checksum[32]; | |
|
| | | | |
| | | /* private data that is associated with this picture */ | |
| | | SchroTag *tag; | |
| }; | | }; | |
|
| | | | |
| #endif | | #endif | |
| | | | |
| enum { | | enum { | |
| SCHRO_DECODER_OK, | | SCHRO_DECODER_OK, | |
| SCHRO_DECODER_ERROR, | | SCHRO_DECODER_ERROR, | |
| SCHRO_DECODER_EOS, | | SCHRO_DECODER_EOS, | |
| SCHRO_DECODER_FIRST_ACCESS_UNIT, | | SCHRO_DECODER_FIRST_ACCESS_UNIT, | |
| SCHRO_DECODER_NEED_BITS, | | SCHRO_DECODER_NEED_BITS, | |
| SCHRO_DECODER_NEED_FRAME, | | SCHRO_DECODER_NEED_FRAME, | |
| SCHRO_DECODER_WAIT, | | SCHRO_DECODER_WAIT, | |
| | | | |
| skipping to change at line 148 | | skipping to change at line 183 | |
| SCHRO_DECODER_PICTURE_ORDER_CODED | | SCHRO_DECODER_PICTURE_ORDER_CODED | |
| }; | | }; | |
| | | | |
| SchroDecoder * schro_decoder_new (void); | | SchroDecoder * schro_decoder_new (void); | |
| void schro_decoder_free (SchroDecoder *decoder); | | void schro_decoder_free (SchroDecoder *decoder); | |
| void schro_decoder_reset (SchroDecoder *decoder); | | void schro_decoder_reset (SchroDecoder *decoder); | |
| SchroVideoFormat * schro_decoder_get_video_format (SchroDecoder *decoder); | | SchroVideoFormat * schro_decoder_get_video_format (SchroDecoder *decoder); | |
| void schro_decoder_add_output_picture (SchroDecoder *decoder, SchroFrame *f
rame); | | void schro_decoder_add_output_picture (SchroDecoder *decoder, SchroFrame *f
rame); | |
| int schro_decoder_push_ready (SchroDecoder *decoder); | | int schro_decoder_push_ready (SchroDecoder *decoder); | |
| int schro_decoder_push (SchroDecoder *decoder, SchroBuffer *buffer); | | int schro_decoder_push (SchroDecoder *decoder, SchroBuffer *buffer); | |
|
| int schro_decoder_set_flushing (SchroDecoder *decoder, int flushing); | | #ifndef SCHRO_DISABLE_DEPRECATED | |
| | | int schro_decoder_set_flushing (SchroDecoder *decoder, int flushing) SCHRO_ | |
| | | DEPRECATED; | |
| | | #endif | |
| void schro_decoder_set_picture_order (SchroDecoder *decoder, int picture_or
der); | | void schro_decoder_set_picture_order (SchroDecoder *decoder, int picture_or
der); | |
| int schro_decoder_push_end_of_stream (SchroDecoder *decoder); | | int schro_decoder_push_end_of_stream (SchroDecoder *decoder); | |
| SchroFrame *schro_decoder_pull (SchroDecoder *decoder); | | SchroFrame *schro_decoder_pull (SchroDecoder *decoder); | |
| int schro_decoder_wait (SchroDecoder *decoder); | | int schro_decoder_wait (SchroDecoder *decoder); | |
| | | | |
| void schro_decoder_set_earliest_frame (SchroDecoder *decoder, SchroPictureN
umber earliest_frame); | | void schro_decoder_set_earliest_frame (SchroDecoder *decoder, SchroPictureN
umber earliest_frame); | |
| void schro_decoder_set_skip_ratio (SchroDecoder *decoder, double ratio); | | void schro_decoder_set_skip_ratio (SchroDecoder *decoder, double ratio); | |
| SchroPictureNumber schro_decoder_get_picture_number (SchroDecoder *decoder)
; | | SchroPictureNumber schro_decoder_get_picture_number (SchroDecoder *decoder)
; | |
| int schro_decoder_need_output_frame (SchroDecoder *decoder); | | int schro_decoder_need_output_frame (SchroDecoder *decoder); | |
| | | | |
|
| | | int schro_decoder_autoparse_wait (SchroDecoder *decoder); | |
| | | int schro_decoder_autoparse_push (SchroDecoder *decoder, SchroBuffer *buffe | |
| | | r); | |
| | | int schro_decoder_autoparse_push_end_of_sequence (SchroDecoder *decoder); | |
| | | | |
| | | SchroTag* schro_decoder_get_picture_tag (SchroDecoder *decoder); | |
| | | | |
| #ifdef SCHRO_ENABLE_UNSTABLE_API | | #ifdef SCHRO_ENABLE_UNSTABLE_API | |
| | | | |
|
| void schro_decoder_decode_parse_header (SchroDecoder *decoder); | | int schro_decoder_begin_sequence (SchroDecoder *decoder); | |
| void schro_decoder_parse_sequence_header (SchroDecoder *decoder); | | int schro_decoder_end_sequence (SchroDecoder *decoder); | |
| | | | |
| | | int schro_decoder_decode_parse_header (SchroUnpack *unpack); | |
| | | void schro_decoder_parse_sequence_header (SchroDecoderInstance *instance, S | |
| | | chroUnpack *unpack); | |
| int schro_decoder_compare_sequence_header_buffer (SchroBuffer *a, SchroBuff
er *b); | | int schro_decoder_compare_sequence_header_buffer (SchroBuffer *a, SchroBuff
er *b); | |
| | | | |
| void schro_decoder_subband_dc_predict (SchroFrameData *fd); | | void schro_decoder_subband_dc_predict (SchroFrameData *fd); | |
| | | | |
| /* SchroPicture */ | | /* SchroPicture */ | |
| | | | |
|
| SchroPicture * schro_picture_new (SchroDecoder *decoder); | | SchroPicture * schro_picture_new (SchroDecoderInstance *instance); | |
| SchroPicture * schro_picture_ref (SchroPicture *picture); | | SchroPicture * schro_picture_ref (SchroPicture *picture); | |
| void schro_picture_unref (SchroPicture *picture); | | void schro_picture_unref (SchroPicture *picture); | |
| | | | |
|
| void schro_decoder_decode_picture (SchroPicture *picture); | | int schro_decoder_iterate_picture (SchroDecoderInstance *instance, SchroBuf | |
| void schro_decoder_x_check_references (SchroPicture *picture); | | fer *buffer, SchroUnpack *unpack, int parse_code); | |
| void schro_decoder_x_decode_motion (SchroPicture *picture); | | void schro_decoder_parse_picture (SchroPicture *picture, SchroUnpack *unpac | |
| void schro_decoder_x_render_motion (SchroPicture *picture); | | k); | |
| void schro_decoder_x_decode_residual (SchroPicture *picture); | | void schro_decoder_parse_picture_header (SchroPicture *picture, SchroUnpack | |
| void schro_decoder_x_wavelet_transform (SchroPicture *picture); | | *unpack); | |
| void schro_decoder_x_combine (SchroPicture *picture); | | void schro_decoder_parse_picture_prediction_parameters (SchroPicture *pictu | |
| void schro_decoder_x_upsample (SchroPicture *picture); | | re, SchroUnpack *unpack); | |
| | | void schro_decoder_parse_block_data (SchroPicture *picture, SchroUnpack *un | |
| int schro_decoder_iterate_picture (SchroDecoder *decoder); | | pack); | |
| void schro_decoder_parse_picture (SchroPicture *picture); | | void schro_decoder_parse_transform_parameters (SchroPicture *picture, Schro | |
| void schro_decoder_parse_picture_header (SchroPicture *picture); | | Unpack *unpack); | |
| void schro_decoder_parse_picture_prediction_parameters (SchroPicture *pictu | | void schro_decoder_parse_transform_data (SchroPicture *picture, SchroUnpack | |
| re); | | *unpack); | |
| void schro_decoder_parse_block_data (SchroPicture *picture); | | void schro_decoder_parse_lowdelay_transform_data (SchroPicture *picture, Sc | |
| void schro_decoder_parse_transform_parameters (SchroPicture *picture); | | hroUnpack *unpack); | |
| void schro_decoder_parse_transform_data (SchroPicture *picture); | | | |
| void schro_decoder_parse_lowdelay_transform_data (SchroPicture *picture); | | | |
| void schro_decoder_init_subband_frame_data_interleaved (SchroPicture *pictu
re); | | void schro_decoder_init_subband_frame_data_interleaved (SchroPicture *pictu
re); | |
|
| | | void schro_decoder_init_subband_frame_data (SchroPicture *picture); | |
| void schro_decoder_decode_block_data (SchroPicture *picture); | | void schro_decoder_decode_block_data (SchroPicture *picture); | |
| void schro_decoder_decode_transform_data (SchroPicture *picture); | | void schro_decoder_decode_transform_data (SchroPicture *picture); | |
| void schro_decoder_decode_lowdelay_transform_data (SchroPicture *picture); | | void schro_decoder_decode_lowdelay_transform_data (SchroPicture *picture); | |
| void schro_decoder_decode_macroblock(SchroPicture *picture, | | void schro_decoder_decode_macroblock(SchroPicture *picture, | |
| SchroArith **arith, SchroUnpack *unpack, int i, int j); | | SchroArith **arith, SchroUnpack *unpack, int i, int j); | |
| void schro_decoder_decode_prediction_unit(SchroPicture *picture, | | void schro_decoder_decode_prediction_unit(SchroPicture *picture, | |
| SchroArith **arith, SchroUnpack *unpack, SchroMotionVector *motion_vect
ors, | | SchroArith **arith, SchroUnpack *unpack, SchroMotionVector *motion_vect
ors, | |
| int x, int y); | | int x, int y); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 29 change blocks. |
| 54 lines changed or deleted | | 102 lines changed or added | |
|
| schroencoder.h | | schroencoder.h | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| | | | |
| typedef enum { | | typedef enum { | |
| SCHRO_STATE_NEED_FRAME, | | SCHRO_STATE_NEED_FRAME, | |
| SCHRO_STATE_HAVE_BUFFER, | | SCHRO_STATE_HAVE_BUFFER, | |
| SCHRO_STATE_AGAIN, | | SCHRO_STATE_AGAIN, | |
| SCHRO_STATE_END_OF_STREAM | | SCHRO_STATE_END_OF_STREAM | |
| } SchroStateEnum; | | } SchroStateEnum; | |
| | | | |
| #ifdef SCHRO_ENABLE_UNSTABLE_API | | #ifdef SCHRO_ENABLE_UNSTABLE_API | |
| typedef enum { | | typedef enum { | |
|
| SCHRO_ENCODER_FRAME_STATE_NEW = 0, | | SCHRO_ENCODER_FRAME_STAGE_NEW = 0, | |
| SCHRO_ENCODER_FRAME_STATE_ANALYSE = (1<<1), | | SCHRO_ENCODER_FRAME_STAGE_ANALYSE, | |
| SCHRO_ENCODER_FRAME_STATE_HAVE_GOP = (1<<7), | | SCHRO_ENCODER_FRAME_STAGE_HAVE_GOP, | |
| SCHRO_ENCODER_FRAME_STATE_HAVE_PARAMS = (1<<8), | | SCHRO_ENCODER_FRAME_STAGE_HAVE_PARAMS, | |
| SCHRO_ENCODER_FRAME_STATE_PREDICT = (1<<2), | | SCHRO_ENCODER_FRAME_STAGE_PREDICT_ROUGH, | |
| SCHRO_ENCODER_FRAME_STATE_HAVE_REFS = (1<<10), | | SCHRO_ENCODER_FRAME_STAGE_PREDICT_PEL, | |
| SCHRO_ENCODER_FRAME_STATE_HAVE_QUANTS = (1<<11), | | SCHRO_ENCODER_FRAME_STAGE_PREDICT_SUBPEL, | |
| SCHRO_ENCODER_FRAME_STATE_ENCODING = (1<<3), | | SCHRO_ENCODER_FRAME_STAGE_MODE_DECISION, | |
| SCHRO_ENCODER_FRAME_STATE_RECONSTRUCT = (1<<4), | | SCHRO_ENCODER_FRAME_STAGE_HAVE_REFS, | |
| SCHRO_ENCODER_FRAME_STATE_POSTANALYSE = (1<<5), | | SCHRO_ENCODER_FRAME_STAGE_HAVE_QUANTS, | |
| SCHRO_ENCODER_FRAME_STATE_DONE = (1<<6), | | SCHRO_ENCODER_FRAME_STAGE_ENCODING, | |
| SCHRO_ENCODER_FRAME_STATE_FREE = (1<<9) | | SCHRO_ENCODER_FRAME_STAGE_RECONSTRUCT, | |
| | | SCHRO_ENCODER_FRAME_STAGE_POSTANALYSE, | |
| | | SCHRO_ENCODER_FRAME_STAGE_DONE, | |
| | | SCHRO_ENCODER_FRAME_STAGE_FREE, | |
| | | SCHRO_ENCODER_FRAME_STAGE_LAST /* this should be last */ | |
| } SchroEncoderFrameStateEnum; | | } SchroEncoderFrameStateEnum; | |
| #endif | | #endif | |
| | | | |
| typedef enum { | | typedef enum { | |
| SCHRO_ENCODER_PERCEPTUAL_CONSTANT, | | SCHRO_ENCODER_PERCEPTUAL_CONSTANT, | |
| SCHRO_ENCODER_PERCEPTUAL_CCIR959, | | SCHRO_ENCODER_PERCEPTUAL_CCIR959, | |
| SCHRO_ENCODER_PERCEPTUAL_MOO, | | SCHRO_ENCODER_PERCEPTUAL_MOO, | |
| SCHRO_ENCODER_PERCEPTUAL_MANOS_SAKRISON | | SCHRO_ENCODER_PERCEPTUAL_MANOS_SAKRISON | |
| } SchroEncoderPerceptualEnum; | | } SchroEncoderPerceptualEnum; | |
| | | | |
| typedef enum { | | typedef enum { | |
| SCHRO_ENCODER_RATE_CONTROL_CONSTANT_NOISE_THRESHOLD, | | SCHRO_ENCODER_RATE_CONTROL_CONSTANT_NOISE_THRESHOLD, | |
| SCHRO_ENCODER_RATE_CONTROL_CONSTANT_BITRATE, | | SCHRO_ENCODER_RATE_CONTROL_CONSTANT_BITRATE, | |
| SCHRO_ENCODER_RATE_CONTROL_LOW_DELAY, | | SCHRO_ENCODER_RATE_CONTROL_LOW_DELAY, | |
| SCHRO_ENCODER_RATE_CONTROL_LOSSLESS, | | SCHRO_ENCODER_RATE_CONTROL_LOSSLESS, | |
| SCHRO_ENCODER_RATE_CONTROL_CONSTANT_LAMBDA, | | SCHRO_ENCODER_RATE_CONTROL_CONSTANT_LAMBDA, | |
|
| SCHRO_ENCODER_RATE_CONTROL_CONSTANT_ERROR | | SCHRO_ENCODER_RATE_CONTROL_CONSTANT_ERROR, | |
| | | SCHRO_ENCODER_RATE_CONTROL_CONSTANT_QUALITY | |
| } SchroEncoderRateControlEnum; | | } SchroEncoderRateControlEnum; | |
| | | | |
| typedef enum { | | typedef enum { | |
| SCHRO_ENCODER_GOP_ADAPTIVE, | | SCHRO_ENCODER_GOP_ADAPTIVE, | |
| SCHRO_ENCODER_GOP_INTRA_ONLY, | | SCHRO_ENCODER_GOP_INTRA_ONLY, | |
| SCHRO_ENCODER_GOP_BACKREF, | | SCHRO_ENCODER_GOP_BACKREF, | |
| SCHRO_ENCODER_GOP_CHAINED_BACKREF, | | SCHRO_ENCODER_GOP_CHAINED_BACKREF, | |
| SCHRO_ENCODER_GOP_BIREF, | | SCHRO_ENCODER_GOP_BIREF, | |
| SCHRO_ENCODER_GOP_CHAINED_BIREF, | | SCHRO_ENCODER_GOP_CHAINED_BIREF, | |
| } SchroEncoderGOPEnum; | | } SchroEncoderGOPEnum; | |
| | | | |
| #ifdef SCHRO_ENABLE_UNSTABLE_API | | #ifdef SCHRO_ENABLE_UNSTABLE_API | |
| typedef int (*SchroEngineIterateFunc) (SchroEncoder *encoder); | | typedef int (*SchroEngineIterateFunc) (SchroEncoder *encoder); | |
| | | | |
|
| | | /* forward declaration */ | |
| | | struct _SchroMotionEst; | |
| | | struct _SchroRoughME; | |
| | | | |
| struct _SchroEncoderFrame { | | struct _SchroEncoderFrame { | |
| /*< private >*/ | | /*< private >*/ | |
| int refcount; | | int refcount; | |
|
| SchroEncoderFrameStateEnum state; | | //SchroEncoderFrameStateEnum state; | |
| SchroEncoderFrameStateEnum needed_state; | | //SchroEncoderFrameStateEnum needed_state; | |
| SchroEncoderFrameStateEnum working; | | SchroEncoderFrameStateEnum working; | |
| int busy; | | int busy; | |
| | | | |
| void *priv; | | void *priv; | |
| | | | |
|
| | | unsigned int expired_reference; | |
| | | | |
| /* Bits telling the engine stages which stuff needs to happen */ | | /* Bits telling the engine stages which stuff needs to happen */ | |
|
| | | unsigned int need_extension; | |
| unsigned int need_downsampling; | | unsigned int need_downsampling; | |
|
| | | unsigned int need_upsampling; | |
| unsigned int need_filtering; | | unsigned int need_filtering; | |
| unsigned int need_average_luma; | | unsigned int need_average_luma; | |
| | | | |
| /* bits indicating that a particular analysis has happened. Mainly | | /* bits indicating that a particular analysis has happened. Mainly | |
| * for verification */ | | * for verification */ | |
| unsigned int have_estimate_tables; | | unsigned int have_estimate_tables; | |
| unsigned int have_histograms; | | unsigned int have_histograms; | |
| unsigned int have_scene_change_score; | | unsigned int have_scene_change_score; | |
| unsigned int have_downsampling; | | unsigned int have_downsampling; | |
|
| | | unsigned int have_upsampling; | |
| unsigned int have_average_luma; | | unsigned int have_average_luma; | |
| | | | |
|
| | | SchroAsyncStage stages[SCHRO_ENCODER_FRAME_STAGE_LAST]; | |
| | | | |
| /* other stuff */ | | /* other stuff */ | |
| | | | |
| int start_sequence_header; | | int start_sequence_header; | |
| int gop_length; | | int gop_length; | |
| | | | |
| SchroPictureNumber frame_number; | | SchroPictureNumber frame_number; | |
| SchroFrame *original_frame; | | SchroFrame *original_frame; | |
| SchroFrame *filtered_frame; | | SchroFrame *filtered_frame; | |
|
| SchroFrame *downsampled_frames[5]; | | SchroFrame *downsampled_frames[8]; | |
| SchroUpsampledFrame *reconstructed_frame; | | SchroUpsampledFrame *reconstructed_frame; | |
|
| | | SchroUpsampledFrame *upsampled_original_frame; | |
| | | | |
| SchroBuffer *sequence_header_buffer; | | SchroBuffer *sequence_header_buffer; | |
| SchroList *inserted_buffers; | | SchroList *inserted_buffers; | |
| int output_buffer_size; | | int output_buffer_size; | |
| SchroBuffer *output_buffer; | | SchroBuffer *output_buffer; | |
| int presentation_frame; | | int presentation_frame; | |
| int slot; | | int slot; | |
| int last_frame; | | int last_frame; | |
| | | | |
| int is_ref; | | int is_ref; | |
| | | | |
| skipping to change at line 145 | | skipping to change at line 162 | |
| | | | |
| int stats_dc; | | int stats_dc; | |
| int stats_global; | | int stats_global; | |
| int stats_motion; | | int stats_motion; | |
| | | | |
| int subband_size; | | int subband_size; | |
| SchroBuffer *subband_buffer; | | SchroBuffer *subband_buffer; | |
| | | | |
| int16_t *quant_data; | | int16_t *quant_data; | |
| | | | |
|
| int16_t *tmpbuf; | | int *quant_indices[3][SCHRO_LIMIT_SUBBANDS]; | |
| | | | |
|
| int quant_index[3][1+SCHRO_LIMIT_TRANSFORM_DEPTH*3]; | | int quant_index[3][SCHRO_LIMIT_SUBBANDS]; | |
| double est_entropy[3][1+SCHRO_LIMIT_TRANSFORM_DEPTH*3][60]; | | double est_entropy[3][SCHRO_LIMIT_SUBBANDS][60]; | |
| double est_error[3][1+SCHRO_LIMIT_TRANSFORM_DEPTH*3][60]; | | double est_error[3][SCHRO_LIMIT_SUBBANDS][60]; | |
| double subband_info[3][1+SCHRO_LIMIT_TRANSFORM_DEPTH*3]; | | | |
| SchroPack *pack; | | SchroPack *pack; | |
| SchroParams params; | | SchroParams params; | |
| SchroEncoder *encoder; | | SchroEncoder *encoder; | |
| SchroFrame *iwt_frame; | | SchroFrame *iwt_frame; | |
|
| | | SchroFrame *quant_frame; | |
| SchroFrame *prediction_frame; | | SchroFrame *prediction_frame; | |
| | | | |
|
| | | SchroEncoderFrame *previous_frame; | |
| SchroEncoderFrame *ref_frame[2]; | | SchroEncoderFrame *ref_frame[2]; | |
| | | | |
|
| | | struct _SchroMotionEst *me; | |
| | | struct _SchroRoughME *rme[2]; | |
| | | struct _SchroPhaseCorr *phasecorr[2]; | |
| | | | |
| SchroMotion *motion; | | SchroMotion *motion; | |
|
| SchroList *motion_field_list; | | | |
| | | | |
| SchroHistogram subband_hists[3][SCHRO_LIMIT_SUBBANDS]; | | SchroHistogram subband_hists[3][SCHRO_LIMIT_SUBBANDS]; | |
| SchroHistogram hist_test; | | SchroHistogram hist_test; | |
| | | | |
| /* statistics */ | | /* statistics */ | |
| | | | |
| double picture_weight; | | double picture_weight; | |
| double scene_change_score; | | double scene_change_score; | |
| double average_luma; | | double average_luma; | |
| | | | |
|
| | | int hard_limit_bits; | |
| int allocated_residual_bits; | | int allocated_residual_bits; | |
| int allocated_mc_bits; | | int allocated_mc_bits; | |
| double base_lambda; | | double base_lambda; | |
| int estimated_residual_bits; | | int estimated_residual_bits; | |
| int estimated_mc_bits; | | int estimated_mc_bits; | |
| | | | |
| int actual_residual_bits; | | int actual_residual_bits; | |
| int actual_mc_bits; | | int actual_mc_bits; | |
| double mc_error; | | double mc_error; | |
| double mean_squared_error_luma; | | double mean_squared_error_luma; | |
| | | | |
| skipping to change at line 198 | | skipping to change at line 220 | |
| | | | |
| struct _SchroEncoder { | | struct _SchroEncoder { | |
| /*< private >*/ | | /*< private >*/ | |
| SchroAsync *async; | | SchroAsync *async; | |
| | | | |
| SchroPictureNumber next_frame_number; | | SchroPictureNumber next_frame_number; | |
| | | | |
| SchroQueue *frame_queue; | | SchroQueue *frame_queue; | |
| | | | |
| SchroEncoderFrame *reference_pictures[SCHRO_LIMIT_REFERENCE_FRAMES]; | | SchroEncoderFrame *reference_pictures[SCHRO_LIMIT_REFERENCE_FRAMES]; | |
|
| | | SchroEncoderFrame *last_frame; | |
| | | | |
|
| | | int assemble_packets; | |
| int need_rap; | | int need_rap; | |
| | | | |
| SchroVideoFormat video_format; | | SchroVideoFormat video_format; | |
| int version_major; | | int version_major; | |
| int version_minor; | | int version_minor; | |
| | | | |
| /* configuration */ | | /* configuration */ | |
| int rate_control; | | int rate_control; | |
| int bitrate; | | int bitrate; | |
| int max_bitrate; | | int max_bitrate; | |
| int min_bitrate; | | int min_bitrate; | |
| int buffer_size; | | int buffer_size; | |
| int buffer_level; | | int buffer_level; | |
|
| | | double quality; | |
| double noise_threshold; | | double noise_threshold; | |
| int gop_structure; | | int gop_structure; | |
| int queue_depth; | | int queue_depth; | |
| int perceptual_weighting; | | int perceptual_weighting; | |
| double perceptual_distance; | | double perceptual_distance; | |
| int filtering; | | int filtering; | |
| double filter_value; | | double filter_value; | |
| int profile; | | int profile; | |
| int level; | | int level; | |
|
| | | int open_gop; | |
| int au_distance; | | int au_distance; | |
| schro_bool enable_psnr; | | schro_bool enable_psnr; | |
| schro_bool enable_ssim; | | schro_bool enable_ssim; | |
| schro_bool enable_md5; | | schro_bool enable_md5; | |
| | | | |
| int ref_distance; | | int ref_distance; | |
| int transform_depth; | | int transform_depth; | |
| int intra_wavelet; | | int intra_wavelet; | |
| int inter_wavelet; | | int inter_wavelet; | |
| int mv_precision; | | int mv_precision; | |
| int motion_block_size; | | int motion_block_size; | |
| int motion_block_overlap; | | int motion_block_overlap; | |
| schro_bool interlaced_coding; | | schro_bool interlaced_coding; | |
| schro_bool enable_internal_testing; | | schro_bool enable_internal_testing; | |
| schro_bool enable_noarith; | | schro_bool enable_noarith; | |
| schro_bool enable_fullscan_estimation; | | schro_bool enable_fullscan_estimation; | |
| schro_bool enable_hierarchical_estimation; | | schro_bool enable_hierarchical_estimation; | |
| schro_bool enable_zero_estimation; | | schro_bool enable_zero_estimation; | |
| schro_bool enable_phasecorr_estimation; | | schro_bool enable_phasecorr_estimation; | |
| schro_bool enable_bigblock_estimation; | | schro_bool enable_bigblock_estimation; | |
|
| | | schro_bool enable_multiquant; | |
| | | schro_bool enable_dc_multiquant; | |
| | | schro_bool enable_global_motion; | |
| int horiz_slices; | | int horiz_slices; | |
| int vert_slices; | | int vert_slices; | |
|
| | | int codeblock_size; | |
| | | | |
| double magic_dc_metric_offset; | | double magic_dc_metric_offset; | |
| double magic_subband0_lambda_scale; | | double magic_subband0_lambda_scale; | |
| double magic_chroma_lambda_scale; | | double magic_chroma_lambda_scale; | |
| double magic_nonref_lambda_scale; | | double magic_nonref_lambda_scale; | |
| double magic_allocation_scale; | | double magic_allocation_scale; | |
| double magic_keyframe_weight; | | double magic_keyframe_weight; | |
| double magic_scene_change_threshold; | | double magic_scene_change_threshold; | |
| double magic_inter_p_weight; | | double magic_inter_p_weight; | |
| double magic_inter_b_weight; | | double magic_inter_b_weight; | |
| double magic_mc_bailout_limit; | | double magic_mc_bailout_limit; | |
| double magic_bailout_weight; | | double magic_bailout_weight; | |
| double magic_error_power; | | double magic_error_power; | |
| double magic_mc_lambda; | | double magic_mc_lambda; | |
| double magic_subgroup_length; | | double magic_subgroup_length; | |
| double magic_lambda; | | double magic_lambda; | |
| double magic_badblock_multiplier_nonref; | | double magic_badblock_multiplier_nonref; | |
| double magic_badblock_multiplier_ref; | | double magic_badblock_multiplier_ref; | |
|
| | | double magic_block_search_threshold; | |
| | | double magic_scan_distance; | |
| | | | |
| /* hooks */ | | /* hooks */ | |
| | | | |
| void (*init_frame) (SchroEncoderFrame *frame); | | void (*init_frame) (SchroEncoderFrame *frame); | |
| void (*handle_gop) (SchroEncoder *encoder, int i); | | void (*handle_gop) (SchroEncoder *encoder, int i); | |
| int (*setup_frame) (SchroEncoderFrame *frame); | | int (*setup_frame) (SchroEncoderFrame *frame); | |
| int (*handle_quants) (SchroEncoder *encoder, int i); | | int (*handle_quants) (SchroEncoder *encoder, int i); | |
| | | | |
| /* other */ | | /* other */ | |
| | | | |
| int end_of_stream; | | int end_of_stream; | |
| int end_of_stream_handled; | | int end_of_stream_handled; | |
| int end_of_stream_pulled; | | int end_of_stream_pulled; | |
| int completed_eos; | | int completed_eos; | |
| int prev_offset; | | int prev_offset; | |
|
| | | int force_sequence_header; | |
| | | | |
| SchroPictureNumber au_frame; | | SchroPictureNumber au_frame; | |
| int next_slot; | | int next_slot; | |
| | | | |
| int output_slot; | | int output_slot; | |
| | | | |
| SchroList *inserted_buffers; | | SchroList *inserted_buffers; | |
| int queue_changed; | | int queue_changed; | |
| | | | |
| int engine_init; | | int engine_init; | |
| SchroEngineIterateFunc engine_iterate; | | SchroEngineIterateFunc engine_iterate; | |
| int quantiser_engine; | | int quantiser_engine; | |
| | | | |
| double start_time; | | double start_time; | |
|
| | | int downsample_levels; | |
| #if 0 | | | |
| int prefs[SCHRO_PREF_LAST]; | | | |
| #endif | | | |
| | | | |
| /* internal stuff */ | | /* internal stuff */ | |
| | | | |
| double cycles_per_degree_horiz; | | double cycles_per_degree_horiz; | |
| double cycles_per_degree_vert; | | double cycles_per_degree_vert; | |
| | | | |
| double subband_weights[SCHRO_N_WAVELETS][SCHRO_LIMIT_TRANSFORM_DEPTH][SCH
RO_LIMIT_SUBBANDS]; | | double subband_weights[SCHRO_N_WAVELETS][SCHRO_LIMIT_TRANSFORM_DEPTH][SCH
RO_LIMIT_SUBBANDS]; | |
| SchroHistogramTable intra_hist_tables[60]; | | SchroHistogramTable intra_hist_tables[60]; | |
| | | | |
| int bits_per_picture; | | int bits_per_picture; | |
| | | | |
| skipping to change at line 315 | | skipping to change at line 345 | |
| /* statistics */ | | /* statistics */ | |
| | | | |
| double average_arith_context_ratio_intra; | | double average_arith_context_ratio_intra; | |
| double average_arith_context_ratio_inter; | | double average_arith_context_ratio_inter; | |
| | | | |
| /* engine specific stuff */ | | /* engine specific stuff */ | |
| | | | |
| int gop_picture; | | int gop_picture; | |
| int quant_slot; | | int quant_slot; | |
| | | | |
|
| int intra_ref; | | | |
| int last_ref; | | int last_ref; | |
|
| int last_ref2; | | | |
| //int next_ref; | | | |
| //int mid1_ref; | | | |
| //int mid2_ref; | | | |
| }; | | }; | |
| #endif | | #endif | |
| | | | |
| typedef enum { | | typedef enum { | |
| SCHRO_ENCODER_SETTING_TYPE_BOOLEAN, | | SCHRO_ENCODER_SETTING_TYPE_BOOLEAN, | |
| SCHRO_ENCODER_SETTING_TYPE_INT, | | SCHRO_ENCODER_SETTING_TYPE_INT, | |
| SCHRO_ENCODER_SETTING_TYPE_ENUM, | | SCHRO_ENCODER_SETTING_TYPE_ENUM, | |
| SCHRO_ENCODER_SETTING_TYPE_DOUBLE, | | SCHRO_ENCODER_SETTING_TYPE_DOUBLE, | |
| SCHRO_ENCODER_SETTING_TYPE_LAST | | SCHRO_ENCODER_SETTING_TYPE_LAST | |
| } SchroEncoderSettingTypeEnum; | | } SchroEncoderSettingTypeEnum; | |
| | | | |
| skipping to change at line 343 | | skipping to change at line 368 | |
| char *name; | | char *name; | |
| SchroEncoderSettingTypeEnum type; | | SchroEncoderSettingTypeEnum type; | |
| | | | |
| double min; | | double min; | |
| double max; | | double max; | |
| double default_value; | | double default_value; | |
| | | | |
| char **enum_list; | | char **enum_list; | |
| }; | | }; | |
| | | | |
|
| #if 0 | | | |
| struct _SchroEncoderSettings { | | | |
| int transform_depth; | | | |
| int wavelet_filter_index; | | | |
| | | | |
| /* stuff we don't handle yet */ | | | |
| int profile; | | | |
| int level; | | | |
| | | | |
| int xbsep_luma; | | | |
| int ybsep_luma; | | | |
| int xblen_luma; | | | |
| int yblen_luma; | | | |
| }; | | | |
| #endif | | | |
| | | | |
| enum { | | enum { | |
| SCHRO_MOTION_FIELD_HIER_REF0, | | SCHRO_MOTION_FIELD_HIER_REF0, | |
| SCHRO_MOTION_FIELD_HIER1_REF0, | | SCHRO_MOTION_FIELD_HIER1_REF0, | |
| SCHRO_MOTION_FIELD_HIER2_REF0, | | SCHRO_MOTION_FIELD_HIER2_REF0, | |
| SCHRO_MOTION_FIELD_HIER3_REF0, | | SCHRO_MOTION_FIELD_HIER3_REF0, | |
| SCHRO_MOTION_FIELD_HIER_REF1, | | SCHRO_MOTION_FIELD_HIER_REF1, | |
| SCHRO_MOTION_FIELD_HIER1_REF1, | | SCHRO_MOTION_FIELD_HIER1_REF1, | |
| SCHRO_MOTION_FIELD_HIER2_REF1, | | SCHRO_MOTION_FIELD_HIER2_REF1, | |
| SCHRO_MOTION_FIELD_HIER3_REF1, | | SCHRO_MOTION_FIELD_HIER3_REF1, | |
| SCHRO_MOTION_FIELD_PHASECORR_REF0, | | SCHRO_MOTION_FIELD_PHASECORR_REF0, | |
| | | | |
| skipping to change at line 389 | | skipping to change at line 398 | |
| | | | |
| SchroEncoder * schro_encoder_new (void); | | SchroEncoder * schro_encoder_new (void); | |
| void schro_encoder_free (SchroEncoder *encoder); | | void schro_encoder_free (SchroEncoder *encoder); | |
| SchroVideoFormat * schro_encoder_get_video_format (SchroEncoder *encoder); | | SchroVideoFormat * schro_encoder_get_video_format (SchroEncoder *encoder); | |
| void schro_encoder_set_video_format (SchroEncoder *encoder, | | void schro_encoder_set_video_format (SchroEncoder *encoder, | |
| SchroVideoFormat *video_format); | | SchroVideoFormat *video_format); | |
| void schro_encoder_end_of_stream (SchroEncoder *encoder); | | void schro_encoder_end_of_stream (SchroEncoder *encoder); | |
| int schro_encoder_push_ready (SchroEncoder *encoder); | | int schro_encoder_push_ready (SchroEncoder *encoder); | |
| void schro_encoder_push_frame (SchroEncoder *encoder, SchroFrame *frame); | | void schro_encoder_push_frame (SchroEncoder *encoder, SchroFrame *frame); | |
| void schro_encoder_push_frame_full (SchroEncoder *encoder, SchroFrame *fram
e, void *priv); | | void schro_encoder_push_frame_full (SchroEncoder *encoder, SchroFrame *fram
e, void *priv); | |
|
| | | void schro_encoder_force_sequence_header (SchroEncoder *encoder); | |
| | | | |
| SchroBuffer * schro_encoder_encode_auxiliary_data (SchroEncoder *encoder, | | SchroBuffer * schro_encoder_encode_auxiliary_data (SchroEncoder *encoder, | |
| SchroAuxiliaryDataID id, void *data, int size); | | SchroAuxiliaryDataID id, void *data, int size); | |
|
| void schro_encoder_encode_access_unit_header (SchroEncoder *encoder, SchroP
ack *bits); | | | |
| void schro_encoder_encode_parse_info (SchroPack *bits, int parse_code); | | void schro_encoder_encode_parse_info (SchroPack *bits, int parse_code); | |
| void schro_encoder_insert_buffer (SchroEncoder *encoder, SchroBuffer *buffe
r); | | void schro_encoder_insert_buffer (SchroEncoder *encoder, SchroBuffer *buffe
r); | |
| void schro_encoder_frame_insert_buffer (SchroEncoderFrame *frame, SchroBuff
er *buffer); | | void schro_encoder_frame_insert_buffer (SchroEncoderFrame *frame, SchroBuff
er *buffer); | |
| void schro_encoder_start (SchroEncoder *encoder); | | void schro_encoder_start (SchroEncoder *encoder); | |
| | | | |
|
| | | void schro_encoder_set_packet_assembly (SchroEncoder *encoder, int value); | |
| SchroStateEnum schro_encoder_wait (SchroEncoder *encoder); | | SchroStateEnum schro_encoder_wait (SchroEncoder *encoder); | |
| SchroBuffer * schro_encoder_pull (SchroEncoder *encoder, | | SchroBuffer * schro_encoder_pull (SchroEncoder *encoder, | |
| int *n_decodable_frames); | | int *n_decodable_frames); | |
| SchroBuffer * schro_encoder_pull_full (SchroEncoder *encoder, int *presenta
tion_frame, | | SchroBuffer * schro_encoder_pull_full (SchroEncoder *encoder, int *presenta
tion_frame, | |
| void **priv); | | void **priv); | |
|
| | | SchroBuffer * schro_encoder_encode_sequence_header (SchroEncoder *encoder); | |
| | | | |
| int schro_encoder_get_n_settings (void); | | int schro_encoder_get_n_settings (void); | |
| const SchroEncoderSetting *schro_encoder_get_setting_info (int i); | | const SchroEncoderSetting *schro_encoder_get_setting_info (int i); | |
| void schro_encoder_setting_set_double (SchroEncoder *encoder, const char *n
ame, | | void schro_encoder_setting_set_double (SchroEncoder *encoder, const char *n
ame, | |
| double d); | | double d); | |
| double schro_encoder_setting_get_double (SchroEncoder *encoder, const char
*name); | | double schro_encoder_setting_get_double (SchroEncoder *encoder, const char
*name); | |
| | | | |
| #ifdef SCHRO_ENABLE_UNSTABLE_API | | #ifdef SCHRO_ENABLE_UNSTABLE_API | |
| | | | |
| void schro_encoder_set_default_subband_weights (SchroEncoder *encoder); | | void schro_encoder_set_default_subband_weights (SchroEncoder *encoder); | |
| | | | |
| skipping to change at line 424 | | skipping to change at line 435 | |
| double (*perceptual_weight)(double)); | | double (*perceptual_weight)(double)); | |
| double schro_encoder_perceptual_weight_constant (double cpd); | | double schro_encoder_perceptual_weight_constant (double cpd); | |
| double schro_encoder_perceptual_weight_ccir959 (double cpd); | | double schro_encoder_perceptual_weight_ccir959 (double cpd); | |
| double schro_encoder_perceptual_weight_moo (double cpd); | | double schro_encoder_perceptual_weight_moo (double cpd); | |
| double schro_encoder_perceptual_weight_manos_sakrison (double cpd); | | double schro_encoder_perceptual_weight_manos_sakrison (double cpd); | |
| | | | |
| void schro_encoder_init_subbands (SchroEncoderFrame *frame); | | void schro_encoder_init_subbands (SchroEncoderFrame *frame); | |
| void schro_encoder_encode_subband (SchroEncoderFrame *frame, int component,
int index); | | void schro_encoder_encode_subband (SchroEncoderFrame *frame, int component,
int index); | |
| void schro_encoder_encode_subband_noarith (SchroEncoderFrame *frame, int co
mponent, int index); | | void schro_encoder_encode_subband_noarith (SchroEncoderFrame *frame, int co
mponent, int index); | |
| | | | |
|
| void schro_encoder_analyse_picture (SchroEncoderFrame *frame); | | void schro_encoder_analyse_picture (SchroAsyncStage *stage); | |
| void schro_encoder_predict_picture (SchroEncoderFrame *frame); | | void schro_encoder_predict_rough_picture (SchroAsyncStage *stage); | |
| void schro_encoder_encode_picture (SchroEncoderFrame *frame); | | void schro_encoder_predict_pel_picture (SchroAsyncStage *stage); | |
| void schro_encoder_reconstruct_picture (SchroEncoderFrame *frame); | | void schro_encoder_predict_subpel_picture (SchroAsyncStage *stage); | |
| void schro_encoder_postanalyse_picture (SchroEncoderFrame *frame); | | | |
| void schro_encoder_encode_picture_all (SchroEncoderFrame *frame); | | void schro_encoder_fullpel_predict_picture (SchroAsyncStage *stage); | |
| | | void schro_encoder_mode_decision (SchroAsyncStage *stage); | |
| | | | |
| | | void schro_encoder_encode_picture (SchroAsyncStage *stage); | |
| | | void schro_encoder_reconstruct_picture (SchroAsyncStage *stage); | |
| | | void schro_encoder_postanalyse_picture (SchroAsyncStage *stage); | |
| | | | |
| SchroFrame * schro_encoder_frame_queue_get (SchroEncoder *encoder, | | SchroFrame * schro_encoder_frame_queue_get (SchroEncoder *encoder, | |
| SchroPictureNumber frame_number); | | SchroPictureNumber frame_number); | |
| void schro_encoder_frame_queue_remove (SchroEncoder *encoder, | | void schro_encoder_frame_queue_remove (SchroEncoder *encoder, | |
| SchroPictureNumber frame_number); | | SchroPictureNumber frame_number); | |
| SchroEncoderFrame * schro_encoder_reference_get (SchroEncoder *encoder, | | SchroEncoderFrame * schro_encoder_reference_get (SchroEncoder *encoder, | |
| SchroPictureNumber frame_number); | | SchroPictureNumber frame_number); | |
| void schro_encoder_encode_picture_header (SchroEncoderFrame *frame); | | void schro_encoder_encode_picture_header (SchroEncoderFrame *frame); | |
| SchroBuffer * schro_encoder_encode_end_of_stream (SchroEncoder *encoder); | | SchroBuffer * schro_encoder_encode_end_of_stream (SchroEncoder *encoder); | |
| void schro_encoder_clean_up_transform (SchroEncoderFrame *frame); | | void schro_encoder_clean_up_transform (SchroEncoderFrame *frame); | |
| void schro_encoder_choose_quantisers (SchroEncoderFrame *frame); | | void schro_encoder_choose_quantisers (SchroEncoderFrame *frame); | |
|
| SchroBuffer * schro_encoder_encode_sequence_header (SchroEncoder *encoder); | | | |
| void schro_encoder_output_push (SchroEncoder *encoder, | | void schro_encoder_output_push (SchroEncoder *encoder, | |
| SchroBuffer *buffer, int slot, int presentation_frame); | | SchroBuffer *buffer, int slot, int presentation_frame); | |
| | | | |
| SchroEncoderFrame * schro_encoder_frame_new (SchroEncoder *encoder); | | SchroEncoderFrame * schro_encoder_frame_new (SchroEncoder *encoder); | |
| void schro_encoder_frame_ref (SchroEncoderFrame *frame); | | void schro_encoder_frame_ref (SchroEncoderFrame *frame); | |
| void schro_encoder_frame_unref (SchroEncoderFrame *frame); | | void schro_encoder_frame_unref (SchroEncoderFrame *frame); | |
| | | | |
| void schro_encoder_encode_lowdelay_transform_data (SchroEncoderFrame *frame
); | | void schro_encoder_encode_lowdelay_transform_data (SchroEncoderFrame *frame
); | |
| void schro_encoder_estimate_entropy (SchroEncoderFrame *frame); | | void schro_encoder_estimate_entropy (SchroEncoderFrame *frame); | |
| void schro_encoder_recalculate_allocations (SchroEncoder *encoder); | | void schro_encoder_recalculate_allocations (SchroEncoder *encoder); | |
| | | | |
| void schro_encoder_calculate_test_info (SchroEncoderFrame *frame); | | void schro_encoder_calculate_test_info (SchroEncoderFrame *frame); | |
| | | | |
| void schro_encoder_init_error_tables (SchroEncoder *encoder); | | void schro_encoder_init_error_tables (SchroEncoder *encoder); | |
| | | | |
|
| | | void schro_encoder_frame_set_quant_index (SchroEncoderFrame *frame, int com | |
| | | ponent, | |
| | | int index, int x, int y, int quant_index); | |
| | | | |
| #endif | | #endif | |
| | | | |
| SCHRO_END_DECLS | | SCHRO_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 37 change blocks. |
| 55 lines changed or deleted | | 74 lines changed or added | |
|
| schroframe.h | | schroframe.h | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 40 | |
| SCHRO_FRAME_FORMAT_S16_420 = 0x07, | | SCHRO_FRAME_FORMAT_S16_420 = 0x07, | |
| | | | |
| SCHRO_FRAME_FORMAT_S32_444 = 0x08, | | SCHRO_FRAME_FORMAT_S32_444 = 0x08, | |
| SCHRO_FRAME_FORMAT_S32_422 = 0x09, | | SCHRO_FRAME_FORMAT_S32_422 = 0x09, | |
| SCHRO_FRAME_FORMAT_S32_420 = 0x0b, | | SCHRO_FRAME_FORMAT_S32_420 = 0x0b, | |
| | | | |
| /* indirectly supported */ | | /* indirectly supported */ | |
| SCHRO_FRAME_FORMAT_YUYV = 0x100, /* YUYV order */ | | SCHRO_FRAME_FORMAT_YUYV = 0x100, /* YUYV order */ | |
| SCHRO_FRAME_FORMAT_UYVY = 0x101, /* UYVY order */ | | SCHRO_FRAME_FORMAT_UYVY = 0x101, /* UYVY order */ | |
| SCHRO_FRAME_FORMAT_AYUV = 0x102, | | SCHRO_FRAME_FORMAT_AYUV = 0x102, | |
|
| SCHRO_FRAME_FORMAT_ARGB = 0x103 | | SCHRO_FRAME_FORMAT_ARGB = 0x103, | |
| | | SCHRO_FRAME_FORMAT_RGB = 0x104, | |
| | | SCHRO_FRAME_FORMAT_v216 = 0x105, | |
| | | SCHRO_FRAME_FORMAT_v210 = 0x106 | |
| } SchroFrameFormat; | | } SchroFrameFormat; | |
| | | | |
| #define SCHRO_FRAME_FORMAT_DEPTH(format) ((format) & 0xc) | | #define SCHRO_FRAME_FORMAT_DEPTH(format) ((format) & 0xc) | |
| #define SCHRO_FRAME_FORMAT_DEPTH_U8 0x00 | | #define SCHRO_FRAME_FORMAT_DEPTH_U8 0x00 | |
| #define SCHRO_FRAME_FORMAT_DEPTH_S16 0x04 | | #define SCHRO_FRAME_FORMAT_DEPTH_S16 0x04 | |
| #define SCHRO_FRAME_FORMAT_DEPTH_S32 0x08 | | #define SCHRO_FRAME_FORMAT_DEPTH_S32 0x08 | |
| | | | |
| #define SCHRO_FRAME_FORMAT_H_SHIFT(format) ((format) & 0x1) | | #define SCHRO_FRAME_FORMAT_H_SHIFT(format) ((format) & 0x1) | |
| #define SCHRO_FRAME_FORMAT_V_SHIFT(format) (((format)>>1) & 0x1) | | #define SCHRO_FRAME_FORMAT_V_SHIFT(format) (((format)>>1) & 0x1) | |
| | | | |
| | | | |
| skipping to change at line 84 | | skipping to change at line 87 | |
| int width; | | int width; | |
| int height; | | int height; | |
| | | | |
| SchroFrameData components[3]; | | SchroFrameData components[3]; | |
| | | | |
| int is_virtual; | | int is_virtual; | |
| int cached_lines[3][SCHRO_FRAME_CACHE_SIZE]; | | int cached_lines[3][SCHRO_FRAME_CACHE_SIZE]; | |
| SchroFrame *virt_frame1; | | SchroFrame *virt_frame1; | |
| SchroFrame *virt_frame2; | | SchroFrame *virt_frame2; | |
| void (*render_line) (SchroFrame *frame, void *dest, int component, int i)
; | | void (*render_line) (SchroFrame *frame, void *dest, int component, int i)
; | |
|
| | | void *virt_priv; | |
| | | void *virt_priv2; | |
| | | | |
| | | int extension; | |
| }; | | }; | |
| | | | |
| struct _SchroUpsampledFrame { | | struct _SchroUpsampledFrame { | |
| SchroFrame *frames[4]; | | SchroFrame *frames[4]; | |
| void *components[3]; | | void *components[3]; | |
| }; | | }; | |
| | | | |
| #define SCHRO_FRAME_DATA_GET_LINE(fd,i) (SCHRO_OFFSET((fd)->data,(fd)->stri
de*(i))) | | #define SCHRO_FRAME_DATA_GET_LINE(fd,i) (SCHRO_OFFSET((fd)->data,(fd)->stri
de*(i))) | |
| #define SCHRO_FRAME_DATA_GET_PIXEL_U8(fd,i,j) ((uint8_t *)SCHRO_OFFSET((fd)
->data,(fd)->stride*(j)+(i))) | | #define SCHRO_FRAME_DATA_GET_PIXEL_U8(fd,i,j) ((uint8_t *)SCHRO_OFFSET((fd)
->data,(fd)->stride*(j)+(i))) | |
| #define SCHRO_FRAME_DATA_GET_PIXEL_S16(fd,i,j) ((int16_t *)SCHRO_OFFSET((fd
)->data,(fd)->stride*(j)+(i)*sizeof(int16_t))) | | #define SCHRO_FRAME_DATA_GET_PIXEL_S16(fd,i,j) ((int16_t *)SCHRO_OFFSET((fd
)->data,(fd)->stride*(j)+(i)*sizeof(int16_t))) | |
| | | | |
| SchroFrame * schro_frame_new (void); | | SchroFrame * schro_frame_new (void); | |
| SchroFrame * schro_frame_new_and_alloc (SchroMemoryDomain *domain, | | SchroFrame * schro_frame_new_and_alloc (SchroMemoryDomain *domain, | |
| SchroFrameFormat format, int width, int height); | | SchroFrameFormat format, int width, int height); | |
| SchroFrame * schro_frame_new_from_data_I420 (void *data, int width, int hei
ght); | | SchroFrame * schro_frame_new_from_data_I420 (void *data, int width, int hei
ght); | |
| SchroFrame * schro_frame_new_from_data_YV12 (void *data, int width, int hei
ght); | | SchroFrame * schro_frame_new_from_data_YV12 (void *data, int width, int hei
ght); | |
| SchroFrame * schro_frame_new_from_data_YUY2 (void *data, int width, int hei
ght); | | SchroFrame * schro_frame_new_from_data_YUY2 (void *data, int width, int hei
ght); | |
| SchroFrame * schro_frame_new_from_data_UYVY (void *data, int width, int hei
ght); | | SchroFrame * schro_frame_new_from_data_UYVY (void *data, int width, int hei
ght); | |
| SchroFrame * schro_frame_new_from_data_UYVY_full (void *data, int width, in
t height, int stride); | | SchroFrame * schro_frame_new_from_data_UYVY_full (void *data, int width, in
t height, int stride); | |
| SchroFrame * schro_frame_new_from_data_AYUV (void *data, int width, int hei
ght); | | SchroFrame * schro_frame_new_from_data_AYUV (void *data, int width, int hei
ght); | |
|
| | | SchroFrame * schro_frame_new_from_data_v216 (void *data, int width, int hei | |
| | | ght); | |
| | | SchroFrame * schro_frame_new_from_data_v210 (void *data, int width, int hei | |
| | | ght); | |
| void schro_frame_set_free_callback (SchroFrame *frame, | | void schro_frame_set_free_callback (SchroFrame *frame, | |
| SchroFrameFreeFunc free_func, void *priv); | | SchroFrameFreeFunc free_func, void *priv); | |
| void schro_frame_unref (SchroFrame *frame); | | void schro_frame_unref (SchroFrame *frame); | |
| SchroFrame *schro_frame_ref (SchroFrame *frame); | | SchroFrame *schro_frame_ref (SchroFrame *frame); | |
| SchroFrame *schro_frame_dup (SchroFrame *frame); | | SchroFrame *schro_frame_dup (SchroFrame *frame); | |
| SchroFrame *schro_frame_clone (SchroMemoryDomain *domain, SchroFrame *frame
); | | SchroFrame *schro_frame_clone (SchroMemoryDomain *domain, SchroFrame *frame
); | |
| | | | |
| void schro_frame_convert (SchroFrame *dest, SchroFrame *src); | | void schro_frame_convert (SchroFrame *dest, SchroFrame *src); | |
| void schro_frame_add (SchroFrame *dest, SchroFrame *src); | | void schro_frame_add (SchroFrame *dest, SchroFrame *src); | |
| void schro_frame_subtract (SchroFrame *dest, SchroFrame *src); | | void schro_frame_subtract (SchroFrame *dest, SchroFrame *src); | |
| void schro_frame_shift_left (SchroFrame *frame, int shift); | | void schro_frame_shift_left (SchroFrame *frame, int shift); | |
| void schro_frame_shift_right (SchroFrame *frame, int shift); | | void schro_frame_shift_right (SchroFrame *frame, int shift); | |
|
| | | void schro_frame_clear (SchroFrame *frame); | |
| | | | |
| void schro_frame_downsample (SchroFrame *dest, SchroFrame *src); | | void schro_frame_downsample (SchroFrame *dest, SchroFrame *src); | |
| void schro_frame_upsample_horiz (SchroFrame *dest, SchroFrame *src); | | void schro_frame_upsample_horiz (SchroFrame *dest, SchroFrame *src); | |
| void schro_frame_upsample_vert (SchroFrame *dest, SchroFrame *src); | | void schro_frame_upsample_vert (SchroFrame *dest, SchroFrame *src); | |
| double schro_frame_calculate_average_luma (SchroFrame *frame); | | double schro_frame_calculate_average_luma (SchroFrame *frame); | |
| | | | |
| SchroFrame * schro_frame_convert_to_444 (SchroFrame *frame); | | SchroFrame * schro_frame_convert_to_444 (SchroFrame *frame); | |
| void schro_frame_md5 (SchroFrame *frame, uint32_t *state); | | void schro_frame_md5 (SchroFrame *frame, uint32_t *state); | |
| | | | |
| #ifdef SCHRO_ENABLE_UNSTABLE_API | | #ifdef SCHRO_ENABLE_UNSTABLE_API | |
| | | | |
|
| | | SchroFrame * schro_frame_new_and_alloc_extended (SchroMemoryDomain *domain, | |
| | | SchroFrameFormat format, int width, int height, int extension); | |
| | | SchroFrame *schro_frame_dup_extended (SchroFrame *frame, int extension); | |
| void schro_frame_edge_extend (SchroFrame *frame, int width, int height); | | void schro_frame_edge_extend (SchroFrame *frame, int width, int height); | |
| void schro_frame_zero_extend (SchroFrame *frame, int width, int height); | | void schro_frame_zero_extend (SchroFrame *frame, int width, int height); | |
| void schro_frame_mark (SchroFrame *frame, int value); | | void schro_frame_mark (SchroFrame *frame, int value); | |
|
| | | void schro_frame_mc_edgeextend (SchroFrame *frame); | |
| | | | |
| void schro_frame_data_get_codeblock (SchroFrameData *dest, SchroFrameData *
src, | | void schro_frame_data_get_codeblock (SchroFrameData *dest, SchroFrameData *
src, | |
| int x, int y, int horiz_codeblocks, int vert_codeblocks); | | int x, int y, int horiz_codeblocks, int vert_codeblocks); | |
| | | | |
| SchroUpsampledFrame * schro_upsampled_frame_new (SchroFrame *frame); | | SchroUpsampledFrame * schro_upsampled_frame_new (SchroFrame *frame); | |
| void schro_upsampled_frame_free (SchroUpsampledFrame *df); | | void schro_upsampled_frame_free (SchroUpsampledFrame *df); | |
| void schro_upsampled_frame_upsample (SchroUpsampledFrame *df); | | void schro_upsampled_frame_upsample (SchroUpsampledFrame *df); | |
|
| | | #ifdef ENABLE_MOTION_REF | |
| int schro_upsampled_frame_get_pixel_prec0 (SchroUpsampledFrame *upframe, in
t k, | | int schro_upsampled_frame_get_pixel_prec0 (SchroUpsampledFrame *upframe, in
t k, | |
| int x, int y); | | int x, int y); | |
| int schro_upsampled_frame_get_pixel_prec1 (SchroUpsampledFrame *upframe, in
t k, | | int schro_upsampled_frame_get_pixel_prec1 (SchroUpsampledFrame *upframe, in
t k, | |
| int x, int y); | | int x, int y); | |
| int schro_upsampled_frame_get_pixel_prec3 (SchroUpsampledFrame *upframe, in
t k, | | int schro_upsampled_frame_get_pixel_prec3 (SchroUpsampledFrame *upframe, in
t k, | |
| int x, int y); | | int x, int y); | |
| int schro_upsampled_frame_get_pixel_precN (SchroUpsampledFrame *upframe, in
t k, | | int schro_upsampled_frame_get_pixel_precN (SchroUpsampledFrame *upframe, in
t k, | |
| int x, int y, int mv_precision); | | int x, int y, int mv_precision); | |
|
| | | #endif | |
| void schro_upsampled_frame_get_block_precN (SchroUpsampledFrame *upframe, i
nt k, | | void schro_upsampled_frame_get_block_precN (SchroUpsampledFrame *upframe, i
nt k, | |
|
| int x, int y, int prec, SchroFrameData *fd); | | int x, int y, int prec, SchroFrameData *dest); | |
| void schro_upsampled_frame_get_block_fast_precN (SchroUpsampledFrame *upfra
me, int k, | | void schro_upsampled_frame_get_block_fast_precN (SchroUpsampledFrame *upfra
me, int k, | |
|
| int x, int y, int prec, SchroFrameData *fd); | | int x, int y, int prec, SchroFrameData *dest, SchroFrameData *fd); | |
| | | void schro_upsampled_frame_get_subdata_prec0 (SchroUpsampledFrame *upframe, | |
| | | int k, int x, int y, SchroFrameData *fd); | |
| | | void schro_upsampled_frame_get_subdata_prec1 (SchroUpsampledFrame *upframe, | |
| | | int k, int x, int y, SchroFrameData *fd); | |
| | | | |
| void schro_frame_get_subdata (SchroFrame *frame, SchroFrameData *fd, | | void schro_frame_get_subdata (SchroFrame *frame, SchroFrameData *fd, | |
| int comp, int x, int y); | | int comp, int x, int y); | |
| | | | |
| void schro_frame_split_fields (SchroFrame *dest1, SchroFrame *dest2, SchroF
rame *src); | | void schro_frame_split_fields (SchroFrame *dest1, SchroFrame *dest2, SchroF
rame *src); | |
| | | | |
| #endif | | #endif | |
| | | | |
| SCHRO_END_DECLS | | SCHRO_END_DECLS | |
| | | | |
| | | | |
End of changes. 10 change blocks. |
| 3 lines changed or deleted | | 25 lines changed or added | |
|
| schroutils.h | | schroutils.h | |
| | | | |
| #ifndef __SCHRO_UTILS_H__ | | #ifndef __SCHRO_UTILS_H__ | |
| #define __SCHRO_UTILS_H__ | | #define __SCHRO_UTILS_H__ | |
| | | | |
|
| #include <schroedinger/schro-stdint.h> | | #if defined(_MSC_VER) | |
| | | #ifndef SCHRO_NO_STDINT_TYPEDEFS | |
| | | typedef __int8 int8_t; | |
| | | typedef __int16 int16_t; | |
| | | typedef __int32 int32_t; | |
| | | typedef unsigned __int8 uint8_t; | |
| | | typedef unsigned __int16 uint16_t; | |
| | | typedef unsigned __int32 uint32_t; | |
| | | #endif | |
| | | #else | |
| | | #include <stdint.h> | |
| | | #endif | |
| | | | |
| #ifndef TRUE | | #ifndef TRUE | |
| #define TRUE 1 | | #define TRUE 1 | |
| #endif | | #endif | |
| #ifndef FALSE | | #ifndef FALSE | |
| #define FALSE 0 | | #define FALSE 0 | |
| #endif | | #endif | |
| | | | |
| typedef uint32_t SchroPictureNumber; | | typedef uint32_t SchroPictureNumber; | |
| typedef unsigned int schro_bool; | | typedef unsigned int schro_bool; | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 54 | |
| #endif | | #endif | |
| #ifndef CLAMP | | #ifndef CLAMP | |
| #define CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x))) | | #define CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x))) | |
| #endif | | #endif | |
| #define NEED_CLAMP(x,y,a,b) ((x) < (a) || (y) > (b)) | | #define NEED_CLAMP(x,y,a,b) ((x) < (a) || (y) > (b)) | |
| #define ROUND_UP_SHIFT(x,y) (((x) + (1<<(y)) - 1)>>(y)) | | #define ROUND_UP_SHIFT(x,y) (((x) + (1<<(y)) - 1)>>(y)) | |
| #define ROUND_UP_POW2(x,y) (((x) + (1<<(y)) - 1)&((~0)<<(y))) | | #define ROUND_UP_POW2(x,y) (((x) + (1<<(y)) - 1)&((~0)<<(y))) | |
| #define ROUND_UP_2(x) ROUND_UP_POW2(x,1) | | #define ROUND_UP_2(x) ROUND_UP_POW2(x,1) | |
| #define ROUND_UP_4(x) ROUND_UP_POW2(x,2) | | #define ROUND_UP_4(x) ROUND_UP_POW2(x,2) | |
| #define ROUND_UP_8(x) ROUND_UP_POW2(x,3) | | #define ROUND_UP_8(x) ROUND_UP_POW2(x,3) | |
|
| | | #define ROUND_UP_16(x) ROUND_UP_POW2(x,4) | |
| #define ROUND_UP_64(x) ROUND_UP_POW2(x,6) | | #define ROUND_UP_64(x) ROUND_UP_POW2(x,6) | |
| #define OFFSET(ptr,offset) ((void *)(((uint8_t *)(ptr)) + (offset))) | | #define OFFSET(ptr,offset) ((void *)(((uint8_t *)(ptr)) + (offset))) | |
| #define ROUND_SHIFT(x,y) (((x) + (1<<((y)-1)))>>(y)) | | #define ROUND_SHIFT(x,y) (((x) + (1<<((y)-1)))>>(y)) | |
| | | | |
| #define schro_divide(a,b) (((a)<0)?(((a) - (b) + 1)/(b)):((a)/(b))) | | #define schro_divide(a,b) (((a)<0)?(((a) - (b) + 1)/(b)):((a)/(b))) | |
|
| | | #define schro_divide3(a) (((a)*21845 + 10922)>>16) | |
| | | | |
| #endif | | #endif | |
| | | | |
| #define SCHRO_OFFSET(ptr,offset) ((void *)(((uint8_t *)(ptr)) + (offset))) | | #define SCHRO_OFFSET(ptr,offset) ((void *)(((uint8_t *)(ptr)) + (offset))) | |
| #define SCHRO_GET(ptr, offset, type) (*(type *)((uint8_t *)(ptr) + (offset)
) ) | | #define SCHRO_GET(ptr, offset, type) (*(type *)((uint8_t *)(ptr) + (offset)
) ) | |
| | | | |
| #if defined(__GNUC__) && defined(__GNUC_MINOR__) | | #if defined(__GNUC__) && defined(__GNUC_MINOR__) | |
| #define SCHRO_GNUC_PREREQ(maj, min) \ | | #define SCHRO_GNUC_PREREQ(maj, min) \ | |
| ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) | | ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) | |
| #else | | #else | |
| #define SCHRO_GNUC_PREREQ(maj, min) 0 | | #define SCHRO_GNUC_PREREQ(maj, min) 0 | |
| #endif | | #endif | |
| | | | |
| #if SCHRO_GNUC_PREREQ(3,3) && defined(__ELF__) | | #if SCHRO_GNUC_PREREQ(3,3) && defined(__ELF__) | |
| #define SCHRO_INTERNAL __attribute__ ((visibility ("internal"))) | | #define SCHRO_INTERNAL __attribute__ ((visibility ("internal"))) | |
| #else | | #else | |
| #define SCHRO_INTERNAL | | #define SCHRO_INTERNAL | |
| #endif | | #endif | |
| | | | |
|
| | | #if SCHRO_GNUC_PREREQ(3,3) | |
| | | #define SCHRO_DEPRECATED __attribute__ ((deprecated)) | |
| | | #else | |
| | | #define SCHRO_DEPRECATED | |
| | | #endif | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| #define SCHRO_BEGIN_DECLS extern "C" { | | #define SCHRO_BEGIN_DECLS extern "C" { | |
| #define SCHRO_END_DECLS } | | #define SCHRO_END_DECLS } | |
| #else | | #else | |
| #define SCHRO_BEGIN_DECLS | | #define SCHRO_BEGIN_DECLS | |
| #define SCHRO_END_DECLS | | #define SCHRO_END_DECLS | |
| #endif | | #endif | |
| | | | |
| SCHRO_BEGIN_DECLS | | SCHRO_BEGIN_DECLS | |
| | | | |
| | | | |
| skipping to change at line 90 | | skipping to change at line 109 | |
| void * schro_malloc0 (int size); | | void * schro_malloc0 (int size); | |
| void * schro_realloc (void *ptr, int size); | | void * schro_realloc (void *ptr, int size); | |
| void schro_free (void *ptr); | | void schro_free (void *ptr); | |
| | | | |
| int muldiv64 (int a, int b, int c); | | int muldiv64 (int a, int b, int c); | |
| int schro_utils_multiplier_to_quant_index (double x); | | int schro_utils_multiplier_to_quant_index (double x); | |
| int schro_dequantise (int q, int quant_factor, int quant_offset); | | int schro_dequantise (int q, int quant_factor, int quant_offset); | |
| int schro_quantise (int value, int quant_factor, int quant_offset); | | int schro_quantise (int value, int quant_factor, int quant_offset); | |
| void schro_quantise_s16 (int16_t *dest, int16_t *src, int quant_factor, | | void schro_quantise_s16 (int16_t *dest, int16_t *src, int quant_factor, | |
| int quant_offset, int n); | | int quant_offset, int n); | |
|
| | | void schro_quantise_s16_table (int16_t *dest, int16_t *src, int quant_index | |
| | | , | |
| | | schro_bool is_intra, int n); | |
| void schro_dequantise_s16 (int16_t *dest, int16_t *src, int quant_factor, | | void schro_dequantise_s16 (int16_t *dest, int16_t *src, int quant_factor, | |
| int quant_offset, int n); | | int quant_offset, int n); | |
|
| | | void schro_dequantise_s16_table (int16_t *dest, int16_t *src, int quant_ind | |
| | | ex, | |
| | | schro_bool is_intra, int n); | |
| double schro_utils_probability_to_entropy (double x); | | double schro_utils_probability_to_entropy (double x); | |
| double schro_utils_entropy (double a, double total); | | double schro_utils_entropy (double a, double total); | |
| void schro_utils_reduce_fraction (int *n, int *d); | | void schro_utils_reduce_fraction (int *n, int *d); | |
| double schro_utils_get_time (void); | | double schro_utils_get_time (void); | |
| | | | |
| #endif | | #endif | |
| | | | |
| SCHRO_END_DECLS | | SCHRO_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 6 change blocks. |
| 1 lines changed or deleted | | 26 lines changed or added | |
|