void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
    const int field_pic= s->picture_structure != PICT_FRAME;
    if(field_pic){
        h <<= 1;
        y <<= 1;
    }
    if (!s->avctx->hwaccel
       && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
       && s->unrestricted_mv
       && s->current_picture.f.reference
       && !s->intra_only
       && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
        int sides = 0, edge_h;
        int hshift = desc->log2_chroma_w;
        int vshift = desc->log2_chroma_h;
        if (y==0) sides |= EDGE_TOP;
        if (y + h >= s->v_edge_pos) sides |= EDGE_BOTTOM;
        edge_h= FFMIN(h, s->v_edge_pos - y);
        s->dsp.draw_edges(s->current_picture_ptr->f.data[0] +  y         *s->linesize,
                          s->linesize,           s->h_edge_pos,         edge_h,
                          EDGE_WIDTH,            EDGE_WIDTH,            sides);
        s->dsp.draw_edges(s->current_picture_ptr->f.data[1] + (y>>vshift)*s->uvlinesize,
                          s->uvlinesize,         s->h_edge_pos>>hshift, edge_h>>vshift,
                          EDGE_WIDTH>>hshift,    EDGE_WIDTH>>vshift,    sides);
        s->dsp.draw_edges(s->current_picture_ptr->f.data[2] + (y>>vshift)*s->uvlinesize,
                          s->uvlinesize,         s->h_edge_pos>>hshift, edge_h>>vshift,
                          EDGE_WIDTH>>hshift,    EDGE_WIDTH>>vshift,    sides);
    }
    h= FFMIN(h, s->avctx->height - y);
    if(field_pic && s->first_field && !(s->avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return;
    if (s->avctx->draw_horiz_band) {
        AVFrame *src;
        int offset[AV_NUM_DATA_POINTERS];
        int i;
        if(s->pict_type==AV_PICTURE_TYPE_B || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER))
            src = &s->current_picture_ptr->f;
        else if(s->last_picture_ptr)
            src = &s->last_picture_ptr->f;
        else
            return;
        if(s->pict_type==AV_PICTURE_TYPE_B && s->picture_structure == PICT_FRAME && s->out_format != FMT_H264){
            for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
                offset[i] = 0;
        }else{
            offset[0]= y * s->linesize;
            offset[1]=
            offset[2]= (y >> s->chroma_y_shift) * s->uvlinesize;
            for (i = 3; i < AV_NUM_DATA_POINTERS; i++)
                offset[i] = 0;
        }
        emms_c();
        s->avctx->draw_horiz_band(s->avctx, src, offset,
                                  y, s->picture_structure, h);
    }
}
['void ff_draw_horiz_band(MpegEncContext *s, int y, int h){\n    const int field_pic= s->picture_structure != PICT_FRAME;\n    if(field_pic){\n        h <<= 1;\n        y <<= 1;\n    }\n    if (!s->avctx->hwaccel\n       && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)\n       && s->unrestricted_mv\n       && s->current_picture.f.reference\n       && !s->intra_only\n       && !(s->flags&CODEC_FLAG_EMU_EDGE)) {\n        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);\n        int sides = 0, edge_h;\n        int hshift = desc->log2_chroma_w;\n        int vshift = desc->log2_chroma_h;\n        if (y==0) sides |= EDGE_TOP;\n        if (y + h >= s->v_edge_pos) sides |= EDGE_BOTTOM;\n        edge_h= FFMIN(h, s->v_edge_pos - y);\n        s->dsp.draw_edges(s->current_picture_ptr->f.data[0] +  y         *s->linesize,\n                          s->linesize,           s->h_edge_pos,         edge_h,\n                          EDGE_WIDTH,            EDGE_WIDTH,            sides);\n        s->dsp.draw_edges(s->current_picture_ptr->f.data[1] + (y>>vshift)*s->uvlinesize,\n                          s->uvlinesize,         s->h_edge_pos>>hshift, edge_h>>vshift,\n                          EDGE_WIDTH>>hshift,    EDGE_WIDTH>>vshift,    sides);\n        s->dsp.draw_edges(s->current_picture_ptr->f.data[2] + (y>>vshift)*s->uvlinesize,\n                          s->uvlinesize,         s->h_edge_pos>>hshift, edge_h>>vshift,\n                          EDGE_WIDTH>>hshift,    EDGE_WIDTH>>vshift,    sides);\n    }\n    h= FFMIN(h, s->avctx->height - y);\n    if(field_pic && s->first_field && !(s->avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return;\n    if (s->avctx->draw_horiz_band) {\n        AVFrame *src;\n        int offset[AV_NUM_DATA_POINTERS];\n        int i;\n        if(s->pict_type==AV_PICTURE_TYPE_B || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER))\n            src = &s->current_picture_ptr->f;\n        else if(s->last_picture_ptr)\n            src = &s->last_picture_ptr->f;\n        else\n            return;\n        if(s->pict_type==AV_PICTURE_TYPE_B && s->picture_structure == PICT_FRAME && s->out_format != FMT_H264){\n            for (i = 0; i < AV_NUM_DATA_POINTERS; i++)\n                offset[i] = 0;\n        }else{\n            offset[0]= y * s->linesize;\n            offset[1]=\n            offset[2]= (y >> s->chroma_y_shift) * s->uvlinesize;\n            for (i = 3; i < AV_NUM_DATA_POINTERS; i++)\n                offset[i] = 0;\n        }\n        emms_c();\n        s->avctx->draw_horiz_band(s->avctx, src, offset,\n                                  y, s->picture_structure, h);\n    }\n}', 'const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)\n{\n    if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)\n        return NULL;\n    return &av_pix_fmt_descriptors[pix_fmt];\n}']