[FFmpeg-cvslog] avcodec/snow: Remove unused halfpel_plane
Andreas Rheinhardt
git at videolan.org
Sun Jul 31 02:56:03 EEST 2022
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Jul 26 06:21:26 2022 +0200| [7e41f95dce6390f39a5134a25213828ed65fac6b] | committer: Andreas Rheinhardt
avcodec/snow: Remove unused halfpel_plane
Committed in 5be3a818719d613e2f225cf1532fda01ba106b04 in
an unfinished state; never used or finished and always disabled.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e41f95dce6390f39a5134a25213828ed65fac6b
---
libavcodec/snow.c | 67 +------------------------------------------------------
libavcodec/snow.h | 1 -
2 files changed, 1 insertion(+), 67 deletions(-)
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 293a0eb7d9..5e0033063d 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -359,7 +359,7 @@ void ff_snow_pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, ptrdiff_t st
}
}
}else{
- uint8_t *src= s->last_picture[block->ref]->data[plane_index];
+ const uint8_t *src = s->last_picture[block->ref]->data[plane_index];
const int scale= plane_index ? (2*s->mv_scale)>>s->chroma_h_shift : 2*s->mv_scale;
int mx= block->mx*scale;
int my= block->my*scale;
@@ -587,72 +587,12 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) {
return 0;
}
-#define USE_HALFPEL_PLANE 0
-
-static int halfpel_interpol(SnowContext *s, uint8_t *halfpel[4][4], AVFrame *frame){
- int p,x,y;
-
- for(p=0; p < s->nb_planes; p++){
- int is_chroma= !!p;
- int w= is_chroma ? AV_CEIL_RSHIFT(s->avctx->width, s->chroma_h_shift) : s->avctx->width;
- int h= is_chroma ? AV_CEIL_RSHIFT(s->avctx->height, s->chroma_v_shift) : s->avctx->height;
- int ls= frame->linesize[p];
- uint8_t *src= frame->data[p];
-
- halfpel[1][p] = av_malloc_array(ls, (h + 2 * EDGE_WIDTH));
- halfpel[2][p] = av_malloc_array(ls, (h + 2 * EDGE_WIDTH));
- halfpel[3][p] = av_malloc_array(ls, (h + 2 * EDGE_WIDTH));
- if (!halfpel[1][p] || !halfpel[2][p] || !halfpel[3][p]) {
- av_freep(&halfpel[1][p]);
- av_freep(&halfpel[2][p]);
- av_freep(&halfpel[3][p]);
- return AVERROR(ENOMEM);
- }
- halfpel[1][p] += EDGE_WIDTH * (1 + ls);
- halfpel[2][p] += EDGE_WIDTH * (1 + ls);
- halfpel[3][p] += EDGE_WIDTH * (1 + ls);
-
- halfpel[0][p]= src;
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- int i= y*ls + x;
-
- halfpel[1][p][i]= (20*(src[i] + src[i+1]) - 5*(src[i-1] + src[i+2]) + (src[i-2] + src[i+3]) + 16 )>>5;
- }
- }
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- int i= y*ls + x;
-
- halfpel[2][p][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5;
- }
- }
- src= halfpel[1][p];
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- int i= y*ls + x;
-
- halfpel[3][p][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5;
- }
- }
-
-//FIXME border!
- }
- return 0;
-}
-
void ff_snow_release_buffer(AVCodecContext *avctx)
{
SnowContext *s = avctx->priv_data;
- int i;
if(s->last_picture[s->max_ref_frames-1]->data[0]){
av_frame_unref(s->last_picture[s->max_ref_frames-1]);
- for(i=0; i<9; i++)
- if(s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3]) {
- av_free(s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3] - EDGE_WIDTH*(1+s->current_picture->linesize[i%3]));
- s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3] = NULL;
- }
}
}
@@ -665,11 +605,6 @@ int ff_snow_frame_start(SnowContext *s){
tmp= s->last_picture[s->max_ref_frames-1];
for(i=s->max_ref_frames-1; i>0; i--)
s->last_picture[i] = s->last_picture[i-1];
- memmove(s->halfpel_plane+1, s->halfpel_plane, (s->max_ref_frames-1)*sizeof(void*)*4*4);
- if(USE_HALFPEL_PLANE && s->current_picture->data[0]) {
- if((ret = halfpel_interpol(s, s->halfpel_plane[0], s->current_picture)) < 0)
- return ret;
- }
s->last_picture[0] = s->current_picture;
s->current_picture = tmp;
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index f5beca66e9..709fef6be5 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -127,7 +127,6 @@ typedef struct SnowContext{
AVFrame *input_picture; ///< new_picture with the internal linesizes
AVFrame *current_picture;
AVFrame *last_picture[MAX_REF_FRAMES];
- uint8_t *halfpel_plane[MAX_REF_FRAMES][4][4];
AVFrame *mconly_picture;
// uint8_t q_context[16];
uint8_t header_state[32];
More information about the ffmpeg-cvslog
mailing list