History

avfilter/vf_v360: add asserts to guard against invalid conditions

Paul B Mahol committed 7 years ago

Commit f0d80051 parent 32dd4291 file · +19 −0Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_v360.c+19−0
@@ -33,6 +33,7 @@ · 32 unmodified lines
33 * 5) Remap input frame to output frame using precalculated data33 * 5) Remap input frame to output frame using precalculated data
34 */34 */
35 35
36#include "libavutil/avassert.h"
36#include "libavutil/imgutils.h"37#include "libavutil/imgutils.h"
37#include "libavutil/pixdesc.h"38#include "libavutil/pixdesc.h"
38#include "libavutil/opt.h"39#include "libavutil/opt.h"
@@ -696,6 +697,8 @@ static inline void rotate_cube_face(float *uf, float *vf, int rotation) · 657 unmodified lines
696 *uf = *vf;697 *uf = *vf;
697 *vf = tmp;698 *vf = tmp;
698 break;699 break;
700 default:
701 av_assert0(0);
699 }702 }
700}703}
701 704
@@ -720,6 +723,8 @@ static inline void rotate_cube_face_inverse(float *uf, float *vf, int rotation) · 18 unmodified lines
720 *uf = -*vf;723 *uf = -*vf;
721 *vf = tmp;724 *vf = tmp;
722 break;725 break;
726 default:
727 av_assert0(0);
723 }728 }
724}729}
725 730
@@ -850,6 +855,8 @@ static void xyz_to_cube(const V360Context *s, · 124 unmodified lines
850 *uf = -vec[0] / vec[2];855 *uf = -vec[0] / vec[2];
851 *vf = -vec[1] / vec[2];856 *vf = -vec[1] / vec[2];
852 break;857 break;
858 default:
859 av_assert0(0);
853 }860 }
854 861
855 face = s->in_cubemap_face_order[*direction];862 face = s->in_cubemap_face_order[*direction];
@@ -929,6 +936,8 @@ static void process_cube_coordinates(const V360Context *s, · 73 unmodified lines
929 *new_uf = uf;936 *new_uf = uf;
930 *new_vf = vf;937 *new_vf = vf;
931 break;938 break;
939 default:
940 av_assert0(0);
932 }941 }
933 } else if (uf >= 1.f) {942 } else if (uf >= 1.f) {
934 uf -= 2.f;943 uf -= 2.f;
@@ -963,6 +972,8 @@ static void process_cube_coordinates(const V360Context *s, · 28 unmodified lines
963 *new_uf = uf;972 *new_uf = uf;
964 *new_vf = vf;973 *new_vf = vf;
965 break;974 break;
975 default:
976 av_assert0(0);
966 }977 }
967 } else if (vf < -1.f) {978 } else if (vf < -1.f) {
968 vf += 2.f;979 vf += 2.f;
@@ -997,6 +1008,8 @@ static void process_cube_coordinates(const V360Context *s, · 28 unmodified lines
997 *new_uf = -uf;1008 *new_uf = -uf;
998 *new_vf = -vf;1009 *new_vf = -vf;
999 break;1010 break;
1011 default:
1012 av_assert0(0);
1000 }1013 }
1001 } else if (vf >= 1.f) {1014 } else if (vf >= 1.f) {
1002 vf -= 2.f;1015 vf -= 2.f;
@@ -1031,6 +1044,8 @@ static void process_cube_coordinates(const V360Context *s, · 28 unmodified lines
1031 *new_uf = -uf;1044 *new_uf = -uf;
1032 *new_vf = -vf;1045 *new_vf = -vf;
1033 break;1046 break;
1047 default:
1048 av_assert0(0);
1034 }1049 }
1035 } else {1050 } else {
1036 // Inside cube face1051 // Inside cube face
@@ -1587,6 +1602,8 @@ static void eac_to_xyz(const V360Context *s, · 550 unmodified lines
1587 l_y = 1.f;1602 l_y = 1.f;
1588 l_z = -uf;1603 l_z = -uf;
1589 break;1604 break;
1605 default:
1606 av_assert0(0);
1590 }1607 }
1591 1608
1592 norm = sqrtf(l_x * l_x + l_y * l_y + l_z * l_z);1609 norm = sqrtf(l_x * l_x + l_y * l_y + l_z * l_z);
@@ -2017,6 +2034,8 @@ static int config_output(AVFilterLink *outlink) · 424 unmodified lines
2017 sizeof_uv = sizeof(uint16_t) * elements;2034 sizeof_uv = sizeof(uint16_t) * elements;
2018 sizeof_ker = sizeof(uint16_t) * elements;2035 sizeof_ker = sizeof(uint16_t) * elements;
2019 break;2036 break;
2037 default:
2038 av_assert0(0);
2020 }2039 }
2021 2040
2022 switch (s->in) {2041 switch (s->in) {

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