mirror of https://git.ffmpeg.org/ffmpeg.git
Merge remote-tracking branch 'qatar/master'
* qatar/master: adpcm: use sign_extend() mpeg12: fix mpeg_decode_slice context parameter type Revert "mpeg12: move full_pel from MpegEncContext to Mpeg1Context" Conflicts: libavcodec/mpeg12.c libavcodec/mpeg12.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
f0a7b67a35
|
@ -824,13 +824,13 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
|
|||
coeff2r = ea_adpcm_table[(*src & 0x0F) + 4];
|
||||
src++;
|
||||
|
||||
shift_left = (*src >> 4 ) + 8;
|
||||
shift_right = (*src & 0x0F) + 8;
|
||||
shift_left = 20 - (*src >> 4);
|
||||
shift_right = 20 - (*src & 0x0F);
|
||||
src++;
|
||||
|
||||
for (count2 = 0; count2 < 28; count2++) {
|
||||
next_left_sample = (int32_t)((*src & 0xF0) << 24) >> shift_left;
|
||||
next_right_sample = (int32_t)((*src & 0x0F) << 28) >> shift_right;
|
||||
next_left_sample = sign_extend(*src >> 4, 4) << shift_left;
|
||||
next_right_sample = sign_extend(*src, 4) << shift_right;
|
||||
src++;
|
||||
|
||||
next_left_sample = (next_left_sample +
|
||||
|
@ -861,13 +861,13 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
|
|||
for(channel = 0; channel < avctx->channels; channel++) {
|
||||
for (i=0; i<2; i++)
|
||||
coeff[channel][i] = ea_adpcm_table[(*src >> 4) + 4*i];
|
||||
shift[channel] = (*src & 0x0F) + 8;
|
||||
shift[channel] = 20 - (*src & 0x0F);
|
||||
src++;
|
||||
}
|
||||
for (count1 = 0; count1 < nb_samples / 2; count1++) {
|
||||
for(i = 4; i >= 0; i-=4) { /* Pairwise samples LL RR (st) or LL LL (mono) */
|
||||
for(channel = 0; channel < avctx->channels; channel++) {
|
||||
int32_t sample = (int32_t)(((*(src+channel) >> i) & 0x0F) << 0x1C) >> shift[channel];
|
||||
int32_t sample = sign_extend(src[channel] >> i, 4) << shift[channel];
|
||||
sample = (sample +
|
||||
c->status[channel].sample1 * coeff[channel][0] +
|
||||
c->status[channel].sample2 * coeff[channel][1] + 0x80) >> 8;
|
||||
|
@ -932,14 +932,14 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
|
|||
} else {
|
||||
coeff1 = ea_adpcm_table[ *srcC>>4 ];
|
||||
coeff2 = ea_adpcm_table[(*srcC>>4) + 4];
|
||||
shift = (*srcC++ & 0x0F) + 8;
|
||||
shift = 20 - (*srcC++ & 0x0F);
|
||||
|
||||
if (srcC > src_end - 14) break;
|
||||
for (count2=0; count2<28; count2++) {
|
||||
if (count2 & 1)
|
||||
next_sample = (int32_t)((*srcC++ & 0x0F) << 28) >> shift;
|
||||
next_sample = sign_extend(*srcC++, 4) << shift;
|
||||
else
|
||||
next_sample = (int32_t)((*srcC & 0xF0) << 24) >> shift;
|
||||
next_sample = sign_extend(*srcC >> 4, 4) << shift;
|
||||
|
||||
next_sample += (current_sample * coeff1) +
|
||||
(previous_sample * coeff2);
|
||||
|
@ -976,7 +976,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
|
|||
for (n=0; n<4; n++, s+=32*avctx->channels) {
|
||||
for (i=0; i<2; i++)
|
||||
coeff[i][n] = ea_adpcm_table[(src[0]&0x0F)+4*i];
|
||||
shift[n] = (src[2]&0x0F) + 8;
|
||||
shift[n] = 20 - (src[2] & 0x0F);
|
||||
for (s2=s, i=0; i<2; i++, src+=2, s2+=avctx->channels)
|
||||
s2[0] = (src[0]&0xF0) + (src[1]<<8);
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
|
|||
s = &samples[m*avctx->channels + channel];
|
||||
for (n=0; n<4; n++, src++, s+=32*avctx->channels) {
|
||||
for (s2=s, i=0; i<8; i+=4, s2+=avctx->channels) {
|
||||
int level = (int32_t)((*src & (0xF0>>i)) << (24+i)) >> shift[n];
|
||||
int level = sign_extend(*src >> (4 - i), 4) << shift[n];
|
||||
int pred = s2[-1*avctx->channels] * coeff[0][n]
|
||||
+ s2[-2*avctx->channels] * coeff[1][n];
|
||||
s2[0] = av_clip_int16((level + pred + 0x80) >> 8);
|
||||
|
@ -1149,18 +1149,18 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
|
|||
/* Read in every sample for this channel. */
|
||||
for (i = 0; i < nb_samples / 14; i++) {
|
||||
int index = (*src >> 4) & 7;
|
||||
unsigned int exp = 28 - (*src++ & 15);
|
||||
unsigned int exp = *src++ & 15;
|
||||
int factor1 = table[ch][index * 2];
|
||||
int factor2 = table[ch][index * 2 + 1];
|
||||
|
||||
/* Decode 14 samples. */
|
||||
for (n = 0; n < 14; n++) {
|
||||
int32_t sampledat;
|
||||
if(n&1) sampledat= *src++ <<28;
|
||||
else sampledat= (*src&0xF0)<<24;
|
||||
if(n&1) sampledat = sign_extend(*src++, 4);
|
||||
else sampledat = sign_extend(*src >> 4, 4);
|
||||
|
||||
sampledat = ((prev[ch][0]*factor1
|
||||
+ prev[ch][1]*factor2) >> 11) + (sampledat>>exp);
|
||||
+ prev[ch][1]*factor2) >> 11) + (sampledat << exp);
|
||||
*samples = av_clip_int16(sampledat);
|
||||
prev[ch][1] = prev[ch][0];
|
||||
prev[ch][0] = *samples++;
|
||||
|
|
|
@ -735,9 +735,8 @@ static void exchange_uv(MpegEncContext *s)
|
|||
#define MT_16X8 2
|
||||
#define MT_DMV 3
|
||||
|
||||
static int mpeg_decode_mb(Mpeg1Context *s1, DCTELEM block[12][64])
|
||||
static int mpeg_decode_mb(MpegEncContext *s, DCTELEM block[12][64])
|
||||
{
|
||||
MpegEncContext *s = &s1->mpeg_enc_ctx;
|
||||
int i, j, k, cbp, val, mb_type, motion_type;
|
||||
const int mb_block_count = 4 + (1 << s->chroma_format);
|
||||
|
||||
|
@ -1658,10 +1657,9 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
|
|||
* @return DECODE_SLICE_ERROR if the slice is damaged<br>
|
||||
* DECODE_SLICE_OK if this slice is ok<br>
|
||||
*/
|
||||
static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
|
||||
static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
|
||||
const uint8_t **buf, int buf_size)
|
||||
{
|
||||
MpegEncContext *s = &s1->mpeg_enc_ctx;
|
||||
AVCodecContext *avctx = s->avctx;
|
||||
const int lowres = s->avctx->lowres;
|
||||
const int field_pic = s->picture_structure != PICT_FRAME;
|
||||
|
@ -1750,7 +1748,7 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
|
|||
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1)
|
||||
ff_xvmc_init_block(s); // set s->block
|
||||
|
||||
if (mpeg_decode_mb(s1, s->block) < 0)
|
||||
if (mpeg_decode_mb(s, s->block) < 0)
|
||||
return -1;
|
||||
|
||||
if (s->current_picture.f.motion_val[0] && !s->encoding) { // note motion_val is normally NULL unless we want to extract the MVs
|
||||
|
@ -1893,7 +1891,7 @@ static int slice_decode_thread(AVCodecContext *c, void *arg)
|
|||
uint32_t start_code;
|
||||
int ret;
|
||||
|
||||
ret = mpeg_decode_slice((Mpeg1Context*)s, mb_y, &buf, s->gb.buffer_end - buf);
|
||||
ret = mpeg_decode_slice(s, mb_y, &buf, s->gb.buffer_end - buf);
|
||||
emms_c();
|
||||
//av_log(c, AV_LOG_DEBUG, "ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n",
|
||||
//ret, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, s->start_mb_y, s->end_mb_y, s->error_count);
|
||||
|
@ -2308,7 +2306,7 @@ static int decode_chunks(AVCodecContext *avctx,
|
|||
}
|
||||
|
||||
if (CONFIG_VDPAU && uses_vdpau(avctx))
|
||||
ff_vdpau_mpeg_picture_complete(s, buf, buf_size, s->slice_count);
|
||||
ff_vdpau_mpeg_picture_complete(s2, buf, buf_size, s->slice_count);
|
||||
|
||||
|
||||
if (slice_end(avctx, picture)) {
|
||||
|
@ -2500,7 +2498,7 @@ static int decode_chunks(AVCodecContext *avctx,
|
|||
}
|
||||
buf_ptr += 2; // FIXME add minimum number of bytes per slice
|
||||
} else {
|
||||
ret = mpeg_decode_slice(s, mb_y, &buf_ptr, input_size);
|
||||
ret = mpeg_decode_slice(s2, mb_y, &buf_ptr, input_size);
|
||||
emms_c();
|
||||
|
||||
if (ret < 0) {
|
||||
|
|
|
@ -190,10 +190,9 @@ void ff_vdpau_h264_picture_complete(MpegEncContext *s)
|
|||
render->bitstream_buffers_used = 0;
|
||||
}
|
||||
|
||||
void ff_vdpau_mpeg_picture_complete(Mpeg1Context *s1, const uint8_t *buf,
|
||||
void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf,
|
||||
int buf_size, int slice_count)
|
||||
{
|
||||
MpegEncContext *s = &s1->mpeg_enc_ctx;
|
||||
struct vdpau_render_state *render, *last, *next;
|
||||
int i;
|
||||
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include "mpegvideo.h"
|
||||
#include "mpeg12.h"
|
||||
|
||||
void ff_vdpau_add_data_chunk(MpegEncContext *s, const uint8_t *buf,
|
||||
int buf_size);
|
||||
|
||||
void ff_vdpau_mpeg_picture_complete(Mpeg1Context *s1, const uint8_t *buf,
|
||||
void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf,
|
||||
int buf_size, int slice_count);
|
||||
|
||||
void ff_vdpau_h264_picture_start(MpegEncContext *s);
|
||||
|
|
Loading…
Reference in New Issue