Compare commits

..

No commits in common. "43abd1ced9424d7f9ff340d1fe01b3a43411b849" and "fc3893f5e725d3dd11f08cfccf636b9826cfacb4" have entirely different histories.

18 changed files with 105 additions and 80 deletions

View File

@ -566,14 +566,14 @@ OBJS-$(CONFIG_MPC7_DECODER) += mpc7.o mpc.o
OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o
OBJS-$(CONFIG_MPEGVIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o
OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpeg12.o
OBJS-$(CONFIG_MPEG1_CUVID_DECODER) += cuviddec.o
OBJS-$(CONFIG_MPEG1_V4L2M2M_DECODER) += v4l2_m2m_dec.o
OBJS-$(CONFIG_MPEG2_MMAL_DECODER) += mmaldec.o
OBJS-$(CONFIG_MPEG2_QSV_DECODER) += qsvdec.o
OBJS-$(CONFIG_MPEG2_QSV_ENCODER) += qsvenc_mpeg2.o
OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o
OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o
OBJS-$(CONFIG_MPEG2_CUVID_DECODER) += cuviddec.o
OBJS-$(CONFIG_MPEG2_MEDIACODEC_DECODER) += mediacodecdec.o
OBJS-$(CONFIG_MPEG2_VAAPI_ENCODER) += vaapi_encode_mpeg2.o
@ -1275,7 +1275,8 @@ OBJS-$(CONFIG_MPEG4VIDEO_PARSER) += mpeg4video_parser.o h263.o \
mpeg4videodec.o mpeg4video.o \
ituh263dec.o h263data.o
OBJS-$(CONFIG_MPEGAUDIO_PARSER) += mpegaudio_parser.o
OBJS-$(CONFIG_MPEGVIDEO_PARSER) += mpegvideo_parser.o mpeg12data.o
OBJS-$(CONFIG_MPEGVIDEO_PARSER) += mpegvideo_parser.o \
mpeg12.o mpeg12data.o
OBJS-$(CONFIG_OPUS_PARSER) += vorbis_data.o
OBJS-$(CONFIG_PNG_PARSER) += png_parser.o
OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o

View File

@ -575,8 +575,8 @@ void dnxhd_encode_block(PutBitContext *pb, DNXHDEncContext *ctx,
int last_non_zero = 0;
int slevel, i, j;
dnxhd_encode_dc(pb, ctx, block[0] - ctx->m.last_dc[n]);
ctx->m.last_dc[n] = block[0];
dnxhd_encode_dc(pb, ctx, block[0] - ctx->m.c.last_dc[n]);
ctx->m.c.last_dc[n] = block[0];
for (i = 1; i <= last_index; i++) {
j = ctx->m.c.intra_scantable.permutated[i];
@ -822,9 +822,9 @@ static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg,
LOCAL_ALIGNED_16(int16_t, block, [64]);
ctx = ctx->thread[threadnr];
ctx->m.last_dc[0] =
ctx->m.last_dc[1] =
ctx->m.last_dc[2] = 1 << (ctx->bit_depth + 2);
ctx->m.c.last_dc[0] =
ctx->m.c.last_dc[1] =
ctx->m.c.last_dc[2] = 1 << (ctx->bit_depth + 2);
for (int mb_x = 0; mb_x < ctx->m.c.mb_width; mb_x++) {
unsigned mb = mb_y * ctx->m.c.mb_width + mb_x;
@ -846,7 +846,7 @@ static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg,
qscale, &overflow);
ac_bits += dnxhd_calc_ac_bits(ctx, block, last_index);
diff = block[0] - ctx->m.last_dc[n];
diff = block[0] - ctx->m.c.last_dc[n];
if (diff < 0)
nbits = av_log2_16bit(-2 * diff);
else
@ -855,7 +855,7 @@ static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg,
av_assert1(nbits < ctx->bit_depth + 4);
dc_bits += ctx->cid_table->dc_bits[nbits] + nbits;
ctx->m.last_dc[n] = block[0];
ctx->m.c.last_dc[n] = block[0];
if (avctx->mb_decision == FF_MB_DECISION_RD || !RC_VARIANCE) {
dnxhd_unquantize_c(ctx, block, i, qscale, last_index);
@ -880,9 +880,9 @@ static int dnxhd_encode_thread(AVCodecContext *avctx, void *arg,
init_put_bits(pb, (uint8_t *)arg + ctx->data_offset + ctx->slice_offs[jobnr],
ctx->slice_size[jobnr]);
ctx->m.last_dc[0] =
ctx->m.last_dc[1] =
ctx->m.last_dc[2] = 1 << (ctx->bit_depth + 2);
ctx->m.c.last_dc[0] =
ctx->m.c.last_dc[1] =
ctx->m.c.last_dc[2] = 1 << (ctx->bit_depth + 2);
for (int mb_x = 0; mb_x < ctx->m.c.mb_width; mb_x++) {
unsigned mb = mb_y * ctx->m.c.mb_width + mb_x;
int qscale = ctx->mb_qscale[mb];

View File

@ -247,9 +247,9 @@ static int decode_slice(H263DecContext *const h)
}
if (h->c.msmpeg4_version == MSMP4_V1) {
h->last_dc[0] =
h->last_dc[1] =
h->last_dc[2] = 128;
h->c.last_dc[0] =
h->c.last_dc[1] =
h->c.last_dc[2] = 128;
}
ff_init_block_index(&h->c);

View File

@ -79,9 +79,6 @@ typedef struct H263DecContext {
/* MSMPEG4 specific */
int slice_height; ///< in macroblocks
/* MPEG-4 (Studio Profile), MSMPEG4 and RV10 specific */
int last_dc[3]; ///< last DC values, used by MPEG4, MSMPEG4V1, RV10
/* RV10 specific */
int rv10_version; ///< RV10 version: 0 or 3
int rv10_first_dc_coded[3];

View File

@ -551,14 +551,14 @@ static int h263_decode_block(H263DecContext *const h, int16_t block[64],
if (CONFIG_RV10_DECODER && h->c.codec_id == AV_CODEC_ID_RV10) {
if (h->rv10_version == 3 && h->c.pict_type == AV_PICTURE_TYPE_I) {
int component = (n <= 3 ? 0 : n - 4 + 1);
level = h->last_dc[component];
level = h->c.last_dc[component];
if (h->rv10_first_dc_coded[component]) {
int diff = ff_rv_decode_dc(h, n);
if (diff < 0)
return -1;
level += diff;
level = level & 0xff; /* handle wrap round */
h->last_dc[component] = level;
h->c.last_dc[component] = level;
} else {
h->rv10_first_dc_coded[component] = 1;
}

View File

@ -279,7 +279,7 @@ int ff_mjpeg_encode_stuffing(MPVEncContext *const s)
fail:
for (int i = 0; i < 3; i++)
s->last_dc[i] = 128 << s->c.intra_dc_precision;
s->c.last_dc[i] = 128 << s->c.intra_dc_precision;
return ret;
}
@ -371,11 +371,11 @@ static void record_block(MPVEncContext *const s, int16_t block[], int n)
component = (n <= 3 ? 0 : (n&1) + 1);
table_id = (n <= 3 ? 0 : 1);
dc = block[0]; /* overflow is impossible */
val = dc - s->last_dc[component];
val = dc - s->c.last_dc[component];
mjpeg_encode_coef(m, table_id, val, 0);
s->last_dc[component] = dc;
s->c.last_dc[component] = dc;
/* AC coefs */
@ -415,7 +415,7 @@ static void encode_block(MPVEncContext *const s, int16_t block[], int n)
/* DC coef */
component = (n <= 3 ? 0 : (n&1) + 1);
dc = block[0]; /* overflow is impossible */
val = dc - s->last_dc[component];
val = dc - s->c.last_dc[component];
if (n < 4) {
ff_mjpeg_encode_dc(&s->pb, val, m->huff_size_dc_luminance, m->huff_code_dc_luminance);
huff_size_ac = m->huff_size_ac_luminance;
@ -425,7 +425,7 @@ static void encode_block(MPVEncContext *const s, int16_t block[], int n)
huff_size_ac = m->huff_size_ac_chrominance;
huff_code_ac = m->huff_code_ac_chrominance;
}
s->last_dc[component] = dc;
s->c.last_dc[component] = dc;
/* AC coefs */

View File

@ -30,6 +30,8 @@
#include "libavutil/attributes.h"
#include "libavutil/thread.h"
#include "mpegvideo.h"
#include "mpeg12codecs.h"
#include "mpeg12data.h"
#include "mpeg12dec.h"
#include "mpegutils.h"
@ -120,6 +122,14 @@ av_cold void ff_init_2d_vlc_rl(const uint16_t table_vlc[][2], RL_VLC_ELEM rl_vlc
}
}
void ff_mpeg1_clean_buffers(MpegEncContext *s)
{
s->last_dc[0] = 1 << (7 + s->intra_dc_precision);
s->last_dc[1] = s->last_dc[0];
s->last_dc[2] = s->last_dc[0];
memset(s->last_mv, 0, sizeof(s->last_mv));
}
/******************************************/
/* decoding */

29
libavcodec/mpeg12codecs.h Normal file
View File

@ -0,0 +1,29 @@
/*
* MPEG-1/2 codecs common code
* Copyright (c) 2007 Aurelien Jacobs <aurel@gnuage.org>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_MPEG12CODECS_H
#define AVCODEC_MPEG12CODECS_H
#include "mpegvideo.h"
void ff_mpeg1_clean_buffers(MpegEncContext *s);
#endif /* AVCODEC_MPEG12CODECS_H */

View File

@ -50,6 +50,7 @@
#include "idctdsp.h"
#include "mpeg_er.h"
#include "mpeg12.h"
#include "mpeg12codecs.h"
#include "mpeg12data.h"
#include "mpeg12dec.h"
#include "mpegutils.h"
@ -73,8 +74,6 @@ typedef struct Mpeg12SliceContext {
MPVContext c;
GetBitContext gb;
int last_dc[3]; ///< last DC values
DECLARE_ALIGNED_32(int16_t, block)[12][64];
} Mpeg12SliceContext;
@ -328,9 +327,9 @@ static inline int mpeg2_decode_block_intra(Mpeg12SliceContext *const s,
component = (n & 1) + 1;
}
diff = decode_dc(&s->gb, component);
dc = s->last_dc[component];
dc = s->c.last_dc[component];
dc += diff;
s->last_dc[component] = dc;
s->c.last_dc[component] = dc;
block[0] = dc * (1 << (3 - s->c.intra_dc_precision));
ff_tlog(s->c.avctx, "dc=%d\n", block[0]);
mismatch = block[0] ^ 1;
@ -519,7 +518,7 @@ static int mpeg_decode_mb(Mpeg12SliceContext *const s, int *mb_skip_run)
ret = ff_mpeg1_decode_block_intra(&s->gb,
s->c.intra_matrix,
s->c.intra_scantable.permutated,
s->last_dc, s->block[i],
s->c.last_dc, s->block[i],
i, s->c.qscale);
if (ret < 0) {
av_log(s->c.avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n",
@ -715,7 +714,7 @@ static int mpeg_decode_mb(Mpeg12SliceContext *const s, int *mb_skip_run)
}
s->c.mb_intra = 0;
s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 128 << s->c.intra_dc_precision;
s->c.last_dc[0] = s->c.last_dc[1] = s->c.last_dc[2] = 128 << s->c.intra_dc_precision;
if (HAS_CBP(mb_type)) {
s->c.bdsp.clear_blocks(s->block[0]);
@ -1376,6 +1375,7 @@ static int mpeg_decode_slice(Mpeg12SliceContext *const s, int mb_y,
if (s->c.codec_id != AV_CODEC_ID_MPEG1VIDEO && s->c.mb_height > 2800/16)
skip_bits(&s->gb, 3);
ff_mpeg1_clean_buffers(&s->c);
s->c.interlaced_dct = 0;
s->c.qscale = mpeg_get_qscale(&s->gb, s->c.q_scale_type);
@ -1455,11 +1455,6 @@ static int mpeg_decode_slice(Mpeg12SliceContext *const s, int mb_y,
}
}
s->last_dc[0] = 128 << s->c.intra_dc_precision;
s->last_dc[1] = s->last_dc[0];
s->last_dc[2] = s->last_dc[0];
memset(s->c.last_mv, 0, sizeof(s->c.last_mv));
for (int mb_skip_run = 0;;) {
ret = mpeg_decode_mb(s, &mb_skip_run);
if (ret < 0)
@ -1602,7 +1597,7 @@ static int mpeg_decode_slice(Mpeg12SliceContext *const s, int mb_y,
s->c.mb_intra = 0;
for (i = 0; i < 12; i++)
s->c.block_last_index[i] = -1;
s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 128 << s->c.intra_dc_precision;
s->c.last_dc[0] = s->c.last_dc[1] = s->c.last_dc[2] = 128 << s->c.intra_dc_precision;
if (s->c.picture_structure == PICT_FRAME)
s->c.mv_type = MV_TYPE_16X16;
else
@ -2795,7 +2790,7 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame,
s->flags & 0x10 ? ff_alternate_vertical_scan : ff_zigzag_direct,
m->idsp.idct_permutation);
s->m.last_dc[0] = s->m.last_dc[1] = s->m.last_dc[2] = 128 << (s->flags & 3);
m->last_dc[0] = m->last_dc[1] = m->last_dc[2] = 1 << (7 + (s->flags & 3));
m->qscale = 1;
for (int y = 0; y < avctx->height; y += 16) {
@ -2827,7 +2822,7 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame,
ret = ff_mpeg1_decode_block_intra(gb,
m->intra_matrix,
m->intra_scantable.permutated,
s->m.last_dc, block[n],
m->last_dc, block[n],
n, m->qscale);
} else {
ret = mpeg2_decode_block_intra(&s->m, block[n], n);

View File

@ -589,9 +589,9 @@ static void mpeg1_encode_block(MPVEncContext *const s, const int16_t block[], in
if (s->c.mb_intra) {
component = (n <= 3 ? 0 : (n & 1) + 1);
dc = block[0]; /* overflow is impossible */
diff = dc - s->last_dc[component];
diff = dc - s->c.last_dc[component];
encode_dc(s, diff, component);
s->last_dc[component] = dc;
s->c.last_dc[component] = dc;
i = 1;
if (s->c.intra_vlc_format)
table_vlc = ff_mpeg2_vlc_table;
@ -936,7 +936,7 @@ static void mpeg12_encode_mb(MPVEncContext *const s, int16_t block[][64],
int motion_x, int motion_y)
{
if (!s->c.mb_intra)
s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 128 << s->c.intra_dc_precision;
s->c.last_dc[0] = s->c.last_dc[1] = s->c.last_dc[2] = 128 << s->c.intra_dc_precision;
if (s->c.chroma_format == CHROMA_420)
mpeg1_encode_mb_internal(s, block, motion_x, motion_y, 6, 1);
else

View File

@ -36,12 +36,4 @@ static inline void ff_mpeg1_encode_init(MPVEncContext *s)
s->c.c_dc_scale_table = ff_mpeg12_dc_scale_table[s->c.intra_dc_precision];
}
static inline void ff_mpeg1_clean_buffers(MPVEncContext *s)
{
s->last_dc[0] = 128 << s->c.intra_dc_precision;
s->last_dc[1] = s->last_dc[0];
s->last_dc[2] = s->last_dc[0];
memset(s->c.last_mv, 0, sizeof(s->c.last_mv));
}
#endif /* AVCODEC_MPEG12ENC_H */

View File

@ -794,11 +794,11 @@ int ff_mpeg4_decode_video_packet_header(H263DecContext *const h)
static void reset_studio_dc_predictors(Mpeg4DecContext *const ctx)
{
H263DecContext *const h = &ctx->h;
MPVContext *const s = &ctx->h.c;
/* Reset DC Predictors */
h->last_dc[0] =
h->last_dc[1] =
h->last_dc[2] = 1 << (h->c.avctx->bits_per_raw_sample + ctx->dct_precision + h->c.intra_dc_precision - 1);
s->last_dc[0] =
s->last_dc[1] =
s->last_dc[2] = 1 << (s->avctx->bits_per_raw_sample + ctx->dct_precision + s->intra_dc_precision - 1);
}
/**
@ -2196,12 +2196,12 @@ static int mpeg4_decode_studio_block(Mpeg4DecContext *const ctx, int32_t block[6
}
h->last_dc[cc] += dct_diff;
h->c.last_dc[cc] += dct_diff;
if (ctx->mpeg_quant)
block[0] = h->last_dc[cc] * (8 >> h->c.intra_dc_precision);
block[0] = h->c.last_dc[cc] * (8 >> h->c.intra_dc_precision);
else
block[0] = h->last_dc[cc] * (8 >> h->c.intra_dc_precision) * (8 >> ctx->dct_precision);
block[0] = h->c.last_dc[cc] * (8 >> h->c.intra_dc_precision) * (8 >> ctx->dct_precision);
/* TODO: support mpeg_quant for AC coefficients */
block[0] = av_clip(block[0], min, max);
@ -2283,7 +2283,7 @@ static int mpeg4_decode_dpcm_macroblock(Mpeg4DecContext *const ctx,
av_log(h->c.avctx, AV_LOG_ERROR, "Forbidden block_mean\n");
return AVERROR_INVALIDDATA;
}
h->last_dc[n] = block_mean * (1 << (ctx->dct_precision + h->c.intra_dc_precision));
h->c.last_dc[n] = block_mean * (1 << (ctx->dct_precision + h->c.intra_dc_precision));
rice_parameter = get_bits(&h->gb, 4);
if (rice_parameter == 0) {

View File

@ -133,6 +133,7 @@ typedef struct MpegEncContext {
*/
MPVWorkPicture cur_pic;
int last_dc[3]; ///< last DC values for MPEG-1
int16_t *dc_val_base;
const uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table
const uint8_t *c_dc_scale_table; ///< qscale -> c_dc_scale table

View File

@ -47,6 +47,7 @@
#include "avcodec.h"
#include "encode.h"
#include "idctdsp.h"
#include "mpeg12codecs.h"
#include "mpeg12data.h"
#include "mpeg12enc.h"
#include "mpegvideo.h"
@ -2639,13 +2640,13 @@ typedef struct MBBackup {
int mv[2][4][2];
int last_mv[2][2][2];
int mv_type, mv_dir;
int last_dc[3];
int mb_intra, mb_skipped;
int qscale;
int block_last_index[8];
int interlaced_dct;
} c;
int mb_skip_run;
int last_dc[3];
int mv_bits, i_tex_bits, p_tex_bits, i_count, misc_bits, last_bits;
int dquant;
int esc3_level_length;
@ -2663,7 +2664,7 @@ static inline void BEFORE ##_context_before_encode(DST_TYPE *const d, \
/* MPEG-1 */ \
d->mb_skip_run = s->mb_skip_run; \
for (int i = 0; i < 3; i++) \
d->last_dc[i] = s->last_dc[i]; \
d->c.last_dc[i] = s->c.last_dc[i]; \
\
/* statistics */ \
d->mv_bits = s->mv_bits; \
@ -2691,7 +2692,7 @@ static inline void AFTER ## _context_after_encode(DST_TYPE *const d, \
/* MPEG-1 */ \
d->mb_skip_run = s->mb_skip_run; \
for (int i = 0; i < 3; i++) \
d->last_dc[i] = s->last_dc[i]; \
d->c.last_dc[i] = s->c.last_dc[i]; \
\
/* statistics */ \
d->mv_bits = s->mv_bits; \
@ -3009,14 +3010,14 @@ static int encode_thread(AVCodecContext *c, void *arg){
for(i=0; i<3; i++){
/* init last dc values */
/* note: quant matrix value (8) is implied here */
s->last_dc[i] = 128 << s->c.intra_dc_precision;
s->c.last_dc[i] = 128 << s->c.intra_dc_precision;
s->encoding_error[i] = 0;
}
if (s->c.codec_id == AV_CODEC_ID_AMV) {
s->last_dc[0] = 128 * 8 / 13;
s->last_dc[1] = 128 * 8 / 14;
s->last_dc[2] = 128 * 8 / 14;
s->c.last_dc[0] = 128 * 8 / 13;
s->c.last_dc[1] = 128 * 8 / 14;
s->c.last_dc[2] = 128 * 8 / 14;
#if CONFIG_MPEG4_ENCODER
} else if (s->partitioned_frame) {
av_assert1(s->c.codec_id == AV_CODEC_ID_MPEG4);
@ -3039,7 +3040,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
mb_y = ff_speedhq_mb_y_order_to_mb(mb_y_order, s->c.mb_height, &first_in_slice);
if (first_in_slice && mb_y_order != s->c.start_mb_y)
ff_speedhq_end_slice(s);
s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 1024 << s->c.intra_dc_precision;
s->c.last_dc[0] = s->c.last_dc[1] = s->c.last_dc[2] = 1024 << s->c.intra_dc_precision;
} else {
mb_y = mb_y_order;
}
@ -3143,7 +3144,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
case AV_CODEC_ID_MPEG2VIDEO:
if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) {
ff_mpeg1_encode_slice_header(s);
ff_mpeg1_clean_buffers(s);
ff_mpeg1_clean_buffers(&s->c);
}
break;
#if CONFIG_H263P_ENCODER

View File

@ -138,7 +138,6 @@ typedef struct MPVEncContext {
int last_bits; ///< temp var used for calculating the above vars
int mb_skip_run;
int last_dc[3]; ///< last DC values
/* H.263 specific */
int gob_index;

View File

@ -48,7 +48,7 @@
static const VLCElem *mv_tables[2];
static inline int msmpeg4v1_pred_dc(H263DecContext *const h, int n,
static inline int msmpeg4v1_pred_dc(MpegEncContext * s, int n,
int32_t **dc_val_ptr)
{
int i;
@ -59,8 +59,8 @@ static inline int msmpeg4v1_pred_dc(H263DecContext *const h, int n,
i= n-3;
}
*dc_val_ptr= &h->last_dc[i];
return h->last_dc[i];
*dc_val_ptr= &s->last_dc[i];
return s->last_dc[i];
}
/****************************************/
@ -588,7 +588,7 @@ static int msmpeg4_decode_dc(MSMP4DecContext *const ms, int n, int *dir_ptr)
if (h->c.msmpeg4_version == MSMP4_V1) {
int32_t *dc_val;
pred = msmpeg4v1_pred_dc(h, n, &dc_val);
pred = msmpeg4v1_pred_dc(&h->c, n, &dc_val);
level += pred;
/* update predictor */

View File

@ -129,11 +129,11 @@ static int rv10_decode_picture_header(H263DecContext *const h)
if (h->c.pict_type == AV_PICTURE_TYPE_I) {
if (h->rv10_version == 3) {
/* specific MPEG like DC coding not used */
h->last_dc[0] = get_bits(&h->gb, 8);
h->last_dc[1] = get_bits(&h->gb, 8);
h->last_dc[2] = get_bits(&h->gb, 8);
ff_dlog(h->c.avctx, "DC:%d %d %d\n", h->last_dc[0],
h->last_dc[1], h->last_dc[2]);
h->c.last_dc[0] = get_bits(&h->gb, 8);
h->c.last_dc[1] = get_bits(&h->gb, 8);
h->c.last_dc[2] = get_bits(&h->gb, 8);
ff_dlog(h->c.avctx, "DC:%d %d %d\n", h->c.last_dc[0],
h->c.last_dc[1], h->c.last_dc[2]);
}
}
/* if multiple packets per frame are sent, the position at which

View File

@ -172,9 +172,9 @@ static void encode_block(MPVEncContext *const s, const int16_t block[], int n)
/* DC coef */
component = (n <= 3 ? 0 : (n&1) + 1);
dc = block[0]; /* overflow is impossible */
val = s->last_dc[component] - dc; /* opposite of most codecs */
val = s->c.last_dc[component] - dc; /* opposite of most codecs */
encode_dc(&s->pb, val, component);
s->last_dc[component] = dc;
s->c.last_dc[component] = dc;
/* now quantify & encode AC coefs */
last_non_zero = 0;