| @@ -26,14 +26,15 @@ · 25 unmodified lines |
| 26 | 26 | #include <string.h> |
| 27 | 27 | #include <inttypes.h> |
| 28 | 28 | #include <assert.h> |
| 29 | | −#include "config.h" |
| 30 | 29 | #include <unistd.h> |
| 30 | + |
| 31 | +#include "config.h" |
| 31 | 32 | #include "libswscale/rgb2rgb.h" |
| 32 | 33 | #include "libswscale/swscale.h" |
| 33 | 34 | #include "libswscale/swscale_internal.h" |
| 34 | 35 | |
| 35 | 36 | #if defined(__FDPIC__) && CONFIG_SRAM |
| 36 | | −#define L1CODE __attribute__ ((l1_text)) |
| 37 | +#define L1CODE __attribute__((l1_text)) |
| 37 | 38 | #else |
| 38 | 39 | #define L1CODE |
| 39 | 40 | #endif |
| @@ -47,21 +48,20 @@ void ff_bfin_yuv2rgb565_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, · 7 unmodified lines |
| 47 | 48 | void ff_bfin_yuv2rgb24_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, |
| 48 | 49 | int w, uint32_t *coeffs) L1CODE; |
| 49 | 50 | |
| 50 | | −typedef void (* ltransform)(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, |
| 51 | | − int w, uint32_t *coeffs); |
| 52 | | − |
| 51 | +typedef void (*ltransform)(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, |
| 52 | + int w, uint32_t *coeffs); |
| 53 | 53 | |
| 54 | 54 | static void bfin_prepare_coefficients(SwsContext *c, int rgb, int masks) |
| 55 | 55 | { |
| 56 | 56 | int oy; |
| 57 | | − oy = c->yOffset&0xffff; |
| 58 | | − oy = oy >> 3; // keep everything U8.0 for offset calculation |
| 57 | + oy = c->yOffset & 0xffff; |
| 58 | + oy = oy >> 3; // keep everything U8.0 for offset calculation |
| 59 | 59 | |
| 60 | | − c->oc = 128*0x01010101U; |
| 61 | | − c->oy = oy*0x01010101U; |
| 60 | + c->oc = 128 * 0x01010101U; |
| 61 | + c->oy = oy * 0x01010101U; |
| 62 | 62 | |
| 63 | 63 | /* copy 64bit vector coeffs down to 32bit vector coeffs */ |
| 64 | | − c->cy = c->yCoeff; |
| 64 | + c->cy = c->yCoeff; |
| 65 | 65 | c->zero = 0; |
| 66 | 66 | |
| 67 | 67 | if (rgb) { |
| @@ -76,7 +76,6 @@ static void bfin_prepare_coefficients(SwsContext *c, int rgb, int masks) · 8 unmodified lines |
| 76 | 76 | c->cgv = c->ugCoeff; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | | − |
| 80 | 79 | if (masks == 555) { |
| 81 | 80 | c->rmask = 0x001f * 0x00010001U; |
| 82 | 81 | c->gmask = 0x03e0 * 0x00010001U; |
| @@ -88,27 +87,25 @@ static void bfin_prepare_coefficients(SwsContext *c, int rgb, int masks) · 5 unmodified lines |
| 88 | 87 | } |
| 89 | 88 | } |
| 90 | 89 | |
| 91 | | −static int core_yuv420_rgb(SwsContext *c, |
| 92 | | − uint8_t **in, int *instrides, |
| 93 | | − int srcSliceY, int srcSliceH, |
| 94 | | − uint8_t **oplanes, int *outstrides, |
| 95 | | − ltransform lcscf, int rgb, int masks) |
| 90 | +static int core_yuv420_rgb(SwsContext *c, uint8_t **in, int *instrides, |
| 91 | + int srcSliceY, int srcSliceH, uint8_t **oplanes, |
| 92 | + int *outstrides, ltransform lcscf, |
| 93 | + int rgb, int masks) |
| 96 | 94 | { |
| 97 | | − uint8_t *py,*pu,*pv,*op; |
| 95 | + uint8_t *py, *pu, *pv, *op; |
| 98 | 96 | int w = instrides[0]; |
| 99 | | − int h2 = srcSliceH>>1; |
| 97 | + int h2 = srcSliceH >> 1; |
| 100 | 98 | int i; |
| 101 | 99 | |
| 102 | 100 | bfin_prepare_coefficients(c, rgb, masks); |
| 103 | 101 | |
| 104 | 102 | py = in[0]; |
| 105 | | − pu = in[1+(1^rgb)]; |
| 106 | | − pv = in[1+(0^rgb)]; |
| 107 | | − |
| 108 | | − op = oplanes[0] + srcSliceY*outstrides[0]; |
| 103 | + pu = in[1 + (1 ^ rgb)]; |
| 104 | + pv = in[1 + (0 ^ rgb)]; |
| 109 | 105 | |
| 110 | | − for (i=0;i<h2;i++) { |
| 106 | + op = oplanes[0] + srcSliceY * outstrides[0]; |
| 111 | 107 | |
| 108 | + for (i = 0; i < h2; i++) { |
| 112 | 109 | lcscf(py, pu, pv, op, w, &c->oy); |
| 113 | 110 | |
| 114 | 111 | py += instrides[0]; |
| @@ -125,9 +122,7 @@ static int core_yuv420_rgb(SwsContext *c, · 10 unmodified lines |
| 125 | 122 | return srcSliceH; |
| 126 | 123 | } |
| 127 | 124 | |
| 128 | | − |
| 129 | | −static int bfin_yuv420_rgb555(SwsContext *c, |
| 130 | | − uint8_t **in, int *instrides, |
| 125 | +static int bfin_yuv420_rgb555(SwsContext *c, uint8_t **in, int *instrides, |
| 131 | 126 | int srcSliceY, int srcSliceH, |
| 132 | 127 | uint8_t **oplanes, int *outstrides) |
| 133 | 128 | { |
| @@ -135,8 +130,7 @@ static int bfin_yuv420_rgb555(SwsContext *c, · 1 unmodified line |
| 135 | 130 | outstrides, ff_bfin_yuv2rgb555_line, 1, 555); |
| 136 | 131 | } |
| 137 | 132 | |
| 138 | | −static int bfin_yuv420_bgr555(SwsContext *c, |
| 139 | | − uint8_t **in, int *instrides, |
| 133 | +static int bfin_yuv420_bgr555(SwsContext *c, uint8_t **in, int *instrides, |
| 140 | 134 | int srcSliceY, int srcSliceH, |
| 141 | 135 | uint8_t **oplanes, int *outstrides) |
| 142 | 136 | { |
| @@ -144,8 +138,7 @@ static int bfin_yuv420_bgr555(SwsContext *c, · 1 unmodified line |
| 144 | 138 | outstrides, ff_bfin_yuv2rgb555_line, 0, 555); |
| 145 | 139 | } |
| 146 | 140 | |
| 147 | | −static int bfin_yuv420_rgb24(SwsContext *c, |
| 148 | | − uint8_t **in, int *instrides, |
| 141 | +static int bfin_yuv420_rgb24(SwsContext *c, uint8_t **in, int *instrides, |
| 149 | 142 | int srcSliceY, int srcSliceH, |
| 150 | 143 | uint8_t **oplanes, int *outstrides) |
| 151 | 144 | { |
| @@ -153,8 +146,7 @@ static int bfin_yuv420_rgb24(SwsContext *c, · 1 unmodified line |
| 153 | 146 | outstrides, ff_bfin_yuv2rgb24_line, 1, 888); |
| 154 | 147 | } |
| 155 | 148 | |
| 156 | | −static int bfin_yuv420_bgr24(SwsContext *c, |
| 157 | | − uint8_t **in, int *instrides, |
| 149 | +static int bfin_yuv420_bgr24(SwsContext *c, uint8_t **in, int *instrides, |
| 158 | 150 | int srcSliceY, int srcSliceH, |
| 159 | 151 | uint8_t **oplanes, int *outstrides) |
| 160 | 152 | { |
| @@ -162,8 +154,7 @@ static int bfin_yuv420_bgr24(SwsContext *c, · 1 unmodified line |
| 162 | 154 | outstrides, ff_bfin_yuv2rgb24_line, 0, 888); |
| 163 | 155 | } |
| 164 | 156 | |
| 165 | | −static int bfin_yuv420_rgb565(SwsContext *c, |
| 166 | | − uint8_t **in, int *instrides, |
| 157 | +static int bfin_yuv420_rgb565(SwsContext *c, uint8_t **in, int *instrides, |
| 167 | 158 | int srcSliceY, int srcSliceH, |
| 168 | 159 | uint8_t **oplanes, int *outstrides) |
| 169 | 160 | { |
| @@ -171,8 +162,7 @@ static int bfin_yuv420_rgb565(SwsContext *c, · 1 unmodified line |
| 171 | 162 | outstrides, ff_bfin_yuv2rgb565_line, 1, 565); |
| 172 | 163 | } |
| 173 | 164 | |
| 174 | | −static int bfin_yuv420_bgr565(SwsContext *c, |
| 175 | | − uint8_t **in, int *instrides, |
| 165 | +static int bfin_yuv420_bgr565(SwsContext *c, uint8_t **in, int *instrides, |
| 176 | 166 | int srcSliceY, int srcSliceH, |
| 177 | 167 | uint8_t **oplanes, int *outstrides) |
| 178 | 168 | { |
| @@ -180,24 +170,35 @@ static int bfin_yuv420_bgr565(SwsContext *c, · 1 unmodified line |
| 180 | 170 | outstrides, ff_bfin_yuv2rgb565_line, 0, 565); |
| 181 | 171 | } |
| 182 | 172 | |
| 183 | | − |
| 184 | 173 | SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c) |
| 185 | 174 | { |
| 186 | 175 | SwsFunc f; |
| 187 | 176 | |
| 188 | | − switch(c->dstFormat) { |
| 189 | | − case PIX_FMT_RGB555: f = bfin_yuv420_rgb555; break; |
| 190 | | − case PIX_FMT_BGR555: f = bfin_yuv420_bgr555; break; |
| 191 | | − case PIX_FMT_RGB565: f = bfin_yuv420_rgb565; break; |
| 192 | | − case PIX_FMT_BGR565: f = bfin_yuv420_bgr565; break; |
| 193 | | − case PIX_FMT_RGB24: f = bfin_yuv420_rgb24; break; |
| 194 | | − case PIX_FMT_BGR24: f = bfin_yuv420_bgr24; break; |
| 177 | + switch (c->dstFormat) { |
| 178 | + case PIX_FMT_RGB555: |
| 179 | + f = bfin_yuv420_rgb555; |
| 180 | + break; |
| 181 | + case PIX_FMT_BGR555: |
| 182 | + f = bfin_yuv420_bgr555; |
| 183 | + break; |
| 184 | + case PIX_FMT_RGB565: |
| 185 | + f = bfin_yuv420_rgb565; |
| 186 | + break; |
| 187 | + case PIX_FMT_BGR565: |
| 188 | + f = bfin_yuv420_bgr565; |
| 189 | + break; |
| 190 | + case PIX_FMT_RGB24: |
| 191 | + f = bfin_yuv420_rgb24; |
| 192 | + break; |
| 193 | + case PIX_FMT_BGR24: |
| 194 | + f = bfin_yuv420_bgr24; |
| 195 | + break; |
| 195 | 196 | default: |
| 196 | 197 | return 0; |
| 197 | 198 | } |
| 198 | 199 | |
| 199 | 200 | av_log(c, AV_LOG_INFO, "BlackFin accelerated color space converter %s\n", |
| 200 | | − sws_format_name (c->dstFormat)); |
| 201 | + sws_format_name(c->dstFormat)); |
| 201 | 202 | |
| 202 | 203 | return f; |
| 203 | 204 | } |