






import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding





class        a__      (	lowerCAmelCase__		):
		UpperCAmelCase_							:       str 					= ['image_processor', 'tokenizer']
		UpperCAmelCase_							:       int 					= 'VideoMAEImageProcessor'
		UpperCAmelCase_							:       Optional[Any] 					= ('CLIPTokenizer', 'CLIPTokenizerFast')






		def __init__(      self							, lowercase__=None							, lowercase__=None							, **lowercase__						)				->				Tuple:
				__A    =							None
				if "feature_extractor" in kwargs:
						warnings.warn(
						    "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
						    " instead."							, lowercase__							, )
						__A    =							kwargs.pop("feature_extractor"						)

				__A    =							image_processor if image_processor is not None else feature_extractor
				if image_processor is None:
						raise ValueError("You need to specify an `image_processor`."						)
				if tokenizer is None:
						raise ValueError("You need to specify a `tokenizer`."						)

				super().__init__(lowercase__							, lowercase__						)
				__A    =							self.image_processor






		def __call__(      self							, lowercase__=None							, lowercase__=None							, lowercase__=None							, **lowercase__						)				->				Any:

				if text is None and videos is None:
						raise ValueError("You have to specify either text or videos. Both cannot be none."						)

				if text is not None:
						__A    =							self.tokenizer(lowercase__							, return_tensors=lowercase__							, **lowercase__						)

				if videos is not None:
						__A    =							self.image_processor(lowercase__							, return_tensors=lowercase__							, **lowercase__						)

				if text is not None and videos is not None:
						__A    =							image_features.pixel_values
						return encoding
				elif text is not None:
						return encoding
				else:
						return BatchEncoding(data=dict(**lowercase__						)							, tensor_type=lowercase__						)






		def 					_lowerCamelCase					(      self							, *lowercase__							, **lowercase__						)				->				Optional[int]:
				return self.tokenizer.batch_decode(*lowercase__							, **lowercase__						)






		def 					_lowerCamelCase					(      self							, *lowercase__							, **lowercase__						)				->				Tuple:
				return self.tokenizer.decode(*lowercase__							, **lowercase__						)






		@property
		def 					_lowerCamelCase					(      self						)				->				Optional[int]:
				return ["input_ids", "attention_mask", "position_ids", "pixel_values"]






		@property
		def 					_lowerCamelCase					(      self						)				->				int:
				warnings.warn(
				    "`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."							, lowercase__							, )
				return self.image_processor_class






		@property
		def 					_lowerCamelCase					(      self						)				->				Any:
				warnings.warn(
				    "`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."							, lowercase__							, )
				return self.image_processor






