Revision a959e247 libswscale/swscale.c

View differences:

libswscale/swscale.c
1901 1901
#endif //!CONFIG_RUNTIME_CPUDETECT
1902 1902
}
1903 1903

  
1904
static int PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
1904
static int PlanarToNV12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
1905 1905
                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
1906 1906
{
1907 1907
    uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
......
1927 1927
    return srcSliceH;
1928 1928
}
1929 1929

  
1930
static int PlanarToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
1930
static int PlanarToYuy2Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
1931 1931
                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
1932 1932
{
1933 1933
    uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
......
1937 1937
    return srcSliceH;
1938 1938
}
1939 1939

  
1940
static int PlanarToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
1940
static int PlanarToUyvyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
1941 1941
                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
1942 1942
{
1943 1943
    uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
......
1947 1947
    return srcSliceH;
1948 1948
}
1949 1949

  
1950
static int YUV422PToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
1950
static int YUV422PToYuy2Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
1951 1951
                                int srcSliceH, uint8_t* dstParam[], int dstStride[])
1952 1952
{
1953 1953
    uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
......
1957 1957
    return srcSliceH;
1958 1958
}
1959 1959

  
1960
static int YUV422PToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
1960
static int YUV422PToUyvyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
1961 1961
                                int srcSliceH, uint8_t* dstParam[], int dstStride[])
1962 1962
{
1963 1963
    uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
......
1967 1967
    return srcSliceH;
1968 1968
}
1969 1969

  
1970
static int YUYV2YUV420Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
1970
static int YUYV2YUV420Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
1971 1971
                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
1972 1972
{
1973 1973
    uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
......
1982 1982
    return srcSliceH;
1983 1983
}
1984 1984

  
1985
static int YUYV2YUV422Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
1985
static int YUYV2YUV422Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
1986 1986
                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
1987 1987
{
1988 1988
    uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
......
1994 1994
    return srcSliceH;
1995 1995
}
1996 1996

  
1997
static int UYVY2YUV420Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
1997
static int UYVY2YUV420Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
1998 1998
                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
1999 1999
{
2000 2000
    uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
......
2009 2009
    return srcSliceH;
2010 2010
}
2011 2011

  
2012
static int UYVY2YUV422Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
2012
static int UYVY2YUV422Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
2013 2013
                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
2014 2014
{
2015 2015
    uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
......
2021 2021
    return srcSliceH;
2022 2022
}
2023 2023

  
2024
static int pal2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
2024
static int pal2rgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
2025 2025
                          int srcSliceH, uint8_t* dst[], int dstStride[])
2026 2026
{
2027 2027
    const enum PixelFormat srcFormat= c->srcFormat;
......
2030 2030
                 const uint8_t *palette)=NULL;
2031 2031
    int i;
2032 2032
    uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
2033
    uint8_t *srcPtr= src[0];
2033
    const uint8_t *srcPtr= src[0];
2034 2034

  
2035 2035
    if (!usePal(srcFormat))
2036 2036
        av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
......
2058 2058
}
2059 2059

  
2060 2060
/* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
2061
static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
2061
static int rgb2rgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
2062 2062
                          int srcSliceH, uint8_t* dst[], int dstStride[])
2063 2063
{
2064 2064
    const enum PixelFormat srcFormat= c->srcFormat;
......
2116 2116
    }
2117 2117

  
2118 2118
    if(conv) {
2119
        uint8_t *srcPtr= src[0];
2119
        const uint8_t *srcPtr= src[0];
2120 2120
        if(srcFormat == PIX_FMT_RGB32_1 || srcFormat == PIX_FMT_BGR32_1)
2121 2121
            srcPtr += ALT32_CORR;
2122 2122

  
......
2136 2136
    return srcSliceH;
2137 2137
}
2138 2138

  
2139
static int bgr24toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
2139
static int bgr24toyv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
2140 2140
                              int srcSliceH, uint8_t* dst[], int dstStride[])
2141 2141
{
2142 2142

  
......
2152 2152
    return srcSliceH;
2153 2153
}
2154 2154

  
2155
static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
2155
static int yvu9toyv12Wrapper(SwsContext *c, const const uint8_t* src[], int srcStride[], int srcSliceY,
2156 2156
                             int srcSliceH, uint8_t* dst[], int dstStride[])
2157 2157
{
2158 2158
    int i;
......
2161 2161
    if (srcStride[0]==dstStride[0] && srcStride[0] > 0)
2162 2162
        memcpy(dst[0]+ srcSliceY*dstStride[0], src[0], srcStride[0]*srcSliceH);
2163 2163
    else {
2164
        uint8_t *srcPtr= src[0];
2164
        const uint8_t *srcPtr= src[0];
2165 2165
        uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
2166 2166

  
2167 2167
        for (i=0; i<srcSliceH; i++) {
......
2188 2188
}
2189 2189

  
2190 2190
/* unscaled copy like stuff (assumes nearly identical formats) */
2191
static int packedCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
2191
static int packedCopy(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
2192 2192
                      int srcSliceH, uint8_t* dst[], int dstStride[])
