You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
Merge commit '1aa24df74c052a73175c43e57d35b4835e537ec8'
* commit '1aa24df74c052a73175c43e57d35b4835e537ec8': lavu: Deprecate AVFrame.error[] Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
This commit is contained in:
@@ -387,6 +387,9 @@ int ff_mpeg_ref_picture(AVCodecContext *avctx, Picture *dst, Picture *src)
|
|||||||
dst->reference = src->reference;
|
dst->reference = src->reference;
|
||||||
dst->shared = src->shared;
|
dst->shared = src->shared;
|
||||||
|
|
||||||
|
memcpy(dst->encoding_error, src->encoding_error,
|
||||||
|
sizeof(dst->encoding_error));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
fail:
|
fail:
|
||||||
ff_mpeg_unref_picture(avctx, dst);
|
ff_mpeg_unref_picture(avctx, dst);
|
||||||
|
@@ -87,7 +87,7 @@ typedef struct Picture {
|
|||||||
int reference;
|
int reference;
|
||||||
int shared;
|
int shared;
|
||||||
|
|
||||||
uint64_t error[AV_NUM_DATA_POINTERS];
|
uint64_t encoding_error[AV_NUM_DATA_POINTERS];
|
||||||
} Picture;
|
} Picture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1651,6 +1651,12 @@ FF_DISABLE_DEPRECATION_WARNINGS
|
|||||||
av_frame_copy_props(s->avctx->coded_frame, s->current_picture.f);
|
av_frame_copy_props(s->avctx->coded_frame, s->current_picture.f);
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
#if FF_API_ERROR_FRAME
|
||||||
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
|
memcpy(s->current_picture.f->error, s->current_picture.encoding_error,
|
||||||
|
sizeof(s->current_picture.encoding_error));
|
||||||
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_noise_reduction(MpegEncContext *s)
|
static void update_noise_reduction(MpegEncContext *s)
|
||||||
@@ -1865,13 +1871,11 @@ vbv_retry:
|
|||||||
ff_write_pass1_stats(s);
|
ff_write_pass1_stats(s);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
s->current_picture_ptr->f->error[i] =
|
s->current_picture_ptr->encoding_error[i] = s->current_picture.encoding_error[i];
|
||||||
s->current_picture.f->error[i] =
|
avctx->error[i] += s->current_picture_ptr->encoding_error[i];
|
||||||
s->current_picture.error[i];
|
|
||||||
avctx->error[i] += s->current_picture_ptr->f->error[i];
|
|
||||||
}
|
}
|
||||||
ff_side_data_set_encoder_stats(pkt, s->current_picture.f->quality,
|
ff_side_data_set_encoder_stats(pkt, s->current_picture.f->quality,
|
||||||
s->current_picture_ptr->f->error,
|
s->current_picture_ptr->encoding_error,
|
||||||
(s->avctx->flags&AV_CODEC_FLAG_PSNR) ? 4 : 0,
|
(s->avctx->flags&AV_CODEC_FLAG_PSNR) ? 4 : 0,
|
||||||
s->pict_type);
|
s->pict_type);
|
||||||
|
|
||||||
@@ -2838,7 +2842,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
|
|||||||
/* note: quant matrix value (8) is implied here */
|
/* note: quant matrix value (8) is implied here */
|
||||||
s->last_dc[i] = 128 << s->intra_dc_precision;
|
s->last_dc[i] = 128 << s->intra_dc_precision;
|
||||||
|
|
||||||
s->current_picture.error[i] = 0;
|
s->current_picture.encoding_error[i] = 0;
|
||||||
}
|
}
|
||||||
if(s->codec_id==AV_CODEC_ID_AMV){
|
if(s->codec_id==AV_CODEC_ID_AMV){
|
||||||
s->last_dc[0] = 128*8/13;
|
s->last_dc[0] = 128*8/13;
|
||||||
@@ -3408,13 +3412,13 @@ static int encode_thread(AVCodecContext *c, void *arg){
|
|||||||
if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16;
|
if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16;
|
||||||
if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16;
|
if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16;
|
||||||
|
|
||||||
s->current_picture.error[0] += sse(
|
s->current_picture.encoding_error[0] += sse(
|
||||||
s, s->new_picture.f->data[0] + s->mb_x*16 + s->mb_y*s->linesize*16,
|
s, s->new_picture.f->data[0] + s->mb_x*16 + s->mb_y*s->linesize*16,
|
||||||
s->dest[0], w, h, s->linesize);
|
s->dest[0], w, h, s->linesize);
|
||||||
s->current_picture.error[1] += sse(
|
s->current_picture.encoding_error[1] += sse(
|
||||||
s, s->new_picture.f->data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h,
|
s, s->new_picture.f->data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h,
|
||||||
s->dest[1], w>>1, h>>s->chroma_y_shift, s->uvlinesize);
|
s->dest[1], w>>1, h>>s->chroma_y_shift, s->uvlinesize);
|
||||||
s->current_picture.error[2] += sse(
|
s->current_picture.encoding_error[2] += sse(
|
||||||
s, s->new_picture.f->data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h,
|
s, s->new_picture.f->data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h,
|
||||||
s->dest[2], w>>1, h>>s->chroma_y_shift, s->uvlinesize);
|
s->dest[2], w>>1, h>>s->chroma_y_shift, s->uvlinesize);
|
||||||
}
|
}
|
||||||
@@ -3467,9 +3471,9 @@ static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src)
|
|||||||
MERGE(misc_bits);
|
MERGE(misc_bits);
|
||||||
MERGE(er.error_count);
|
MERGE(er.error_count);
|
||||||
MERGE(padding_bug_score);
|
MERGE(padding_bug_score);
|
||||||
MERGE(current_picture.error[0]);
|
MERGE(current_picture.encoding_error[0]);
|
||||||
MERGE(current_picture.error[1]);
|
MERGE(current_picture.encoding_error[1]);
|
||||||
MERGE(current_picture.error[2]);
|
MERGE(current_picture.encoding_error[2]);
|
||||||
|
|
||||||
if(dst->avctx->noise_reduction){
|
if(dst->avctx->noise_reduction){
|
||||||
for(i=0; i<64; i++){
|
for(i=0; i<64; i++){
|
||||||
|
@@ -185,6 +185,7 @@ typedef struct SnowContext{
|
|||||||
|
|
||||||
AVMotionVector *avmv;
|
AVMotionVector *avmv;
|
||||||
int avmv_index;
|
int avmv_index;
|
||||||
|
uint64_t encoding_error[AV_NUM_DATA_POINTERS];
|
||||||
}SnowContext;
|
}SnowContext;
|
||||||
|
|
||||||
/* Tables */
|
/* Tables */
|
||||||
|
@@ -1837,7 +1837,7 @@ redo_frame:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->avctx->error[plane_index] += error;
|
s->avctx->error[plane_index] += error;
|
||||||
s->current_picture->error[plane_index] = error;
|
s->encoding_error[plane_index] = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1869,10 +1869,16 @@ redo_frame:
|
|||||||
emms_c();
|
emms_c();
|
||||||
|
|
||||||
ff_side_data_set_encoder_stats(pkt, s->current_picture->quality,
|
ff_side_data_set_encoder_stats(pkt, s->current_picture->quality,
|
||||||
s->current_picture->error,
|
s->encoding_error,
|
||||||
(s->avctx->flags&AV_CODEC_FLAG_PSNR) ? 4 : 0,
|
(s->avctx->flags&AV_CODEC_FLAG_PSNR) ? 4 : 0,
|
||||||
s->current_picture->pict_type);
|
s->current_picture->pict_type);
|
||||||
|
|
||||||
|
#if FF_API_ERROR_FRAME
|
||||||
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
|
memcpy(s->current_picture->error, s->encoding_error, sizeof(s->encoding_error));
|
||||||
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
|
#endif
|
||||||
|
|
||||||
pkt->size = ff_rac_terminate(c);
|
pkt->size = ff_rac_terminate(c);
|
||||||
if (s->current_picture->key_frame)
|
if (s->current_picture->key_frame)
|
||||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
pkt->flags |= AV_PKT_FLAG_KEY;
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
|
#include "libavutil/version.h"
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
#include "formats.h"
|
#include "formats.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
@@ -33,8 +34,13 @@ static void do_swap(AVFrame *frame)
|
|||||||
{
|
{
|
||||||
FFSWAP(uint8_t*, frame->data[1], frame->data[2]);
|
FFSWAP(uint8_t*, frame->data[1], frame->data[2]);
|
||||||
FFSWAP(int, frame->linesize[1], frame->linesize[2]);
|
FFSWAP(int, frame->linesize[1], frame->linesize[2]);
|
||||||
FFSWAP(uint64_t, frame->error[1], frame->error[2]);
|
|
||||||
FFSWAP(AVBufferRef*, frame->buf[1], frame->buf[2]);
|
FFSWAP(AVBufferRef*, frame->buf[1], frame->buf[2]);
|
||||||
|
|
||||||
|
#if FF_API_ERROR_FRAME
|
||||||
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
|
FFSWAP(uint64_t, frame->error[1], frame->error[2]);
|
||||||
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static AVFrame *get_video_buffer(AVFilterLink *link, int w, int h)
|
static AVFrame *get_video_buffer(AVFilterLink *link, int w, int h)
|
||||||
|
@@ -315,7 +315,11 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
|
|||||||
|
|
||||||
av_dict_copy(&dst->metadata, src->metadata, 0);
|
av_dict_copy(&dst->metadata, src->metadata, 0);
|
||||||
|
|
||||||
|
#if FF_API_ERROR_FRAME
|
||||||
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
memcpy(dst->error, src->error, sizeof(dst->error));
|
memcpy(dst->error, src->error, sizeof(dst->error));
|
||||||
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < src->nb_side_data; i++) {
|
for (i = 0; i < src->nb_side_data; i++) {
|
||||||
const AVFrameSideData *sd_src = src->side_data[i];
|
const AVFrameSideData *sd_src = src->side_data[i];
|
||||||
|
@@ -282,10 +282,13 @@ typedef struct AVFrame {
|
|||||||
*/
|
*/
|
||||||
void *opaque;
|
void *opaque;
|
||||||
|
|
||||||
|
#if FF_API_ERROR_FRAME
|
||||||
/**
|
/**
|
||||||
* error
|
* @deprecated unused
|
||||||
*/
|
*/
|
||||||
|
attribute_deprecated
|
||||||
uint64_t error[AV_NUM_DATA_POINTERS];
|
uint64_t error[AV_NUM_DATA_POINTERS];
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When decoding, this signals how much the picture must be delayed.
|
* When decoding, this signals how much the picture must be delayed.
|
||||||
|
@@ -108,6 +108,9 @@
|
|||||||
#ifndef FF_API_PLUS1_MINUS1
|
#ifndef FF_API_PLUS1_MINUS1
|
||||||
#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 56)
|
#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FF_API_ERROR_FRAME
|
||||||
|
#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user