def  _snake_case			(							__snake_case       ,	__snake_case       ,	__snake_case     )  ->  list[int]:






      '''simple docstring'''







      if hue < 0 or hue > 3_6_0:
            raise Exception("hue should be between 0 and 360"     )

      if saturation < 0 or saturation > 1:
            raise Exception("saturation should be between 0 and 1"     )

      if value < 0 or value > 1:
            raise Exception("value should be between 0 and 1"     )

      UpperCAmelCase_	:						Tuple					   =		value * saturation
      UpperCAmelCase_	:						Union[str, Any]					   =		hue / 6_0
      UpperCAmelCase_	:						Tuple					   =		chroma * (1 - abs(hue_section % 2 - 1     ))
      UpperCAmelCase_	:						Tuple					   =		value - chroma

      if hue_section >= 0 and hue_section <= 1:
            UpperCAmelCase_	:						List[str]					   =		round(2_5_5 * (chroma + match_value)     )
            UpperCAmelCase_	:						str					   =		round(2_5_5 * (second_largest_component + match_value)     )
            UpperCAmelCase_	:						int					   =		round(2_5_5 * (match_value)     )
      elif hue_section > 1 and hue_section <= 2:
            UpperCAmelCase_	:						Union[str, Any]					   =		round(2_5_5 * (second_largest_component + match_value)     )
            UpperCAmelCase_	:						Union[str, Any]					   =		round(2_5_5 * (chroma + match_value)     )
            UpperCAmelCase_	:						int					   =		round(2_5_5 * (match_value)     )
      elif hue_section > 2 and hue_section <= 3:
            UpperCAmelCase_	:						List[str]					   =		round(2_5_5 * (match_value)     )
            UpperCAmelCase_	:						Any					   =		round(2_5_5 * (chroma + match_value)     )
            UpperCAmelCase_	:						Optional[int]					   =		round(2_5_5 * (second_largest_component + match_value)     )
      elif hue_section > 3 and hue_section <= 4:
            UpperCAmelCase_	:						str					   =		round(2_5_5 * (match_value)     )
            UpperCAmelCase_	:						Dict					   =		round(2_5_5 * (second_largest_component + match_value)     )
            UpperCAmelCase_	:						Optional[Any]					   =		round(2_5_5 * (chroma + match_value)     )
      elif hue_section > 4 and hue_section <= 5:
            UpperCAmelCase_	:						str					   =		round(2_5_5 * (second_largest_component + match_value)     )
            UpperCAmelCase_	:						Any					   =		round(2_5_5 * (match_value)     )
            UpperCAmelCase_	:						str					   =		round(2_5_5 * (chroma + match_value)     )
      else:
            UpperCAmelCase_	:						Optional[int]					   =		round(2_5_5 * (chroma + match_value)     )
            UpperCAmelCase_	:						Dict					   =		round(2_5_5 * (match_value)     )
            UpperCAmelCase_	:						Optional[int]					   =		round(2_5_5 * (second_largest_component + match_value)     )

      return [red, green, blue]







def  _snake_case			(							__snake_case       ,	__snake_case       ,	__snake_case     )  ->  list[float]:






      '''simple docstring'''







      if red < 0 or red > 2_5_5:
            raise Exception("red should be between 0 and 255"     )

      if green < 0 or green > 2_5_5:
            raise Exception("green should be between 0 and 255"     )

      if blue < 0 or blue > 2_5_5:
            raise Exception("blue should be between 0 and 255"     )

      UpperCAmelCase_	:						str					   =		red / 2_5_5
      UpperCAmelCase_	:						Dict					   =		green / 2_5_5
      UpperCAmelCase_	:						int					   =		blue / 2_5_5
      UpperCAmelCase_	:						Any					   =		max(__snake_case       ,	__snake_case       ,	__snake_case     )
      UpperCAmelCase_	:						Union[str, Any]					   =		value - min(__snake_case       ,	__snake_case       ,	__snake_case     )
      UpperCAmelCase_	:						Optional[Any]					   =		0 if value == 0 else chroma / value

      if chroma == 0:
            UpperCAmelCase_	:						Tuple					   =		0.0
      elif value == float_red:
            UpperCAmelCase_	:						List[str]					   =		6_0 * (0 + (float_green - float_blue) / chroma)
      elif value == float_green:
            UpperCAmelCase_	:						Union[str, Any]					   =		6_0 * (2 + (float_blue - float_red) / chroma)
      else:
            UpperCAmelCase_	:						Dict					   =		6_0 * (4 + (float_red - float_green) / chroma)

      UpperCAmelCase_	:						int					   =		(hue + 3_6_0) % 3_6_0

      return [hue, saturation, value]







def  _snake_case			(							__snake_case       ,	__snake_case     )  ->  bool:






      '''simple docstring'''







      UpperCAmelCase_	:						List[str]					   =		abs(hsv_a[0] - hsv_a[0]     ) < 0.2
      UpperCAmelCase_	:						Optional[Any]					   =		abs(hsv_a[1] - hsv_a[1]     ) < 0.002
      UpperCAmelCase_	:						Tuple					   =		abs(hsv_a[2] - hsv_a[2]     ) < 0.002

      return check_hue and check_saturation and check_value
