Commit 59eb12fa authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote branch 'qatar/master'

* qatar/master: (30 commits)
  AVOptions: make default_val a union, as proposed in AVOption2.
  arm/h264pred: add missing argument type.
  h264dsp_mmx: place bracket outside #if/#endif block.
  lavf/utils: fix ff_interleave_compare_dts corner case.
  fate: add 10-bit H264 tests.
  h264: do not print "too many references" warning for intra-only.
  Enable decoding of high bit depth h264.
  Adds 8-, 9- and 10-bit versions of some of the functions used by the h264 decoder.
  Add support for higher QP values in h264.
  Add the notion of pixel size in h264 related functions.
  Make the h264 loop filter bit depth aware.
  Template dsputil_template.c with respect to pixel size, etc.
  Template h264idct_template.c with respect to pixel size, etc.
  Preparatory patch for high bit depth h264 decoding support.
  Move some functions in dsputil.c into a new file dsputil_template.c.
  Move the functions in h264idct into a new file h264idct_template.c.
  Move the functions in h264pred.c into a new file h264pred_template.c.
  Preparatory patch for high bit depth h264 decoding support.
  Add pixel formats for 9- and 10-bit yuv420p.
  Choose h264 chroma dc dequant function dynamically.
  ...

Conflicts:
	doc/APIchanges
	ffmpeg.c
	ffplay.c
	libavcodec/alpha/dsputil_alpha.c
	libavcodec/arm/dsputil_init_arm.c
	libavcodec/arm/dsputil_init_armv6.c
	libavcodec/arm/dsputil_init_neon.c
	libavcodec/arm/dsputil_iwmmxt.c
	libavcodec/arm/h264pred_init_arm.c
	libavcodec/bfin/dsputil_bfin.c
	libavcodec/dsputil.c
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_ps.c
	libavcodec/h264_refs.c
	libavcodec/h264dsp.c
	libavcodec/h264idct.c
	libavcodec/h264pred.c
	libavcodec/mlib/dsputil_mlib.c
	libavcodec/options.c
	libavcodec/ppc/dsputil_altivec.c
	libavcodec/ppc/dsputil_ppc.c
	libavcodec/ppc/h264_altivec.c
	libavcodec/ps2/dsputil_mmi.c
	libavcodec/sh4/dsputil_align.c
	libavcodec/sh4/dsputil_sh4.c
	libavcodec/sparc/dsputil_vis.c
	libavcodec/utils.c
	libavcodec/version.h
	libavcodec/x86/dsputil_mmx.c
	libavformat/options.c
	libavformat/utils.c
	libavutil/pixfmt.h
	libswscale/swscale.c
	libswscale/swscale_internal.h
	libswscale/swscale_template.c
	tests/ref/seek/lavf_avi
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 580fa76c b6675279
......@@ -13,6 +13,12 @@ libavutil: 2011-04-18
API changes, most recent first:
2011-05-10 - xxxxxxx - lavc 53.3.0 - avcodec.h
Deprecate AVLPCType and the following fields in
AVCodecContext: lpc_coeff_precision, prediction_order_method,
min_partition_order, max_partition_order, lpc_type, lpc_passes.
Corresponding FLAC encoder options should be used instead.
2011-05-07 - xxxxxxx - lavfi 2.5.0 - avcodec.h
Add libavfilter/avcodec.h header and avfilter_copy_frame_props()
function.
......
......@@ -292,7 +292,6 @@ typedef struct AVOutputStream {
int resample_pix_fmt;
float frame_aspect_ratio;
/* forced key frames */
int64_t *forced_kf_pts;
int forced_kf_count;
......@@ -1505,7 +1504,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
AVFormatContext *os;
AVOutputStream *ost;
int ret, i;
int got_picture;
int got_output;
AVFrame picture;
void *buffer_to_free = NULL;
static unsigned int samples_size= 0;
......@@ -1537,7 +1536,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
//while we have more to decode or while the decoder did output something on EOF
while (avpkt.size > 0 || (!pkt && ist->next_pts != ist->pts)) {
while (avpkt.size > 0 || (!pkt && got_output)) {
uint8_t *data_buf, *decoded_data_buf;
int data_size, decoded_data_size;
handle_eof:
......@@ -1573,9 +1572,10 @@ static int output_packet(AVInputStream *ist, int ist_index,
avpkt.data += ret;
avpkt.size -= ret;
data_size = ret;
got_output = decoded_data_size > 0;
/* Some bug in mpeg audio decoder gives */
/* decoded_data_size < 0, it seems they are overflows */
if (decoded_data_size <= 0) {
if (!got_output) {
/* no audio frame */
continue;
}
......@@ -1592,11 +1592,11 @@ static int output_packet(AVInputStream *ist, int ist_index,
pkt_pts = AV_NOPTS_VALUE;
ret = avcodec_decode_video2(ist->st->codec,
&picture, &got_picture, &avpkt);
&picture, &got_output, &avpkt);
ist->st->quality= picture.quality;
if (ret < 0)
goto fail_decode;
if (!got_picture) {
if (!got_output) {
/* no picture yet */
goto discard_packet;
}
......@@ -1613,10 +1613,10 @@ static int output_packet(AVInputStream *ist, int ist_index,
break;
case AVMEDIA_TYPE_SUBTITLE:
ret = avcodec_decode_subtitle2(ist->st->codec,
&subtitle, &got_picture, &avpkt);
&subtitle, &got_output, &avpkt);
if (ret < 0)
goto fail_decode;
if (!got_picture) {
if (!got_output) {
goto discard_packet;
}
subtitle_to_free = &subtitle;
......
......@@ -146,7 +146,7 @@ static void calc_predictor_params(AlacEncodeContext *s, int ch)
s->min_prediction_order,
s->max_prediction_order,
ALAC_MAX_LPC_PRECISION, coefs, shift,
AV_LPC_TYPE_LEVINSON, 0,
FF_LPC_TYPE_LEVINSON, 0,
ORDER_METHOD_EST, ALAC_MAX_LPC_SHIFT, 1);
s->lpc[ch].lpc_order = opt_order;
......@@ -457,7 +457,7 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
s->avctx = avctx;
ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size, s->max_prediction_order,
AV_LPC_TYPE_LEVINSON);
FF_LPC_TYPE_LEVINSON);
return ret;
}
......
......@@ -270,9 +270,9 @@ static void put_pixels16_axp_asm(uint8_t *block, const uint8_t *pixels,
void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
{
const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
if (!h264_high_depth) {
if (!high_bit_depth) {
c->put_pixels_tab[0][0] = put_pixels16_axp_asm;
c->put_pixels_tab[0][1] = put_pixels16_x2_axp;
c->put_pixels_tab[0][2] = put_pixels16_y2_axp;
......
......@@ -75,7 +75,7 @@ static void simple_idct_arm_add(uint8_t *dest, int line_size, DCTELEM *block)
void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
{
const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
ff_put_pixels_clamped = c->put_pixels_clamped;
ff_add_pixels_clamped = c->add_pixels_clamped;
......@@ -97,7 +97,7 @@ void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
c->add_pixels_clamped = ff_add_pixels_clamped_arm;
if (!h264_high_depth) {
if (!high_bit_depth) {
c->put_pixels_tab[0][0] = ff_put_pixels16_arm;
c->put_pixels_tab[0][1] = ff_put_pixels16_x2_arm;
c->put_pixels_tab[0][2] = ff_put_pixels16_y2_arm;
......
......@@ -72,7 +72,7 @@ int ff_pix_sum_armv6(uint8_t *pix, int line_size);
void av_cold ff_dsputil_init_armv6(DSPContext* c, AVCodecContext *avctx)
{
const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
if (!avctx->lowres && (avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) {
......@@ -82,7 +82,7 @@ void av_cold ff_dsputil_init_armv6(DSPContext* c, AVCodecContext *avctx)
c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM;
}
if (!h264_high_depth) {
if (!high_bit_depth) {
c->put_pixels_tab[0][0] = ff_put_pixels16_armv6;
c->put_pixels_tab[0][1] = ff_put_pixels16_x2_armv6;
c->put_pixels_tab[0][2] = ff_put_pixels16_y2_armv6;
......
......@@ -173,7 +173,7 @@ void ff_apply_window_int16_neon(int16_t *dst, const int16_t *src,
void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
{
const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
if (!avctx->lowres) {
if (avctx->idct_algo == FF_IDCT_AUTO ||
......@@ -192,7 +192,7 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
}
}
if (!h264_high_depth) {
if (!high_bit_depth) {
c->clear_block = ff_clear_block_neon;
c->clear_blocks = ff_clear_blocks_neon;
......@@ -223,7 +223,7 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon;
if (CONFIG_H264_DECODER) {
if (!h264_high_depth) {
if (!high_bit_depth) {
c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_neon;
c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_neon;
c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_neon;
......
......@@ -155,7 +155,7 @@ static void nop(uint8_t *block, const uint8_t *pixels, int line_size, int h)
void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx)
{
int mm_flags = AV_CPU_FLAG_IWMMXT; /* multimedia extension flags */
const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
if (avctx->dsp_mask) {
if (avctx->dsp_mask & AV_CPU_FLAG_FORCE)
......@@ -168,7 +168,7 @@ void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx)
c->add_pixels_clamped = add_pixels_clamped_iwmmxt;
if (!h264_high_depth) {
if (!high_bit_depth) {
c->clear_blocks = clear_blocks_iwmmxt;
c->put_pixels_tab[0][0] = put_pixels16_iwmmxt;
......
......@@ -74,7 +74,7 @@ static void ff_h264_pred_init_neon(H264PredContext *h, int codec_id, const int b
h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_neon;
}
void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, const int bit_depth)
void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, int bit_depth)
{
if (HAVE_NEON) ff_h264_pred_init_neon(h, codec_id, bit_depth);
}
......@@ -516,10 +516,11 @@ enum AVChromaLocation{
AVCHROMA_LOC_NB , ///< Not part of ABI
};
#if FF_API_FLAC_GLOBAL_OPTS
/**
* LPC analysis type
*/
enum AVLPCType {
attribute_deprecated enum AVLPCType {
AV_LPC_TYPE_DEFAULT = -1, ///< use the codec default LPC type
AV_LPC_TYPE_NONE = 0, ///< do not use LPC prediction or use all zero coefficients
AV_LPC_TYPE_FIXED = 1, ///< fixed LPC coefficients
......@@ -527,6 +528,7 @@ enum AVLPCType {
AV_LPC_TYPE_CHOLESKY = 3, ///< Cholesky factorization
AV_LPC_TYPE_NB , ///< Not part of ABI
};
#endif
enum AVAudioServiceType {
AV_AUDIO_SERVICE_TYPE_MAIN = 0,
......@@ -2514,42 +2516,53 @@ typedef struct AVCodecContext {
#define FF_COMPRESSION_DEFAULT -1
/**
* LPC coefficient precision - used by FLAC encoder
* - encoding: Set by user.
* - decoding: unused
*/
int lpc_coeff_precision;
int min_prediction_order;
/**
* - encoding: Set by user.
* - decoding: unused
*/
int min_prediction_order;
int max_prediction_order;
#if FF_API_FLAC_GLOBAL_OPTS
/**
* @defgroup flac_opts FLAC options
* @deprecated Use FLAC encoder private options instead.
* @{
*/
/**
* LPC coefficient precision - used by FLAC encoder
* - encoding: Set by user.
* - decoding: unused
*/
int max_prediction_order;
attribute_deprecated int lpc_coeff_precision;
/**
* search method for selecting prediction order
* - encoding: Set by user.
* - decoding: unused
*/
int prediction_order_method;
attribute_deprecated int prediction_order_method;
/**
* - encoding: Set by user.
* - decoding: unused
*/
int min_partition_order;
attribute_deprecated int min_partition_order;
/**
* - encoding: Set by user.
* - decoding: unused
*/
int max_partition_order;
attribute_deprecated int max_partition_order;
/**
* @}
*/
#endif
/**
* GOP timecode frame start number, in non drop frame format
......@@ -2767,19 +2780,21 @@ typedef struct AVCodecContext {
int log_level_offset;
#if FF_API_FLAC_GLOBAL_OPTS
/**
* Determines which LPC analysis algorithm to use.
* - encoding: Set by user
* - decoding: unused
*/
enum AVLPCType lpc_type;
attribute_deprecated enum AVLPCType lpc_type;
/**
* Number of passes to use for Cholesky factorization during LPC analysis
* - encoding: Set by user
* - decoding: unused
*/
int lpc_passes;
attribute_deprecated int lpc_passes;
#endif
/**
* Number of slices.
......
......@@ -197,14 +197,14 @@ static int bfin_pix_abs8_xy2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_si
void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
{
const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
c->get_pixels = ff_bfin_get_pixels;
c->diff_pixels = ff_bfin_diff_pixels;
c->put_pixels_clamped = ff_bfin_put_pixels_clamped;
c->add_pixels_clamped = ff_bfin_add_pixels_clamped;
if (!h264_high_depth)
if (!high_bit_depth)
c->clear_blocks = bfin_clear_blocks;
c->pix_sum = ff_bfin_pix_sum;
c->pix_norm1 = ff_bfin_pix_norm1;
......@@ -231,7 +231,7 @@ void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
c->sse[1] = ff_bfin_sse8;
c->sse[2] = ff_bfin_sse4;
if (!h264_high_depth) {
if (!high_bit_depth) {
c->put_pixels_tab[0][0] = bfin_put_pixels16;
c->put_pixels_tab[0][1] = bfin_put_pixels16_x2;
c->put_pixels_tab[0][2] = bfin_put_pixels16_y2;
......
......@@ -43,15 +43,15 @@ uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0, };
uint32_t ff_squareTbl[512] = {0, };
#define BIT_DEPTH 9
#include "dsputil_internal.h"
#include "dsputil_template.c"
#undef BIT_DEPTH
#define BIT_DEPTH 10
#include "dsputil_internal.h"
#include "dsputil_template.c"
#undef BIT_DEPTH
#define BIT_DEPTH 8
#include "dsputil_internal.h"
#include "dsputil_template.c"
// 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's native arithmetic size
#define pb_7f (~0UL/255 * 0x7f)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -108,7 +108,7 @@
*/
#define DELAYED_PIC_REF 4
#define QP_MAX_MAX (51 + 2*6) // The maximum supported qp
#define QP_MAX_NUM (51 + 2*6) // The maximum supported qp
/* NAL unit types */
enum {
......@@ -266,7 +266,7 @@ typedef struct MMCO{
typedef struct H264Context{
MpegEncContext s;
H264DSPContext h264dsp;
int pixel_shift;
int pixel_shift; ///< 0 for 8-bit H264, 1 for high-bit-depth H264
int chroma_qp[2]; //QPc
int qp_thresh; ///< QP threshold to skip loopfilter
......@@ -355,8 +355,8 @@ typedef struct H264Context{
*/
PPS pps; //FIXME move to Picture perhaps? (->no) do we need that?
uint32_t dequant4_buffer[6][QP_MAX_MAX+1][16]; //FIXME should these be moved down?
uint32_t dequant8_buffer[2][QP_MAX_MAX+1][64];
uint32_t dequant4_buffer[6][QP_MAX_NUM+1][16]; //FIXME should these be moved down?
uint32_t dequant8_buffer[2][QP_MAX_NUM+1][64];
uint32_t (*dequant4_coeff[6])[16];
uint32_t (*dequant8_coeff[2])[64];
......@@ -597,7 +597,7 @@ typedef struct H264Context{
}H264Context;
extern const uint8_t ff_h264_chroma_qp[3][QP_MAX_MAX+1]; ///< One chroma qp table for each supported bit depth (8, 9, 10).
extern const uint8_t ff_h264_chroma_qp[3][QP_MAX_NUM+1]; ///< One chroma qp table for each supported bit depth (8, 9, 10).
/**
* Decode SEI
......
......@@ -1103,10 +1103,11 @@ static av_always_inline void decode_cabac_residual_internal( H264Context *h, DCT
#define STORE_BLOCK(type) \
do {\
uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base;\
\
int j= scantable[index[--coeff_count]];\
do { \
uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base; \
\
int j= scantable[index[--coeff_count]]; \
\
if( get_cabac( CC, ctx ) == 0 ) { \
node_ctx = coeff_abs_level_transition[0][node_ctx]; \
if( is_dc ) { \
......@@ -1141,8 +1142,8 @@ static av_always_inline void decode_cabac_residual_internal( H264Context *h, DCT
}else{ \
((type*)block)[j] = ((int)(get_cabac_bypass_sign( CC, -coeff_abs ) * qmul[j] + 32)) >> 6; \
} \
}\
} while( coeff_count );
} \
} while ( coeff_count );
if (h->pixel_shift) {
STORE_BLOCK(int32_t)
......@@ -1204,6 +1205,7 @@ int ff_h264_decode_mb_cabac(H264Context *h) {
int mb_xy;
int mb_type, partition_count, cbp = 0;
int dct8x8_allowed= h->pps.transform_8x8_mode;
const int pixel_shift = h->pixel_shift;
mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
......@@ -1312,7 +1314,7 @@ decode_intra_mb:
h->slice_table[ mb_xy ]= h->slice_num;
if(IS_INTRA_PCM(mb_type)) {
const int mb_size = 384*h->sps.bit_depth_luma/8;
const int mb_size = (384*h->sps.bit_depth_luma) >> 3;
const uint8_t *ptr;
// We assume these blocks are very rare so we do not optimize it.
......@@ -1670,7 +1672,7 @@ decode_intra_mb:
qmul = h->dequant4_coeff[0][s->qscale];
for( i = 0; i < 16; i++ ) {
//av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 AC:%d\n", i );
decode_cabac_residual_nondc(h, h->mb + (16*i<<h->pixel_shift), 1, i, scan + 1, qmul, 15);
decode_cabac_residual_nondc(h, h->mb + (16*i << pixel_shift), 1, i, scan + 1, qmul, 15);
}
} else {
fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1);
......@@ -1680,7 +1682,7 @@ decode_intra_mb:
for( i8x8 = 0; i8x8 < 4; i8x8++ ) {
if( cbp & (1<<i8x8) ) {
if( IS_8x8DCT(mb_type) ) {
decode_cabac_residual_nondc(h, h->mb + (64*i8x8<<h->pixel_shift), 5, 4*i8x8,
decode_cabac_residual_nondc(h, h->mb + (64*i8x8 << pixel_shift), 5, 4*i8x8,
scan8x8, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 64);
} else {
qmul = h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale];
......@@ -1688,7 +1690,7 @@ decode_intra_mb:
const int index = 4*i8x8 + i4x4;
//av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index );
//START_TIMER
decode_cabac_residual_nondc(h, h->mb + (16*index<<h->pixel_shift), 2, index, scan, qmul, 16);
decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), 2, index, scan, qmul, 16);
//STOP_TIMER("decode_residual")
}
}
......@@ -1703,7 +1705,7 @@ decode_intra_mb:
int c;
for( c = 0; c < 2; c++ ) {
//av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c );
decode_cabac_residual_dc(h, h->mb + ((256 + 16*4*c)<<h->pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4);
decode_cabac_residual_dc(h, h->mb + ((256 + 16*4*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4);
}
}
......@@ -1714,7 +1716,7 @@ decode_intra_mb:
for( i = 0; i < 4; i++ ) {
const int index = 16 + 4 * c + i;
//av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 );
decode_cabac_residual_nondc(h, h->mb + (16*index<<h->pixel_shift), 4, index, scan + 1, qmul, 15);
decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15);
}
}
} else {
......
......@@ -542,6 +542,7 @@ int ff_h264_decode_mb_cavlc(H264Context *h){
int partition_count;
unsigned int mb_type, cbp;
int dct8x8_allowed= h->pps.transform_8x8_mode;
const int pixel_shift = h->pixel_shift;
mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
......@@ -961,7 +962,7 @@ decode_intra_mb:
for(i8x8=0; i8x8<4; i8x8++){
for(i4x4=0; i4x4<4; i4x4++){
const int index= i4x4 + 4*i8x8;
if( decode_residual(h, h->intra_gb_ptr, h->mb + (16*index<<h->pixel_shift), index, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0 ){
if( decode_residual(h, h->intra_gb_ptr, h->mb + (16*index << pixel_shift), index, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0 ){
return -1;
}
}
......@@ -973,7 +974,7 @@ decode_intra_mb:
for(i8x8=0; i8x8<4; i8x8++){
if(cbp & (1<<i8x8)){
if(IS_8x8DCT(mb_type)){
DCTELEM *buf = &h->mb[64*i8x8<<h->pixel_shift];
DCTELEM *buf = &h->mb[64*i8x8 << pixel_shift];
uint8_t *nnz;
for(i4x4=0; i4x4<4; i4x4++){
if( decode_residual(h, gb, buf, i4x4+4*i8x8, scan8x8+16*i4x4,
......@@ -986,7 +987,7 @@ decode_intra_mb:
for(i4x4=0; i4x4<4; i4x4++){
const int index= i4x4 + 4*i8x8;
if( decode_residual(h, gb, h->mb + (16*index<<h->pixel_shift), index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) <0 ){
if( decode_residual(h, gb, h->mb + (16*index << pixel_shift), index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) <0 ){
return -1;
}
}
......@@ -1000,7 +1001,7 @@ decode_intra_mb:
if(cbp&0x30){
for(chroma_idx=0; chroma_idx<2; chroma_idx++)
if( decode_residual(h, gb, h->mb + ((256 + 16*4*chroma_idx)<<h->pixel_shift), CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){
if( decode_residual(h, gb, h->mb + ((256 + 16*4*chroma_idx) << pixel_shift), CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){
return -1;
}
}
......@@ -1010,7 +1011,7 @@ decode_intra_mb:
const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]];
for(i4x4=0; i4x4<4; i4x4++){
const int index= 16 + 4*chroma_idx + i4x4;
if( decode_residual(h, gb, h->mb + (16*index<<h->pixel_shift), index, scan + 1, qmul, 15) < 0){
if( decode_residual(h, gb, h->mb + (16*index << pixel_shift), index, scan + 1, qmul, 15) < 0){
return -1;
}
}
......
This diff is collapsed.
......@@ -70,7 +70,7 @@ static const AVRational pixel_aspect[17]={
QP(37,d), QP(37,d), QP(37,d), QP(38,d), QP(38,d), QP(38,d),\
QP(39,d), QP(39,d), QP(39,d), QP(39,d)
const uint8_t ff_h264_chroma_qp[3][QP_MAX_MAX+1] = {
const uint8_t ff_h264_chroma_qp[3][QP_MAX_NUM+1] = {
{
CHROMA_QP_TABLE_END(8)
},
......
......@@ -629,8 +629,9 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
* short_ref and long_ref buffers.
*/
av_log(h->s.avctx, AV_LOG_ERROR,
"number of reference frames exceeds max (probably "
"corrupt input), discarding one long:%d short:%d max:%d\n", h->long_ref_count, h->short_ref_count, h->sps.ref_frame_count);
"number of reference frames (%d+%d) exceeds max (%d; probably "
"corrupt input), discarding one\n",
h->long_ref_count, h->short_ref_count, h->sps.ref_frame_count);
if (h->long_ref_count && !h->short_ref_count) {
for (i = 0; i < 16; ++i)
......
......@@ -30,15 +30,15 @@
#include "h264dsp.h"
#define BIT_DEPTH 8
#include "h264dsp_internal.h"
#include "h264dsp_template.c"
#undef BIT_DEPTH
#define BIT_DEPTH 9
#include "h264dsp_internal.h"
#include "h264dsp_template.c"
#undef BIT_DEPTH
#define BIT_DEPTH 10
#include "h264dsp_internal.h"
#include "h264dsp_template.c"
#undef BIT_DEPTH
void ff_h264dsp_init(H264DSPContext *c, const int bit_depth)
......@@ -47,46 +47,50 @@ void ff_h264dsp_init(H264DSPContext *c, const int bit_depth)
#define FUNC(a, depth) a ## _ ## depth ## _c
#define H264_DSP(depth) \
c->h264_idct_add = FUNC(ff_h264_idct_add , depth);\
c->h264_idct8_add = FUNC(ff_h264_idct8_add , depth);\
c->h264_idct_dc_add = FUNC(ff_h264_idct_dc_add , depth);\
c->h264_idct8_dc_add = FUNC(ff_h264_idct8_dc_add , depth);\
c->h264_idct_add16 = FUNC(ff_h264_idct_add16 , depth);\
c->h264_idct8_add4 = FUNC(ff_h264_idct8_add4 , depth);\
c->h264_idct_add8 = FUNC(ff_h264_idct_add8 , depth);\
c->h264_idct_add16intra = FUNC(ff_h264_idct_add16intra , depth);\
c->h264_luma_dc_dequant_idct = FUNC(ff_h264_luma_dc_dequant_idct , depth);\
c->h264_chroma_dc_dequant_idct = FUNC(ff_h264_chroma_dc_dequant_idct , depth);\
c->h264_idct_add= FUNC(ff_h264_idct_add, depth);\
c->h264_idct8_add= FUNC(ff_h264_idct8_add, depth);\
c->h264_idct_dc_add= FUNC(ff_h264_idct_dc_add, depth);\
c->h264_idct8_dc_add= FUNC(ff_h264_idct8_dc_add, depth);\
c->h264_idct_add16 = FUNC(ff_h264_idct_add16, depth);\
c->h264_idct8_add4 = FUNC(ff_h264_idct8_add4, depth);\
c->h264_idct_add8 = FUNC(ff_h264_idct_add8, depth);\
c->h264_idct_add16intra= FUNC(ff_h264_idct_add16intra, depth);\
c->h264_luma_dc_dequant_idct= FUNC(ff_h264_luma_dc_dequant_idct, depth);\
c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma_dc_dequant_idct, depth);\
\
c->weight_h264_pixels_tab[0] = FUNC( weight_h264_pixels16x16 , depth);\
c->weight_h264_pixels_tab[1] = FUNC( weight_h264_pixels16x8 , depth);\
c->weight_h264_pixels_tab[2] = FUNC( weight_h264_pixels8x16 , depth);\
c->weight_h264_pixels_tab[3] = FUNC( weight_h264_pixels8x8 , depth);\
c->weight_h264_pixels_tab[4] = FUNC( weight_h264_pixels8x4 , depth);\
c->weight_h264_pixels_tab[5] = FUNC( weight_h264_pixels4x8 , depth);\
c->weight_h264_pixels_tab[6] = FUNC( weight_h264_pixels4x4 , depth);\
c->weight_h264_pixels_tab[7] = FUNC( weight_h264_pixels4x2 , depth);\
c->weight_h264_pixels_tab[8] = FUNC( weight_h264_pixels2x4 , depth);\
c->weight_h264_pixels_tab[9] = FUNC( weight_h264_pixels2x2 , depth);\
c->biweight_h264_pixels_tab[0] = FUNC(biweight_h264_pixels16x16 , depth);\
c->biweight_h264_pixels_tab[1] = FUNC(biweight_h264_pixels16x8 , depth);\
c->biweight_h264_pixels_tab[2] = FUNC(biweight_h264_pixels8x16 , depth);\
c->biweight_h264_pixels_tab[3] = FUNC(biweight_h264_pixels8x8 , depth);\
c->biweight_h264_pixels_tab[4] = FUNC(biweight_h264_pixels8x4 , depth);\
c->biweight_h264_pixels_tab[5] = FUNC(biweight_h264_pixels4x8 , depth);\
c->biweight_h264_pixels_tab[6] = FUNC(biweight_h264_pixels4x4 , depth);\
c->biweight_h264_pixels_tab[7] = FUNC(biweight_h264_pixels4x2 , depth);\
c->biweight_h264_pixels_tab[8] = FUNC(biweight_h264_pixels2x4 , depth);\
c->biweight_h264_pixels_tab[9] = FUNC(biweight_h264_pixels2x2 , depth);\
c->weight_h264_pixels_tab[0]= FUNC(weight_h264_pixels16x16, depth);\
c->weight_h264_pixels_tab[1]= FUNC(weight_h264_pixels16x8, depth);\
c->weight_h264_pixels_tab[2]= FUNC(weight_h264_pixels8x16, depth);\
c->weight_h264_pixels_tab[3]= FUNC(weight_h264_pixels8x8, depth);\
c->weight_h264_pixels_tab[4]= FUNC(weight_h264_pixels8x4, depth);\
c->weight_h264_pixels_tab[5]= FUNC(weight_h264_pixels4x8, depth);\
c->weight_h264_pixels_tab[6]= FUNC(weight_h264_pixels4x4, depth);\
c->weight_h264_pixels_tab[7]= FUNC(weight_h264_pixels4x2, depth);\
c->weight_h264_pixels_tab[8]= FUNC(weight_h264_pixels2x4, depth);\
c->weight_h264_pixels_tab[9]= FUNC(weight_h264_pixels2x2, depth);\
c->biweight_h264_pixels_tab[0]= FUNC(biweight_h264_pixels16x16, depth);\
c->biweight_h264_pixels_tab[1]= FUNC(biweight_h264_pixels16x8, depth);\
c->biweight_h264_pixels_tab[2]= FUNC(biweight_h264_pixels8x16, depth);\
c->biweight_h264_pixels_tab[3]= FUNC(biweight_h264_pixels8x8, depth);\
c->biweight_h264_pixels_tab[4]= FUNC(biweight_h264_pixels8x4, depth);\
c->biweight_h264_pixels_tab[5]= FUNC(biweight_h264_pixels4x8, depth);\
c->biweight_h264_pixels_tab[6]= FUNC(biweight_h264_pixels4x4, depth);\
c->biweight_h264_pixels_tab[7]= FUNC(biweight_h264_pixels4x2, depth);\
c->biweight_h264_pixels_tab[8]= FUNC(biweight_h264_pixels2x4, depth);\
c->biweight_h264_pixels_tab[9]= FUNC(biweight_h264_pixels2x2, depth);\
\
c->h264_v_loop_filter_luma = FUNC(h264_v_loop_filter_luma , depth);\
c->h264_h_loop_filter_luma = FUNC(h264_h_loop_filter_luma , depth);\
c->h264_v_loop_filter_luma_intra = FUNC(h264_v_loop_filter_luma_intra , depth);\
c->h264_h_loop_filter_luma_intra = FUNC(h264_h_loop_filter_luma_intra , depth);\
c->h264_v_loop_filter_chroma = FUNC(h264_v_loop_filter_chroma , depth);\
c->h264_h_loop_filter_chroma = FUNC(h264_h_loop_filter_chroma , depth);\
c->h264_v_loop_filter_chroma_intra = FUNC(h264_v_loop_filter_chroma_intra, depth);\
c->h264_h_loop_filter_chroma_intra = FUNC(h264_h_loop_filter_chroma_intra, depth);\
c->h264_v_loop_filter_luma= FUNC(h264_v_loop_filter_luma, depth);\
c->h264_h_loop_filter_luma= FUNC(h264_h_loop_filter_luma, depth);\
c->h264_h_loop_filter_luma_mbaff= FUNC(h264_h_loop_filter_luma_mbaff, depth);\
c->h264_v_loop_filter_luma_intra= FUNC(h264_v_loop_filter_luma_intra, depth);\
c->h264_h_loop_filter_luma_intra= FUNC(h264_h_loop_filter_luma_intra, depth);\
c->h264_h_loop_filter_luma_mbaff_intra= FUNC(h264_h_loop_filter_luma_mbaff_intra, depth);\
c->h264_v_loop_filter_chroma= FUNC(h264_v_loop_filter_chroma, depth);\
c->h264_h_loop_filter_chroma= FUNC(h264_h_loop_filter_chroma, depth);\
c->h264_h_loop_filter_chroma_mbaff= FUNC(h264_h_loop_filter_chroma_mbaff, depth);\
c->h264_v_loop_filter_chroma_intra= FUNC(h264_v_loop_filter_chroma_intra, depth);\
c->h264_h_loop_filter_chroma_intra= FUNC(h264_h_loop_filter_chroma_intra, depth);\
c->h264_h_loop_filter_chroma_mbaff_intra= FUNC(h264_h_loop_filter_chroma_mbaff_intra, depth);\
c->h264_loop_filter_strength= NULL;
switch (bit_depth) {
......
......@@ -45,13 +45,17 @@ typedef struct H264DSPContext{
/* loop filter */
void (*h264_v_loop_filter_luma)(uint8_t *pix/*align 16*/, int stride, int alpha, int beta, int8_t *tc0);
void (*h264_h_loop_filter_luma)(uint8_t *pix/*align 4 */, int stride, int alpha, int beta, int8_t *tc0);
void (*h264_h_loop_filter_luma_mbaff)(uint8_t *pix/*align 16*/, int stride, int alpha, int beta, int8_t *tc0);
/* v/h_loop_filter_luma_intra: align 16 */
void (*h264_v_loop_filter_luma_intra)(uint8_t *pix, int stride, int alpha, int beta);
void (*h264_h_loop_filter_luma_intra)(uint8_t *pix, int stride, int alpha, int beta);
void (*h264_h_loop_filter_luma_mbaff_intra)(uint8_t *pix/*align 16*/, int stride, int alpha, int beta);
void (*h264_v_loop_filter_chroma)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta, int8_t *tc0);
void (*h264_h_loop_filter_chroma)(uint8_t *pix/*align 4*/, int stride, int alpha, int beta, int8_t *tc0);
void (*h264_h_loop_filter_chroma_mbaff)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta, int8_t *tc0);
void (*h264_v_loop_filter_chroma_intra)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta);
void (*h264_h_loop_filter_chroma_intra)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta);
void (*h264_h_loop_filter_chroma_mbaff_intra)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta);
// h264_loop_filter_strength: simd only. the C version is inlined in h264.c
void (*h264_loop_filter_strength)(int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2],
int bidir, int edges, int step, int mask_mv0, int mask_mv1, int field);
......
This diff is collapsed.
......@@ -26,13 +26,13 @@
*/
#define BIT_DEPTH 8
#include "h264idct_internal.h"
#include "h264idct_template.c"
#undef BIT_DEPTH
#define BIT_DEPTH 9
#include "h264idct_internal.h"
#include "h264idct_template.c"
#undef BIT_DEPTH
#define BIT_DEPTH 10
#include "h264idct_internal.h"
#include "h264idct_template.c"
#undef BIT_DEPTH
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "dsputil.h"
#ifndef BIT_DEPTH
#define BIT_DEPTH 8
#endif
#ifdef AVCODEC_H264_HIGH_DEPTH_H
# undef pixel
# undef pixel2
# undef pixel4
# undef dctcoef
# undef INIT_CLIP
# undef no_rnd_avg_pixel4
# undef rnd_avg_pixel4
# undef AV_RN2P
# undef AV_RN4P
# undef AV_WN2P
# undef AV_WN4P
# undef AV_WN4PA
# undef CLIP
# undef FUNC
# undef FUNCC
# undef av_clip_pixel
# undef PIXEL_SPLAT_X4
#else
# define AVCODEC_H264_HIGH_DEPTH_H
# define CLIP_PIXEL(depth)\
static inline uint16_t av_clip_pixel_ ## depth (int p)\
{\
const int pixel_max = (1 << depth)-1;\
return (p & ~pixel_max) ? (-p)>>31 & pixel_max : p;\
}
CLIP_PIXEL( 9)
CLIP_PIXEL(10)
#endif
#if BIT_DEPTH > 8
# define pixel uint16_t
# define pixel2 uint32_t
# define pixel4 uint64_t
# define dctcoef int32_t
# define INIT_CLIP
# define no_rnd_avg_pixel4 no_rnd_avg64
# define rnd_avg_pixel4 rnd_avg64
# define AV_RN2P AV_RN32
# define AV_RN4P AV_RN64
# define AV_WN2P AV_WN32
# define AV_WN4P AV_WN64
# define AV_WN4PA AV_WN64A
# define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL)
#else
# define pixel uint8_t
# define pixel2 uint16_t
# define pixel4 uint32_t
# define dctcoef int16_t
# define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
# define no_rnd_avg_pixel4 no_rnd_avg32
# define rnd_avg_pixel4 rnd_avg32
# define AV_RN2P AV_RN16
# define AV_RN4P AV_RN32
# define AV_WN2P AV_WN16
# define AV_WN4P AV_WN32
# define AV_WN4PA AV_WN32A
# define PIXEL_SPLAT_X4(x) ((x)*0x01010101U)
#endif
#if BIT_DEPTH == 8
# define av_clip_pixel(a) av_clip_uint8(a)
# define CLIP(a) cm[a]
# define FUNC(a) a ## _8
# define FUNCC(a) a ## _8_c
#elif BIT_DEPTH == 9
# define av_clip_pixel(a) av_clip_pixel_9(a)
# define CLIP(a) av_clip_pixel_9(a)
# define FUNC(a) a ## _9
# define FUNCC(a) a ## _9_c
#elif BIT_DEPTH == 10
# define av_clip_pixel(a) av_clip_pixel_10(a)
# define CLIP(a) av_clip_pixel_10(a)
# define FUNC(a) a ## _10
# define FUNCC(a) a ## _10_c
#endif
......@@ -158,7 +158,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
const int32_t *samples, int blocksize, int min_order,
int max_order, int precision,
int32_t coefs[][MAX_LPC_ORDER], int *shift,
enum AVLPCType lpc_type, int lpc_passes,
enum FFLPCType lpc_type, int lpc_passes,
int omethod, int max_shift, int zero_shift)
{
double autoc[MAX_LPC_ORDER+1];
......@@ -168,7 +168,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
int opt_order;
assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER &&
lpc_type > AV_LPC_TYPE_FIXED);
lpc_type > FF_LPC_TYPE_FIXED);
/* reinit LPC context if parameters have changed */
if (blocksize != s->blocksize || max_order != s->max_order ||
......@@ -177,7 +177,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
ff_lpc_init(s, blocksize, max_order, lpc_type);
}
if (lpc_type == AV_LPC_TYPE_LEVINSON) {
if (lpc_type == FF_LPC_TYPE_LEVINSON) {
double *windowed_samples = s->windowed_samples + max_order;
s->lpc_apply_welch_window(samples, blocksize, windowed_samples);
......@@ -188,7 +188,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
for(i=0; i<max_order; i++)
ref[i] = fabs(lpc[i][i]);
} else if (lpc_type == AV_LPC_TYPE_CHOLESKY) {
} else if (lpc_type == FF_LPC_TYPE_CHOLESKY) {
LLSModel m[2];
double var[MAX_LPC_ORDER+1], av_uninit(weight);
......@@ -241,13 +241,13 @@ int ff_lpc_calc_coefs(LPCContext *s,
}
av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order,
enum AVLPCType lpc_type)
enum FFLPCType lpc_type)
{
s->blocksize = blocksize;
s->max_order = max_order;
s->lpc_type = lpc_type;
if (lpc_type == AV_LPC_TYPE_LEVINSON) {
if (lpc_type == FF_LPC_TYPE_LEVINSON) {
s->windowed_samples = av_mallocz((blocksize + max_order + 2) *
sizeof(*s->windowed_samples));
if (!s->windowed_samples)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -62,5 +62,8 @@
#ifndef FF_API_OLD_FF_PICT_TYPES
#define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_FLAC_GLOBAL_OPTS
#define FF_API_FLAC_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#endif /* AVCODEC_VERSION_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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