History

avfilter/drawutils: Remove remnants of old API

ff_fill_line_with_color and ff_draw_rectangle are unused since 19c8f2271423281c9b876b984076a6467c455904; ff_copy_rectangle is unused since 53b7a3fe081ec56c5706228eb6431bb943ad471a.

Andreas Rheinhardt committed 5 years ago

Commit 124e2a71 parent 27b793b2 files · +0 −111Browse files

Showing the changes to libavfilter (2 of 2 files). Show all

Unified · Split

2 files
  1. libavfilter/drawutils.c +0 −98
  2. libavfilter/drawutils.h +0 −13
libavfilter/drawutils.c+0−98
@@ -77,104 +77,6 @@ int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt) · 76 unmodified lines
77 return 0;77 return 0;
78}78}
79 79
80int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t dst_color[4],
81 enum AVPixelFormat pix_fmt, uint8_t rgba_color[4],
82 int *is_packed_rgba, uint8_t rgba_map_ptr[4])
83{
84 uint8_t rgba_map[4] = {0};
85 int i;
86 const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(pix_fmt);
87 int hsub;
88
89 av_assert0(pix_desc);
90
91 hsub = pix_desc->log2_chroma_w;
92
93 *is_packed_rgba = ff_fill_rgba_map(rgba_map, pix_fmt) >= 0;
94
95 if (*is_packed_rgba) {
96 pixel_step[0] = (av_get_bits_per_pixel(pix_desc))>>3;
97 for (i = 0; i < 4; i++)
98 dst_color[rgba_map[i]] = rgba_color[i];
99
100 line[0] = av_malloc_array(w, pixel_step[0]);
101 if (!line[0])
102 return AVERROR(ENOMEM);
103 for (i = 0; i < w; i++)
104 memcpy(line[0] + i * pixel_step[0], dst_color, pixel_step[0]);
105 if (rgba_map_ptr)
106 memcpy(rgba_map_ptr, rgba_map, sizeof(rgba_map[0]) * 4);
107 } else {
108 int plane;
109
110 dst_color[0] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
111 dst_color[1] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
112 dst_color[2] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
113 dst_color[3] = rgba_color[3];
114
115 for (plane = 0; plane < 4; plane++) {
116 int line_size;
117 int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
118
119 pixel_step[plane] = 1;
120 line_size = AV_CEIL_RSHIFT(w, hsub1) * pixel_step[plane];
121 line[plane] = av_malloc(line_size);
122 if (!line[plane]) {
123 while(plane && line[plane-1])
124 av_freep(&line[--plane]);
125 return AVERROR(ENOMEM);
126 }
127 memset(line[plane], dst_color[plane], line_size);
128 }
129 }
130
131 return 0;
132}
133
134void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4],
135 uint8_t *src[4], int pixelstep[4],
136 int hsub, int vsub, int x, int y, int w, int h)
137{
138 int i, plane;
139 uint8_t *p;
140
141 for (plane = 0; plane < 4 && dst[plane]; plane++) {
142 int hsub1 = plane == 1 || plane == 2 ? hsub : 0;
143 int vsub1 = plane == 1 || plane == 2 ? vsub : 0;
144 int width = AV_CEIL_RSHIFT(w, hsub1);
145 int height = AV_CEIL_RSHIFT(h, vsub1);
146
147 p = dst[plane] + (y >> vsub1) * dst_linesize[plane];
148 for (i = 0; i < height; i++) {
149 memcpy(p + (x >> hsub1) * pixelstep[plane],
150 src[plane], width * pixelstep[plane]);
151 p += dst_linesize[plane];
152 }
153 }
154}
155
156void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4],
157 uint8_t *src[4], int src_linesize[4], int pixelstep[4],
158 int hsub, int vsub, int x, int y, int y2, int w, int h)
159{
160 int i, plane;
161 uint8_t *p;
162
163 for (plane = 0; plane < 4 && dst[plane]; plane++) {
164 int hsub1 = plane == 1 || plane == 2 ? hsub : 0;
165 int vsub1 = plane == 1 || plane == 2 ? vsub : 0;
166 int width = AV_CEIL_RSHIFT(w, hsub1);
167 int height = AV_CEIL_RSHIFT(h, vsub1);
168
169 p = dst[plane] + (y >> vsub1) * dst_linesize[plane];
170 for (i = 0; i < height; i++) {
171 memcpy(p + (x >> hsub1) * pixelstep[plane],
172 src[plane] + src_linesize[plane]*(i+(y2>>vsub1)), width * pixelstep[plane]);
173 p += dst_linesize[plane];
174 }
175 }
176}
177
178int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)80int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
179{81{
180 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);82 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
libavfilter/drawutils.h+0−13
@@ -30,19 +30,6 @@ · 29 unmodified lines
30 30
31int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt);31int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt);
32 32
33int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w,
34 uint8_t dst_color[4],
35 enum AVPixelFormat pix_fmt, uint8_t rgba_color[4],
36 int *is_packed_rgba, uint8_t rgba_map[4]);
37
38void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4],
39 uint8_t *src[4], int pixelstep[4],
40 int hsub, int vsub, int x, int y, int w, int h);
41
42void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4],
43 uint8_t *src[4], int src_linesize[4], int pixelstep[4],
44 int hsub, int vsub, int x, int y, int y2, int w, int h);
45
46#define MAX_PLANES 433#define MAX_PLANES 4
47 34
48typedef struct FFDrawContext {35typedef struct FFDrawContext {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t