Commit 504811ba authored by Jason Garrett-Glaser's avatar Jason Garrett-Glaser

Roll back 4:4:4 H.264 for now

Needs some ARM/PPC asm modifications.
parent 295f0a25
...@@ -507,7 +507,7 @@ typedef struct DSPContext { ...@@ -507,7 +507,7 @@ typedef struct DSPContext {
#define BASIS_SHIFT 16 #define BASIS_SHIFT 16
#define RECON_SHIFT 6 #define RECON_SHIFT 6
void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w, int h, int sides); void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w, int sides);
#define EDGE_WIDTH 16 #define EDGE_WIDTH 16
#define EDGE_TOP 1 #define EDGE_TOP 1
#define EDGE_BOTTOM 2 #define EDGE_BOTTOM 2
......
...@@ -79,7 +79,7 @@ static inline void FUNC(copy_block16)(uint8_t *dst, const uint8_t *src, int dstS ...@@ -79,7 +79,7 @@ static inline void FUNC(copy_block16)(uint8_t *dst, const uint8_t *src, int dstS
/* draw the edges of width 'w' of an image of size width, height */ /* draw the edges of width 'w' of an image of size width, height */
//FIXME check that this is ok for mpeg4 interlaced //FIXME check that this is ok for mpeg4 interlaced
static void FUNCC(draw_edges)(uint8_t *_buf, int _wrap, int width, int height, int w, int h, int sides) static void FUNCC(draw_edges)(uint8_t *_buf, int _wrap, int width, int height, int w, int sides)
{ {
pixel *buf = (pixel*)_buf; pixel *buf = (pixel*)_buf;
int wrap = _wrap / sizeof(pixel); int wrap = _wrap / sizeof(pixel);
...@@ -106,10 +106,10 @@ static void FUNCC(draw_edges)(uint8_t *_buf, int _wrap, int width, int height, i ...@@ -106,10 +106,10 @@ static void FUNCC(draw_edges)(uint8_t *_buf, int _wrap, int width, int height, i
buf -= w; buf -= w;
last_line = buf + (height - 1) * wrap; last_line = buf + (height - 1) * wrap;
if (sides & EDGE_TOP) if (sides & EDGE_TOP)
for(i = 0; i < h; i++) for(i = 0; i < w; i++)
memcpy(buf - (i + 1) * wrap, buf, (width + w + w) * sizeof(pixel)); // top memcpy(buf - (i + 1) * wrap, buf, (width + w + w) * sizeof(pixel)); // top
if (sides & EDGE_BOTTOM) if (sides & EDGE_BOTTOM)
for (i = 0; i < h; i++) for (i = 0; i < w; i++)
memcpy(last_line + (i + 1) * wrap, last_line, (width + w + w) * sizeof(pixel)); // bottom memcpy(last_line + (i + 1) * wrap, last_line, (width + w + w) * sizeof(pixel)); // bottom
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -269,7 +269,7 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s ...@@ -269,7 +269,7 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s
fallback_sps ? sps->scaling_matrix4[0] : default_scaling4[0], fallback_sps ? sps->scaling_matrix4[0] : default_scaling4[0],
fallback_sps ? sps->scaling_matrix4[3] : default_scaling4[1], fallback_sps ? sps->scaling_matrix4[3] : default_scaling4[1],
fallback_sps ? sps->scaling_matrix8[0] : default_scaling8[0], fallback_sps ? sps->scaling_matrix8[0] : default_scaling8[0],
fallback_sps ? sps->scaling_matrix8[3] : default_scaling8[1] fallback_sps ? sps->scaling_matrix8[1] : default_scaling8[1]
}; };
if(get_bits1(&s->gb)){ if(get_bits1(&s->gb)){
sps->scaling_matrix_present |= is_sps; sps->scaling_matrix_present |= is_sps;
...@@ -281,15 +281,7 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s ...@@ -281,15 +281,7 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s
decode_scaling_list(h,scaling_matrix4[5],16,default_scaling4[1],scaling_matrix4[4]); // Inter, Cb decode_scaling_list(h,scaling_matrix4[5],16,default_scaling4[1],scaling_matrix4[4]); // Inter, Cb
if(is_sps || pps->transform_8x8_mode){ if(is_sps || pps->transform_8x8_mode){
decode_scaling_list(h,scaling_matrix8[0],64,default_scaling8[0],fallback[2]); // Intra, Y decode_scaling_list(h,scaling_matrix8[0],64,default_scaling8[0],fallback[2]); // Intra, Y
if(h->sps.chroma_format_idc == 3){ decode_scaling_list(h,scaling_matrix8[1],64,default_scaling8[1],fallback[3]); // Inter, Y
decode_scaling_list(h,scaling_matrix8[1],64,default_scaling8[0],scaling_matrix8[0]); // Intra, Cr
decode_scaling_list(h,scaling_matrix8[2],64,default_scaling8[0],scaling_matrix8[1]); // Intra, Cb
}
decode_scaling_list(h,scaling_matrix8[3],64,default_scaling8[1],fallback[3]); // Inter, Y
if(h->sps.chroma_format_idc == 3){
decode_scaling_list(h,scaling_matrix8[4],64,default_scaling8[1],scaling_matrix8[3]); // Inter, Cr
decode_scaling_list(h,scaling_matrix8[5],64,default_scaling8[1],scaling_matrix8[4]); // Inter, Cb
}
} }
} }
} }
...@@ -403,7 +395,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){ ...@@ -403,7 +395,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
if(sps->crop_left || sps->crop_top){ if(sps->crop_left || sps->crop_top){
av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n"); av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n");
} }
if(sps->crop_right >= (8<<CHROMA444) || sps->crop_bottom >= (8<<CHROMA444)){ if(sps->crop_right >= 8 || sps->crop_bottom >= 8){
av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n"); av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n");
} }
}else{ }else{
......
...@@ -66,10 +66,10 @@ typedef struct H264DSPContext{ ...@@ -66,10 +66,10 @@ typedef struct H264DSPContext{
void (*h264_idct_dc_add)(uint8_t *dst/*align 4*/, DCTELEM *block/*align 16*/, int stride); void (*h264_idct_dc_add)(uint8_t *dst/*align 4*/, DCTELEM *block/*align 16*/, int stride);
void (*h264_idct8_dc_add)(uint8_t *dst/*align 8*/, DCTELEM *block/*align 16*/, int stride); void (*h264_idct8_dc_add)(uint8_t *dst/*align 8*/, DCTELEM *block/*align 16*/, int stride);
void (*h264_idct_add16)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[15*8]); void (*h264_idct_add16)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
void (*h264_idct8_add4)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[15*8]); void (*h264_idct8_add4)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
void (*h264_idct_add8)(uint8_t **dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[15*8]); void (*h264_idct_add8)(uint8_t **dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
void (*h264_idct_add16intra)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[15*8]); void (*h264_idct_add16intra)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
void (*h264_luma_dc_dequant_idct)(DCTELEM *output, DCTELEM *input/*align 16*/, int qmul); void (*h264_luma_dc_dequant_idct)(DCTELEM *output, DCTELEM *input/*align 16*/, int qmul);
void (*h264_chroma_dc_dequant_idct)(DCTELEM *block, int qmul); void (*h264_chroma_dc_dequant_idct)(DCTELEM *block, int qmul);
}H264DSPContext; }H264DSPContext;
......
...@@ -30,19 +30,15 @@ ...@@ -30,19 +30,15 @@
#ifndef AVCODEC_H264IDCT_INTERNAL_H #ifndef AVCODEC_H264IDCT_INTERNAL_H
#define AVCODEC_H264IDCT_INTERNAL_H #define AVCODEC_H264IDCT_INTERNAL_H
//FIXME this table is a duplicate from h264data.h, and will be removed once the tables from, h264 have been split //FIXME this table is a duplicate from h264data.h, and will be removed once the tables from, h264 have been split
static const uint8_t scan8[16*3]={ static const uint8_t scan8[16 + 2*4]={
4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8, 4+1*8, 5+1*8, 4+2*8, 5+2*8,
6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8, 6+1*8, 7+1*8, 6+2*8, 7+2*8,
4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8, 4+3*8, 5+3*8, 4+4*8, 5+4*8,
6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8, 6+3*8, 7+3*8, 6+4*8, 7+4*8,
4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8, 1+1*8, 2+1*8,
6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8, 1+2*8, 2+2*8,
4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8, 1+4*8, 2+4*8,
6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8, 1+5*8, 2+5*8,
4+11*8, 5+11*8, 4+12*8, 5+12*8,
6+11*8, 7+11*8, 6+12*8, 7+12*8,
4+13*8, 5+13*8, 4+14*8, 5+14*8,
6+13*8, 7+13*8, 6+14*8, 7+14*8
}; };
#endif #endif
...@@ -194,7 +190,7 @@ void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){ ...@@ -194,7 +190,7 @@ void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){
} }
} }
void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15*8]){ void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i; int i;
for(i=0; i<16; i++){ for(i=0; i<16; i++){
int nnz = nnzc[ scan8[i] ]; int nnz = nnzc[ scan8[i] ];
...@@ -205,7 +201,7 @@ void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, DCTELEM *b ...@@ -205,7 +201,7 @@ void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, DCTELEM *b
} }
} }
void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15*8]){ void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i; int i;
for(i=0; i<16; i++){ for(i=0; i<16; i++){
if(nnzc[ scan8[i] ]) FUNCC(idct_internal )(dst + block_offset[i], block + i*16*sizeof(pixel), stride, 4, 6, 1); if(nnzc[ scan8[i] ]) FUNCC(idct_internal )(dst + block_offset[i], block + i*16*sizeof(pixel), stride, 4, 6, 1);
...@@ -213,7 +209,7 @@ void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, DCTEL ...@@ -213,7 +209,7 @@ void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, DCTEL
} }
} }
void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15*8]){ void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i; int i;
for(i=0; i<16; i+=4){ for(i=0; i<16; i+=4){
int nnz = nnzc[ scan8[i] ]; int nnz = nnzc[ scan8[i] ];
...@@ -224,15 +220,13 @@ void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset, DCTELEM *b ...@@ -224,15 +220,13 @@ void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset, DCTELEM *b
} }
} }
void FUNCC(ff_h264_idct_add8)(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15*8]){ void FUNCC(ff_h264_idct_add8)(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i, j; int i;
for(j=1; j<3; j++){ for(i=16; i<16+8; i++){
for(i=j*16; i<j*16+4; i++){ if(nnzc[ scan8[i] ])
if(nnzc[ scan8[i] ]) FUNCC(ff_h264_idct_add )(dest[(i&4)>>2] + block_offset[i], block + i*16*sizeof(pixel), stride);
FUNCC(ff_h264_idct_add )(dest[j-1] + block_offset[i], block + i*16*sizeof(pixel), stride); else if(((dctcoef*)block)[i*16])
else if(((dctcoef*)block)[i*16]) FUNCC(ff_h264_idct_dc_add)(dest[(i&4)>>2] + block_offset[i], block + i*16*sizeof(pixel), stride);
FUNCC(ff_h264_idct_dc_add)(dest[j-1] + block_offset[i], block + i*16*sizeof(pixel), stride);
}
} }
} }
/** /**
......
...@@ -1185,17 +1185,15 @@ void MPV_frame_end(MpegEncContext *s) ...@@ -1185,17 +1185,15 @@ void MPV_frame_end(MpegEncContext *s)
&& s->current_picture.reference && s->current_picture.reference
&& !s->intra_only && !s->intra_only
&& !(s->flags&CODEC_FLAG_EMU_EDGE)) { && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
int hshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_w;
int vshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_h;
s->dsp.draw_edges(s->current_picture.data[0], s->linesize , s->dsp.draw_edges(s->current_picture.data[0], s->linesize ,
s->h_edge_pos , s->v_edge_pos, s->h_edge_pos , s->v_edge_pos ,
EDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM); EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM);
s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize, s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize,
s->h_edge_pos>>hshift, s->v_edge_pos>>vshift, s->h_edge_pos>>1, s->v_edge_pos>>1,
EDGE_WIDTH>>hshift, EDGE_WIDTH>>vshift, EDGE_TOP | EDGE_BOTTOM); EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM);
s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize, s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize,
s->h_edge_pos>>hshift, s->v_edge_pos>>vshift, s->h_edge_pos>>1, s->v_edge_pos>>1,
EDGE_WIDTH>>hshift, EDGE_WIDTH>>vshift, EDGE_TOP | EDGE_BOTTOM); EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM);
} }
emms_c(); emms_c();
...@@ -2286,19 +2284,14 @@ void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ ...@@ -2286,19 +2284,14 @@ void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
&& !s->intra_only && !s->intra_only
&& !(s->flags&CODEC_FLAG_EMU_EDGE)) { && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
int sides = 0, edge_h; int sides = 0, edge_h;
int hshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_w;
int vshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_h;
if (y==0) sides |= EDGE_TOP; if (y==0) sides |= EDGE_TOP;
if (y + h >= s->v_edge_pos) sides |= EDGE_BOTTOM; if (y + h >= s->v_edge_pos) sides |= EDGE_BOTTOM;
edge_h= FFMIN(h, s->v_edge_pos - y); edge_h= FFMIN(h, s->v_edge_pos - y);
s->dsp.draw_edges(s->current_picture_ptr->data[0] + y *s->linesize , s->linesize, s->dsp.draw_edges(s->current_picture_ptr->data[0] + y *s->linesize , s->linesize , s->h_edge_pos , edge_h , EDGE_WIDTH , sides);
s->h_edge_pos , edge_h , EDGE_WIDTH , EDGE_WIDTH , sides); s->dsp.draw_edges(s->current_picture_ptr->data[1] + (y>>1)*s->uvlinesize, s->uvlinesize, s->h_edge_pos>>1, edge_h>>1, EDGE_WIDTH/2, sides);
s->dsp.draw_edges(s->current_picture_ptr->data[1] + (y>>vshift)*s->uvlinesize, s->uvlinesize, s->dsp.draw_edges(s->current_picture_ptr->data[2] + (y>>1)*s->uvlinesize, s->uvlinesize, s->h_edge_pos>>1, edge_h>>1, EDGE_WIDTH/2, sides);
s->h_edge_pos>>hshift, edge_h>>hshift, EDGE_WIDTH>>hshift, EDGE_WIDTH>>vshift, sides);
s->dsp.draw_edges(s->current_picture_ptr->data[2] + (y>>vshift)*s->uvlinesize, s->uvlinesize,
s->h_edge_pos>>hshift, edge_h>>hshift, EDGE_WIDTH>>hshift, EDGE_WIDTH>>vshift, sides);
} }
h= FFMIN(h, s->avctx->height - y); h= FFMIN(h, s->avctx->height - y);
......
...@@ -1978,13 +1978,13 @@ static int frame_start(SnowContext *s){ ...@@ -1978,13 +1978,13 @@ static int frame_start(SnowContext *s){
if(s->current_picture.data[0]){ if(s->current_picture.data[0]){
s->dsp.draw_edges(s->current_picture.data[0], s->dsp.draw_edges(s->current_picture.data[0],
s->current_picture.linesize[0], w , h , s->current_picture.linesize[0], w , h ,
EDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM); EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM);
s->dsp.draw_edges(s->current_picture.data[1], s->dsp.draw_edges(s->current_picture.data[1],
s->current_picture.linesize[1], w>>1, h>>1, s->current_picture.linesize[1], w>>1, h>>1,
EDGE_WIDTH/2, EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM); EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM);
s->dsp.draw_edges(s->current_picture.data[2], s->dsp.draw_edges(s->current_picture.data[2],
s->current_picture.linesize[2], w>>1, h>>1, s->current_picture.linesize[2], w>>1, h>>1,
EDGE_WIDTH/2, EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM); EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM);
} }
release_buffer(s->avctx); release_buffer(s->avctx);
......
...@@ -633,9 +633,8 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type) ...@@ -633,9 +633,8 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy], DC_PRED, 8); memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy], DC_PRED, 8);
} }
if (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B) { if (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B) {
memset(h->non_zero_count_cache + 8, 0, 14*8*sizeof(uint8_t)); memset(h->non_zero_count_cache + 8, 0, 4*9*sizeof(uint8_t));
s->dsp.clear_blocks(h->mb+ 0); s->dsp.clear_blocks(h->mb);
s->dsp.clear_blocks(h->mb+384);
} }
if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B)) { if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B)) {
...@@ -655,8 +654,8 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type) ...@@ -655,8 +654,8 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
} }
} }
if (IS_INTRA16x16(mb_type)) { if (IS_INTRA16x16(mb_type)) {
AV_ZERO128(h->mb_luma_dc[0]+0); AV_ZERO128(h->mb_luma_dc+0);
AV_ZERO128(h->mb_luma_dc[0]+8); AV_ZERO128(h->mb_luma_dc+8);
if (svq3_decode_block(&s->gb, h->mb_luma_dc, 0, 1)){ if (svq3_decode_block(&s->gb, h->mb_luma_dc, 0, 1)){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding intra luma dc\n"); av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding intra luma dc\n");
return -1; return -1;
...@@ -682,23 +681,20 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type) ...@@ -682,23 +681,20 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
} }
if ((cbp & 0x30)) { if ((cbp & 0x30)) {
for (i = 1; i < 3; ++i) { for (i = 0; i < 2; ++i) {
if (svq3_decode_block(&s->gb, &h->mb[16*16*i], 0, 3)){ if (svq3_decode_block(&s->gb, &h->mb[16*(16 + 4*i)], 0, 3)){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n"); av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n");
return -1; return -1;
} }
} }
if ((cbp & 0x20)) { if ((cbp & 0x20)) {
for (i = 1; i < 3; i++) { for (i = 0; i < 8; i++) {
for (j = 0; j < 4; j++) { h->non_zero_count_cache[ scan8[16+i] ] = 1;
k = 16*i + j;
h->non_zero_count_cache[ scan8[k] ] = 1; if (svq3_decode_block(&s->gb, &h->mb[16*(16 + i)], 1, 1)){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma ac block\n");
if (svq3_decode_block(&s->gb, &h->mb[16*k], 1, 1)){ return -1;
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma ac block\n");
return -1;
}
} }
} }
} }
......
...@@ -784,7 +784,7 @@ static void h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale){ ...@@ -784,7 +784,7 @@ static void h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale){
/* draw the edges of width 'w' of an image of size width, height /* draw the edges of width 'w' of an image of size width, height
this mmx version can only handle w==8 || w==16 */ this mmx version can only handle w==8 || w==16 */
static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w, int h, int sides) static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w, int sides)
{ {
uint8_t *ptr, *last_line; uint8_t *ptr, *last_line;
int i; int i;
...@@ -839,7 +839,7 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w, ...@@ -839,7 +839,7 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w,
/* top and bottom (and hopefully also the corners) */ /* top and bottom (and hopefully also the corners) */
if (sides&EDGE_TOP) { if (sides&EDGE_TOP) {
for(i = 0; i < h; i += 4) { for(i = 0; i < w; i += 4) {
ptr= buf - (i + 1) * wrap - w; ptr= buf - (i + 1) * wrap - w;
__asm__ volatile( __asm__ volatile(
"1: \n\t" "1: \n\t"
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS) #if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS)
static int decode_significance_x86(CABACContext *c, int max_coeff, static int decode_significance_x86(CABACContext *c, int max_coeff,
uint8_t *significant_coeff_ctx_base, uint8_t *significant_coeff_ctx_base,
int *index, int last_off){ int *index){
void *end= significant_coeff_ctx_base + max_coeff - 1; void *end= significant_coeff_ctx_base + max_coeff - 1;
int minusstart= -(int)significant_coeff_ctx_base; int minusstart= -(int)significant_coeff_ctx_base;
int minusindex= 4-(int)index; int minusindex= 4-(int)index;
...@@ -52,12 +52,10 @@ static int decode_significance_x86(CABACContext *c, int max_coeff, ...@@ -52,12 +52,10 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
"test $1, %%edx \n\t" "test $1, %%edx \n\t"
" jz 3f \n\t" " jz 3f \n\t"
"add %7, %1 \n\t"
BRANCHLESS_GET_CABAC("%%edx", "%3", "(%1)", "%%ebx", BRANCHLESS_GET_CABAC("%%edx", "%3", "61(%1)", "%%ebx",
"%%bx", "%%esi", "%%eax", "%%al") "%%bx", "%%esi", "%%eax", "%%al")
"sub %7, %1 \n\t"
"mov %2, %%"REG_a" \n\t" "mov %2, %%"REG_a" \n\t"
"movl %4, %%ecx \n\t" "movl %4, %%ecx \n\t"
"add %1, %%"REG_c" \n\t" "add %1, %%"REG_c" \n\t"
...@@ -84,7 +82,7 @@ static int decode_significance_x86(CABACContext *c, int max_coeff, ...@@ -84,7 +82,7 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
"movl %%esi, "RANGE "(%3) \n\t" "movl %%esi, "RANGE "(%3) \n\t"
"movl %%ebx, "LOW "(%3) \n\t" "movl %%ebx, "LOW "(%3) \n\t"
:"=&a"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index) :"=&a"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index)
:"r"(c), "m"(minusstart), "m"(end), "m"(minusindex), "m"(last_off) :"r"(c), "m"(minusstart), "m"(end), "m"(minusindex)
: "%"REG_c, "%ebx", "%edx", "%esi", "memory" : "%"REG_c, "%ebx", "%edx", "%esi", "memory"
); );
return coeff_count; return coeff_count;
...@@ -92,7 +90,7 @@ static int decode_significance_x86(CABACContext *c, int max_coeff, ...@@ -92,7 +90,7 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
static int decode_significance_8x8_x86(CABACContext *c, static int decode_significance_8x8_x86(CABACContext *c,
uint8_t *significant_coeff_ctx_base, uint8_t *significant_coeff_ctx_base,
int *index, int last_off, const uint8_t *sig_off){ int *index, const uint8_t *sig_off){
int minusindex= 4-(int)index; int minusindex= 4-(int)index;
int coeff_count; int coeff_count;
x86_reg last=0; x86_reg last=0;
...@@ -116,9 +114,8 @@ static int decode_significance_8x8_x86(CABACContext *c, ...@@ -116,9 +114,8 @@ static int decode_significance_8x8_x86(CABACContext *c,
"movzbl "MANGLE(last_coeff_flag_offset_8x8)"(%%edi), %%edi\n\t" "movzbl "MANGLE(last_coeff_flag_offset_8x8)"(%%edi), %%edi\n\t"
"add %5, %%"REG_D" \n\t" "add %5, %%"REG_D" \n\t"
"add %7, %%"REG_D" \n\t"
BRANCHLESS_GET_CABAC("%%edx", "%3", "(%%"REG_D")", "%%ebx", BRANCHLESS_GET_CABAC("%%edx", "%3", "15(%%"REG_D")", "%%ebx",
"%%bx", "%%esi", "%%eax", "%%al") "%%bx", "%%esi", "%%eax", "%%al")
"mov %2, %%"REG_a" \n\t" "mov %2, %%"REG_a" \n\t"
...@@ -145,7 +142,7 @@ static int decode_significance_8x8_x86(CABACContext *c, ...@@ -145,7 +142,7 @@ static int decode_significance_8x8_x86(CABACContext *c,
"movl %%esi, "RANGE "(%3) \n\t" "movl %%esi, "RANGE "(%3) \n\t"
"movl %%ebx, "LOW "(%3) \n\t" "movl %%ebx, "LOW "(%3) \n\t"
:"=&a"(coeff_count),"+m"(last), "+m"(index) :"=&a"(coeff_count),"+m"(last), "+m"(index)
:"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off), "m"(last_off) :"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off)
: "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory" : "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory"
); );
return coeff_count; return coeff_count;
......
...@@ -32,18 +32,14 @@ ...@@ -32,18 +32,14 @@
SECTION_RODATA SECTION_RODATA
; FIXME this table is a duplicate from h264data.h, and will be removed once the tables from, h264 have been split ; FIXME this table is a duplicate from h264data.h, and will be removed once the tables from, h264 have been split
scan8_mem: db 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8 scan8_mem: db 4+1*8, 5+1*8, 4+2*8, 5+2*8
db 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8 db 6+1*8, 7+1*8, 6+2*8, 7+2*8
db 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8 db 4+3*8, 5+3*8, 4+4*8, 5+4*8
db 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8 db 6+3*8, 7+3*8, 6+4*8, 7+4*8
db 4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8 db 1+1*8, 2+1*8
db 6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8 db 1+2*8, 2+2*8
db 4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8 db 1+4*8, 2+4*8
db 6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8 db 1+5*8, 2+5*8
db 4+11*8, 5+11*8, 4+12*8, 5+12*8
db 6+11*8, 7+11*8, 6+12*8, 7+12*8
db 4+13*8, 5+13*8, 4+14*8, 5+14*8
db 6+13*8, 7+13*8, 6+14*8, 7+14*8
%ifdef PIC %ifdef PIC
%define scan8 r11 %define scan8 r11
%else %else
...@@ -621,8 +617,6 @@ cglobal h264_idct_add8_8_mmx, 5, 7, 0 ...@@ -621,8 +617,6 @@ cglobal h264_idct_add8_8_mmx, 5, 7, 0
mov r10, r0 mov r10, r0
%endif %endif
call h264_idct_add8_mmx_plane call h264_idct_add8_mmx_plane
mov r5, 32
add r2, 384
%ifdef ARCH_X86_64 %ifdef ARCH_X86_64
add r10, gprsize add r10, gprsize
%else %else
...@@ -684,8 +678,6 @@ cglobal h264_idct_add8_8_mmx2, 5, 7, 0 ...@@ -684,8 +678,6 @@ cglobal h264_idct_add8_8_mmx2, 5, 7, 0
lea r11, [scan8_mem] lea r11, [scan8_mem]
%endif %endif
call h264_idct_add8_mmx2_plane call h264_idct_add8_mmx2_plane
mov r5, 32
add r2, 384
%ifdef ARCH_X86_64 %ifdef ARCH_X86_64
add r10, gprsize add r10, gprsize
%else %else
...@@ -818,12 +810,12 @@ cglobal h264_idct_add16intra_8_sse2, 5, 7, 8 ...@@ -818,12 +810,12 @@ cglobal h264_idct_add16intra_8_sse2, 5, 7, 8
test r0, r0 test r0, r0
jz .try%1dc jz .try%1dc
%ifdef ARCH_X86_64 %ifdef ARCH_X86_64
mov r0d, dword [r1+(%1&1)*8+64*(1+(%1>>1))] mov r0d, dword [r1+%1*8+64]
add r0, [r10] add r0, [r10]
%else %else
mov r0, r0m mov r0, r0m
mov r0, [r0] mov r0, [r0]
add r0, dword [r1+(%1&1)*8+64*(1+(%1>>1))] add r0, dword [r1+%1*8+64]
%endif %endif
call x264_add8x4_idct_sse2 call x264_add8x4_idct_sse2
jmp .cycle%1end jmp .cycle%1end
...@@ -832,18 +824,16 @@ cglobal h264_idct_add16intra_8_sse2, 5, 7, 8 ...@@ -832,18 +824,16 @@ cglobal h264_idct_add16intra_8_sse2, 5, 7, 8
or r0w, word [r2+32] or r0w, word [r2+32]
jz .cycle%1end jz .cycle%1end
%ifdef ARCH_X86_64 %ifdef ARCH_X86_64
mov r0d, dword [r1+(%1&1)*8+64*(1+(%1>>1))] mov r0d, dword [r1+%1*8+64]
add r0, [r10] add r0, [r10]
%else %else
mov r0, r0m mov r0, r0m
mov r0, [r0] mov r0, [r0]
add r0, dword [r1+(%1&1)*8+64*(1+(%1>>1))] add r0, dword [r1+%1*8+64]
%endif %endif
call h264_idct_dc_add8_mmx2 call h264_idct_dc_add8_mmx2
.cycle%1end .cycle%1end
%if %1 == 1 %if %1 < 3
add r2, 384+64
%elif %1 < 3
add r2, 64 add r2, 64
%endif %endif
%endmacro %endmacro
...@@ -855,15 +845,15 @@ cglobal h264_idct_add8_8_sse2, 5, 7, 8 ...@@ -855,15 +845,15 @@ cglobal h264_idct_add8_8_sse2, 5, 7, 8
%ifdef ARCH_X86_64 %ifdef ARCH_X86_64
mov r10, r0 mov r10, r0
%endif %endif
add8_sse2_cycle 0, 0x34 add8_sse2_cycle 0, 0x09
add8_sse2_cycle 1, 0x3c add8_sse2_cycle 1, 0x11
%ifdef ARCH_X86_64 %ifdef ARCH_X86_64
add r10, gprsize add r10, gprsize
%else %else
add r0mp, gprsize add r0mp, gprsize
%endif %endif
add8_sse2_cycle 2, 0x5c add8_sse2_cycle 2, 0x21
add8_sse2_cycle 3, 0x64 add8_sse2_cycle 3, 0x29
RET RET
;void ff_h264_luma_dc_dequant_idct_mmx(DCTELEM *output, DCTELEM *input, int qmul) ;void ff_h264_luma_dc_dequant_idct_mmx(DCTELEM *output, DCTELEM *input, int qmul)
......
...@@ -29,18 +29,14 @@ SECTION_RODATA ...@@ -29,18 +29,14 @@ SECTION_RODATA
pw_pixel_max: times 8 dw ((1 << 10)-1) pw_pixel_max: times 8 dw ((1 << 10)-1)
pd_32: times 4 dd 32 pd_32: times 4 dd 32
scan8_mem: db 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8 scan8_mem: db 4+1*8, 5+1*8, 4+2*8, 5+2*8
db 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8 db 6+1*8, 7+1*8, 6+2*8, 7+2*8
db 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8 db 4+3*8, 5+3*8, 4+4*8, 5+4*8
db 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8 db 6+3*8, 7+3*8, 6+4*8, 7+4*8
db 4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8 db 1+1*8, 2+1*8
db 6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8 db 1+2*8, 2+2*8
db 4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8 db 1+4*8, 2+4*8
db 6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8 db 1+5*8, 2+5*8
db 4+11*8, 5+11*8, 4+12*8, 5+12*8
db 6+11*8, 7+11*8, 6+12*8, 7+12*8
db 4+13*8, 5+13*8, 4+14*8, 5+14*8
db 6+13*8, 7+13*8, 6+14*8, 7+14*8
%ifdef PIC %ifdef PIC
%define scan8 r11 %define scan8 r11
...@@ -310,7 +306,7 @@ INIT_AVX ...@@ -310,7 +306,7 @@ INIT_AVX
IDCT_ADD16INTRA_10 avx IDCT_ADD16INTRA_10 avx
%endif %endif
%assign last_block 36 %assign last_block 24
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; h264_idct_add8(pixel **dst, const int *block_offset, dctcoef *block, int stride, const uint8_t nnzc[6*8]) ; h264_idct_add8(pixel **dst, const int *block_offset, dctcoef *block, int stride, const uint8_t nnzc[6*8])
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
...@@ -321,22 +317,21 @@ cglobal h264_idct_add8_10_%1,5,7 ...@@ -321,22 +317,21 @@ cglobal h264_idct_add8_10_%1,5,7
%endif %endif
add r2, 1024 add r2, 1024
mov r0, [r0] mov r0, [r0]
ADD16_OP_INTRA %1, 16, 4+ 6*8 ADD16_OP_INTRA %1, 16, 1+1*8
ADD16_OP_INTRA %1, 18, 4+ 7*8 ADD16_OP_INTRA %1, 18, 1+2*8
add r2, 1024-128*2
%ifdef ARCH_X86_64 %ifdef ARCH_X86_64
mov r0, [r10+gprsize] mov r0, [r10+gprsize]
%else %else
mov r0, r0m mov r0, r0m
mov r0, [r0+gprsize] mov r0, [r0+gprsize]
%endif %endif
ADD16_OP_INTRA %1, 32, 4+11*8 ADD16_OP_INTRA %1, 20, 1+4*8
ADD16_OP_INTRA %1, 34, 4+12*8 ADD16_OP_INTRA %1, 22, 1+5*8
REP_RET REP_RET
AC %1, 16 AC %1, 16
AC %1, 18 AC %1, 18
AC %1, 32 AC %1, 20
AC %1, 34 AC %1, 22
%endmacro ; IDCT_ADD8 %endmacro ; IDCT_ADD8
......
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