2193 2193
{
2194 2194
    if (dstStride[0]==srcStride[0] && srcStride[0] > 0)
2195 2195
        memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], srcSliceH*dstStride[0]);
2196 2196
    else {
2197 2197
        int i;
2198
        uint8_t *srcPtr= src[0];
2198
        const uint8_t *srcPtr= src[0];
2199 2199
        uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
2200 2200
        int length=0;
2201 2201

  
......
2213 2213
    return srcSliceH;
2214 2214
}
2215 2215

  
2216
static int planarCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
2216
static int planarCopy(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
2217 2217
                      int srcSliceH, uint8_t* dst[], int dstStride[])
2218 2218
{
2219 2219
    int plane, i, j;
......
2221 2221
        int length= (plane==0 || plane==3) ? c->srcW  : -((-c->srcW  )>>c->chrDstHSubSample);
2222 2222
        int y=      (plane==0 || plane==3) ? srcSliceY: -((-srcSliceY)>>c->chrDstVSubSample);
2223 2223
        int height= (plane==0 || plane==3) ? srcSliceH: -((-srcSliceH)>>c->chrDstVSubSample);
2224
        uint8_t *srcPtr= src[plane];
2224
        const uint8_t *srcPtr= src[plane];
2225 2225
        uint8_t *dstPtr= dst[plane] + dstStride[plane]*y;
2226 2226

  
2227 2227
        if (!dst[plane]) continue;
......
2928 2928
    return NULL;
2929 2929
}
2930 2930

  
2931
static void reset_ptr(uint8_t* src[], int format)
2931
static void reset_ptr(const uint8_t* src[], int format)
2932 2932
{
2933 2933
    if(!isALPHA(format))
2934 2934
        src[3]=NULL;
......
2948 2948
 * swscale wrapper, so we don't need to export the SwsContext.
2949 2949
 * Assumes planar YUV to be in YUV order instead of YVU.
2950 2950
 */
2951
int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
2951
int sws_scale(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
2952 2952
              int srcSliceH, uint8_t* dst[], int dstStride[])
2953 2953
{
2954 2954
    int i;
2955
    uint8_t* src2[4]= {src[0], src[1], src[2], src[3]};
2955
    const uint8_t* src2[4]= {src[0], src[1], src[2], src[3]};
2956 2956
    uint8_t* dst2[4]= {dst[0], dst[1], dst[2], dst[3]};
2957 2957

  
2958 2958
    // do not mess up sliceDir if we have a "trailing" 0-size slice
......
3035 3035
        int dstStride2[4]= {dstStride[0], dstStride[1], dstStride[2], dstStride[3]};
3036 3036

  
3037 3037
        reset_ptr(src2, c->srcFormat);
3038
        reset_ptr(dst2, c->dstFormat);
3038
        reset_ptr((const uint8_t**)dst2, c->dstFormat);
3039 3039

  
3040 3040
        /* reset slice direction at end of frame */
3041 3041
        if (srcSliceY + srcSliceH == c->srcH)
......
3058 3058
        dst2[3] += ( c->dstH                      -1)*dstStride[3];
3059 3059

  
3060 3060
        reset_ptr(src2, c->srcFormat);
3061
        reset_ptr(dst2, c->dstFormat);
3061
        reset_ptr((const uint8_t**)dst2, c->dstFormat);
3062 3062

  
3063 3063
        /* reset slice direction at end of frame */
3064 3064
        if (!srcSliceY)
......
3069 3069
}
3070 3070

  
3071 3071
#if LIBSWSCALE_VERSION_MAJOR < 1
3072
int sws_scale_ordered(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
3072
int sws_scale_ordered(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
3073 3073
                      int srcSliceH, uint8_t* dst[], int dstStride[])
3074 3074
{
3075 3075
    return sws_scale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride);

Also available in: Unified diff